Update info on CVE-2019-10149
[exim-website.git] / docbook / 4.89.1 / spec.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3
4
5 <?sdop
6   foot_right_recto="&chaptertitle; (&chapternumber;)"
7   foot_right_verso="&chaptertitle; (&chapternumber;)"
8   toc_chapter_blanks="yes,yes"
9   table_warn_overflow="overprint"
10 ?>
11 <book>
12 <bookinfo>
13 <title>Specification of the Exim Mail Transfer Agent</title>
14 <titleabbrev>The Exim MTA</titleabbrev>
15 <date>
16 29 Nov 2017
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.89.1</revnumber>
22 <date>29 Nov 2017</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2017
27            </year><holder>University of Cambridge</holder></copyright>
28 </bookinfo>
29 <chapter id="CHID1">
30 <title>Introduction</title>
31
32 <indexterm role="variable">
33   <primary>$1, $2, etc.</primary>
34   <see><emphasis>numerical variables</emphasis></see>
35 </indexterm>
36 <indexterm role="concept">
37   <primary>address</primary>
38   <secondary>rewriting</secondary>
39   <see><emphasis>rewriting</emphasis></see>
40 </indexterm>
41 <indexterm role="concept">
42   <primary>Bounce Address Tag Validation</primary>
43   <see><emphasis>BATV</emphasis></see>
44 </indexterm>
45 <indexterm role="concept">
46   <primary>Client SMTP Authorization</primary>
47   <see><emphasis>CSA</emphasis></see>
48 </indexterm>
49 <indexterm role="concept">
50   <primary>CR character</primary>
51   <see><emphasis>carriage return</emphasis></see>
52 </indexterm>
53 <indexterm role="concept">
54   <primary>CRL</primary>
55   <see><emphasis>certificate revocation list</emphasis></see>
56 </indexterm>
57 <indexterm role="concept">
58   <primary>delivery</primary>
59   <secondary>failure report</secondary>
60   <see><emphasis>bounce message</emphasis></see>
61 </indexterm>
62 <indexterm role="concept">
63   <primary>dialup</primary>
64   <see><emphasis>intermittently connected hosts</emphasis></see>
65 </indexterm>
66 <indexterm role="concept">
67   <primary>exiscan</primary>
68   <see><emphasis>content scanning</emphasis></see>
69 </indexterm>
70 <indexterm role="concept">
71   <primary>failover</primary>
72   <see><emphasis>fallback</emphasis></see>
73 </indexterm>
74 <indexterm role="concept">
75   <primary>fallover</primary>
76   <see><emphasis>fallback</emphasis></see>
77 </indexterm>
78 <indexterm role="concept">
79   <primary>filter</primary>
80   <secondary>Sieve</secondary>
81   <see><emphasis>Sieve filter</emphasis></see>
82 </indexterm>
83 <indexterm role="concept">
84   <primary>ident</primary>
85   <see><emphasis>RFC 1413</emphasis></see>
86 </indexterm>
87 <indexterm role="concept">
88   <primary>LF character</primary>
89   <see><emphasis>linefeed</emphasis></see>
90 </indexterm>
91 <indexterm role="concept">
92   <primary>maximum</primary>
93   <seealso><emphasis>limit</emphasis></seealso>
94 </indexterm>
95 <indexterm role="concept">
96   <primary>monitor</primary>
97   <see><emphasis>Exim monitor</emphasis></see>
98 </indexterm>
99 <indexterm role="concept">
100   <primary>no_<emphasis>xxx</emphasis></primary>
101   <see>entry for xxx</see>
102 </indexterm>
103 <indexterm role="concept">
104   <primary>NUL</primary>
105   <see><emphasis>binary zero</emphasis></see>
106 </indexterm>
107 <indexterm role="concept">
108   <primary>passwd file</primary>
109   <see><emphasis>/etc/passwd</emphasis></see>
110 </indexterm>
111 <indexterm role="concept">
112   <primary>process id</primary>
113   <see><emphasis>pid</emphasis></see>
114 </indexterm>
115 <indexterm role="concept">
116   <primary>RBL</primary>
117   <see><emphasis>DNS list</emphasis></see>
118 </indexterm>
119 <indexterm role="concept">
120   <primary>redirection</primary>
121   <see><emphasis>address redirection</emphasis></see>
122 </indexterm>
123 <indexterm role="concept">
124   <primary>return path</primary>
125   <seealso><emphasis>envelope sender</emphasis></seealso>
126 </indexterm>
127 <indexterm role="concept">
128   <primary>scanning</primary>
129   <see><emphasis>content scanning</emphasis></see>
130 </indexterm>
131 <indexterm role="concept">
132   <primary>SSL</primary>
133   <see><emphasis>TLS</emphasis></see>
134 </indexterm>
135 <indexterm role="concept">
136   <primary>string</primary>
137   <secondary>expansion</secondary>
138   <see><emphasis>expansion</emphasis></see>
139 </indexterm>
140 <indexterm role="concept">
141   <primary>top bit</primary>
142   <see><emphasis>8-bit characters</emphasis></see>
143 </indexterm>
144 <indexterm role="concept">
145   <primary>variables</primary>
146   <see><emphasis>expansion, variables</emphasis></see>
147 </indexterm>
148 <indexterm role="concept">
149   <primary>zero, binary</primary>
150   <see><emphasis>binary zero</emphasis></see>
151 </indexterm>
152
153 <para>
154 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
155 Unix-like operating systems. It was designed on the assumption that it would be
156 run on hosts that are permanently connected to the Internet. However, it can be
157 used on intermittently connected hosts with suitable configuration adjustments.
158 </para>
159 <para>
160 Configuration files currently exist for the following operating systems: AIX,
161 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
162 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
163 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
164 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
165 Some of these operating systems are no longer current and cannot easily be
166 tested, so the configuration files may no longer work in practice.
167 </para>
168 <para>
169 There are also configuration files for compiling Exim in the Cygwin environment
170 that can be installed on systems running Windows. However, this document does
171 not contain any information about running Exim in the Cygwin environment.
172 </para>
173 <para>
174 The terms and conditions for the use and distribution of Exim are contained in
175 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
176 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
177 </para>
178 <para>
179 The use, supply or promotion of Exim for the purpose of sending bulk,
180 unsolicited electronic mail is incompatible with the basic aims of the program,
181 which revolve around the free provision of a service that enhances the quality
182 of personal communications. The author of Exim regards indiscriminate
183 mass-mailing as an antisocial, irresponsible abuse of the Internet.
184 </para>
185 <para>
186 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
187 experience of running and working on the Smail 3 code, I could never have
188 contemplated starting to write a new MTA. Many of the ideas and user interfaces
189 were originally taken from Smail 3, though the actual code of Exim is entirely
190 new, and has developed far beyond the initial concept.
191 </para>
192 <para>
193 Many people, both in Cambridge and around the world, have contributed to the
194 development and the testing of Exim, and to porting it to various operating
195 systems. I am grateful to them all. The distribution now contains a file called
196 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
197 contributors.
198 </para>
199 <section id="SECID1">
200 <title>Exim documentation</title>
201 <para>
202 <indexterm role="concept">
203 <primary>documentation</primary>
204 </indexterm>
205 This edition of the Exim specification applies to version 4.89.1 of Exim.
206 Substantive changes from the 4.88 edition are marked in some
207 renditions of the document; this paragraph is so marked if the rendition is
208 capable of showing a change indicator.
209 </para>
210 <para>
211 This document is very much a reference manual; it is not a tutorial. The reader
212 is expected to have some familiarity with the SMTP mail transfer protocol and
213 with general Unix system administration. Although there are some discussions
214 and examples in places, the information is mostly organized in a way that makes
215 it easy to look up, rather than in a natural order for sequential reading.
216 Furthermore, the manual aims to cover every aspect of Exim in detail, including
217 a number of rarely-used, special-purpose features that are unlikely to be of
218 very wide interest.
219 </para>
220 <para>
221 <indexterm role="concept">
222 <primary>books about Exim</primary>
223 </indexterm>
224 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
225 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
226 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
227 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
228 </para>
229 <para>
230 This book also contains a chapter that gives a general introduction to SMTP and
231 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
232 with the latest release of Exim. (Note that the earlier book about Exim,
233 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
234 </para>
235 <para>
236 <indexterm role="concept">
237 <primary>Debian</primary>
238 <secondary>information sources</secondary>
239 </indexterm>
240 If you are using a Debian distribution of Exim, you will find information about
241 Debian-specific features in the file
242 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
243 The command <command>man update-exim.conf</command> is another source of Debian-specific
244 information.
245 </para>
246 <para>
247 <indexterm role="concept">
248 <primary><filename>doc/NewStuff</filename></primary>
249 </indexterm>
250 <indexterm role="concept">
251 <primary><filename>doc/ChangeLog</filename></primary>
252 </indexterm>
253 <indexterm role="concept">
254 <primary>change log</primary>
255 </indexterm>
256 As the program develops, there may be features in newer versions that have not
257 yet made it into this document, which is updated only when the most significant
258 digit of the fractional part of the version number changes. Specifications of
259 new features that are not yet in this manual are placed in the file
260 <filename>doc/NewStuff</filename> in the Exim distribution.
261 </para>
262 <para>
263 Some features may be classified as <quote>experimental</quote>. These may change
264 incompatibly while they are developing, or even be withdrawn. For this reason,
265 they are not documented in this manual. Information about experimental features
266 can be found in the file <filename>doc/experimental.txt</filename>.
267 </para>
268 <para>
269 All changes to the program (whether new features, bug fixes, or other kinds of
270 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
271 </para>
272 <para>
273 <indexterm role="concept">
274 <primary><filename>doc/spec.txt</filename></primary>
275 </indexterm>
276 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
277 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
278 directory are:
279 </para>
280 <informaltable frame="none">
281 <tgroup cols="2" colsep="0" rowsep="0">
282 <colspec colwidth="100pt" align="left"/>
283 <colspec colwidth="254pt" align="left"/>
284 <tbody>
285 <row>
286 <entry><filename>OptionLists.txt</filename></entry>
287 <entry>list of all options in alphabetical order</entry>
288 </row>
289 <row>
290 <entry><filename>dbm.discuss.txt</filename></entry>
291 <entry>discussion about DBM libraries</entry>
292 </row>
293 <row>
294 <entry><filename>exim.8</filename></entry>
295 <entry>a man page of Exim&#x2019;s command line options</entry>
296 </row>
297 <row>
298 <entry><filename>experimental.txt</filename></entry>
299 <entry>documentation of experimental features</entry>
300 </row>
301 <row>
302 <entry><filename>filter.txt</filename></entry>
303 <entry>specification of the filter language</entry>
304 </row>
305 <row>
306 <entry><filename>Exim3.upgrade</filename></entry>
307 <entry>upgrade notes from release 2 to release 3</entry>
308 </row>
309 <row>
310 <entry><filename>Exim4.upgrade</filename></entry>
311 <entry>upgrade notes from release 3 to release 4</entry>
312 </row>
313 <row>
314 <entry><filename>openssl.txt</filename></entry>
315 <entry>installing a current OpenSSL release</entry>
316 </row>
317 </tbody>
318 </tgroup>
319 </informaltable>
320 <para>
321 The main specification and the specification of the filtering language are also
322 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
323 <xref linkend="SECTavail"/> below tells you how to get hold of these.
324 </para>
325 </section>
326 <section id="SECID2">
327 <title>FTP and web sites</title>
328 <para>
329 <indexterm role="concept">
330 <primary>web site</primary>
331 </indexterm>
332 <indexterm role="concept">
333 <primary>FTP site</primary>
334 </indexterm>
335 The primary site for Exim source distributions is currently the University of
336 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
337 distribution</emphasis> below. In addition, there is a web site and an FTP site at
338 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
339 <option>exim.org</option> site was previously hosted for a number of years by Energis
340 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
341 </para>
342 <para>
343 <indexterm role="concept">
344 <primary>wiki</primary>
345 </indexterm>
346 <indexterm role="concept">
347 <primary>FAQ</primary>
348 </indexterm>
349 As well as Exim distribution tar files, the Exim web site contains a number of
350 differently formatted versions of the documentation. A recent addition to the
351 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
352 which contains what used to be a separate FAQ, as well as various other
353 examples, tips, and know-how that have been contributed by Exim users.
354 </para>
355 <para>
356 <indexterm role="concept">
357 <primary>Bugzilla</primary>
358 </indexterm>
359 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
360 this to report bugs, and also to add items to the wish list. Please search
361 first to check that you are not duplicating a previous entry.
362 </para>
363 </section>
364 <section id="SECID3">
365 <title>Mailing lists</title>
366 <para>
367 <indexterm role="concept">
368 <primary>mailing lists</primary>
369 <secondary>for Exim users</secondary>
370 </indexterm>
371 The following Exim mailing lists exist:
372 </para>
373 <informaltable frame="none">
374 <tgroup cols="2" colsep="0" rowsep="0">
375 <colspec colwidth="140pt" align="left"/>
376 <colspec colwidth="254pt" align="left"/>
377 <tbody>
378 <row>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>Moderated, low volume announcements list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-users@exim.org</emphasis></entry>
384 <entry>General discussion list</entry>
385 </row>
386 <row>
387 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
388 <entry>Discussion of bugs, enhancements, etc.</entry>
389 </row>
390 <row>
391 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
392 <entry>Automated commit messages from the VCS</entry>
393 </row>
394 </tbody>
395 </tgroup>
396 </informaltable>
397 <para>
398 You can subscribe to these lists, change your existing subscriptions, and view
399 or search the archives via the mailing lists link on the Exim home page.
400 <indexterm role="concept">
401 <primary>Debian</primary>
402 <secondary>mailing list for</secondary>
403 </indexterm>
404 If you are using a Debian distribution of Exim, you may wish to subscribe to
405 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
406 via this web page:
407 </para>
408 <literallayout>
409 <emphasis role="bold"><ulink url="http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users">http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
410 </literallayout>
411 <para>
412 Please ask Debian-specific questions on this list and not on the general Exim
413 lists.
414 </para>
415 </section>
416 <section id="SECID4">
417 <title>Exim training</title>
418 <para>
419 <indexterm role="concept">
420 <primary>training courses</primary>
421 </indexterm>
422 Training courses in Cambridge (UK) used to be run annually by the author of
423 Exim, before he retired. At the time of writing, there are no plans to run
424 further Exim courses in Cambridge. However, if that changes, relevant
425 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>.
426 </para>
427 </section>
428 <section id="SECID5">
429 <title>Bug reports</title>
430 <para>
431 <indexterm role="concept">
432 <primary>bug reports</primary>
433 </indexterm>
434 <indexterm role="concept">
435 <primary>reporting bugs</primary>
436 </indexterm>
437 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
438 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
439 whether some behaviour is a bug or not, the best thing to do is to post a
440 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
441 </para>
442 </section>
443 <section id="SECTavail">
444 <title>Where to find the Exim distribution</title>
445 <para>
446 <indexterm role="concept">
447 <primary>FTP site</primary>
448 </indexterm>
449 <indexterm role="concept">
450 <primary>distribution</primary>
451 <secondary>ftp site</secondary>
452 </indexterm>
453 The master ftp site for the Exim distribution is
454 </para>
455 <literallayout>
456 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
457 </literallayout>
458 <para>
459 This is mirrored by
460 </para>
461 <literallayout>
462 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
463 </literallayout>
464 <para>
465 The file references that follow are relative to the <filename>exim</filename> directories at
466 these sites. There are now quite a number of independent mirror sites around
467 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
468 </para>
469 <para>
470 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
471 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
472 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
473 subdirectory, the current release can always be found in files called
474 </para>
475 <literallayout>
476 <filename>exim-n.nn.tar.gz</filename>
477 <filename>exim-n.nn.tar.bz2</filename>
478 </literallayout>
479 <para>
480 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
481 files contain identical data; the only difference is the type of compression.
482 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
483 </para>
484 <para>
485 <indexterm role="concept">
486 <primary>distribution</primary>
487 <secondary>signing details</secondary>
488 </indexterm>
489 <indexterm role="concept">
490 <primary>distribution</primary>
491 <secondary>public key</secondary>
492 </indexterm>
493 <indexterm role="concept">
494 <primary>public key for signed distribution</primary>
495 </indexterm>
496 The distributions will be PGP signed by an individual key of the Release
497 Coordinator.  This key will have a uid containing an email address in the
498 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
499 other Exim maintainers.  We expect that the key will be in the "strong set" of
500 PGP keys.  There should be a trust path to that key from Nigel Metheringham&#x2019;s
501 PGP key, a version of which can be found in the release directory in the file
502 <filename>nigel-pubkey.asc</filename>.  All keys used will be available in public keyserver pools,
503 such as <emphasis>pool.sks-keyservers.net</emphasis>.
504 </para>
505 <para>
506 At time of last update, releases were being made by Phil Pennock and signed with
507 key <emphasis>0x403043153903637F</emphasis>, although that key is expected to be replaced in 2013.
508 A trust path from Nigel&#x2019;s key to Phil&#x2019;s can be observed at
509 <emphasis role="bold"><ulink url="https://www.security.spodhuis.org/exim-trustpath">https://www.security.spodhuis.org/exim-trustpath</ulink></emphasis>.
510 </para>
511 <para>
512 Releases have also been authorized to be performed by Todd Lyons who signs with
513 key <emphasis>0xC4F4F94804D29EBA</emphasis>. A direct trust path exists between previous RE Phil
514 Pennock and Todd Lyons through a common associate.
515 </para>
516 <para>
517 The signatures for the tar bundles are in:
518 </para>
519 <literallayout>
520 <filename>exim-n.nn.tar.gz.asc</filename>
521 <filename>exim-n.nn.tar.bz2.asc</filename>
522 </literallayout>
523 <para>
524 For each released version, the log of changes is made separately available in a
525 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
526 find out what has changed without having to download the entire distribution.
527 </para>
528 <para>
529 <indexterm role="concept">
530 <primary>documentation</primary>
531 <secondary>available formats</secondary>
532 </indexterm>
533 The main distribution contains ASCII versions of this specification and other
534 documentation; other formats of the documents are available in separate files
535 inside the <filename>exim4</filename> directory of the FTP site:
536 </para>
537 <literallayout>
538 <filename>exim-html-n.nn.tar.gz</filename>
539 <filename>exim-pdf-n.nn.tar.gz</filename>
540 <filename>exim-postscript-n.nn.tar.gz</filename>
541 <filename>exim-texinfo-n.nn.tar.gz</filename>
542 </literallayout>
543 <para>
544 These tar files contain only the <filename>doc</filename> directory, not the complete
545 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
546 </para>
547 </section>
548 <section id="SECID6">
549 <title>Limitations</title>
550 <itemizedlist>
551 <listitem>
552 <para>
553 <indexterm role="concept">
554 <primary>limitations of Exim</primary>
555 </indexterm>
556 <indexterm role="concept">
557 <primary>bang paths</primary>
558 <secondary>not handled by Exim</secondary>
559 </indexterm>
560 Exim is designed for use as an Internet MTA, and therefore handles addresses in
561 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
562 simple two-component bang paths can be converted by a straightforward rewriting
563 configuration. This restriction does not prevent Exim from being interfaced to
564 UUCP as a transport mechanism, provided that domain addresses are used.
565 </para>
566 </listitem>
567 <listitem>
568 <para>
569 <indexterm role="concept">
570 <primary>domainless addresses</primary>
571 </indexterm>
572 <indexterm role="concept">
573 <primary>address</primary>
574 <secondary>without domain</secondary>
575 </indexterm>
576 Exim insists that every address it handles has a domain attached. For incoming
577 local messages, domainless addresses are automatically qualified with a
578 configured domain value. Configuration options specify from which remote
579 systems unqualified addresses are acceptable. These are then qualified on
580 arrival.
581 </para>
582 </listitem>
583 <listitem>
584 <para>
585 <indexterm role="concept">
586 <primary>transport</primary>
587 <secondary>external</secondary>
588 </indexterm>
589 <indexterm role="concept">
590 <primary>external transports</primary>
591 </indexterm>
592 The only external transport mechanisms that are currently implemented are SMTP
593 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
594 transport is available, and there are facilities for writing messages to files
595 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
596 to send messages to other transport mechanisms such as UUCP, provided they can
597 handle domain-style addresses. Batched SMTP input is also catered for.
598 </para>
599 </listitem>
600 <listitem>
601 <para>
602 Exim is not designed for storing mail for dial-in hosts. When the volumes of
603 such mail are large, it is better to get the messages <quote>delivered</quote> into files
604 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
605 other means.
606 </para>
607 </listitem>
608 <listitem>
609 <para>
610 Although Exim does have basic facilities for scanning incoming messages, these
611 are not comprehensive enough to do full virus or spam scanning. Such operations
612 are best carried out using additional specialized software packages. If you
613 compile Exim with the content-scanning extension, straightforward interfaces to
614 a number of common scanners are provided.
615 </para>
616 </listitem>
617 </itemizedlist>
618 </section>
619 <section id="SECID7">
620 <title>Run time configuration</title>
621 <para>
622 Exim&#x2019;s run time configuration is held in a single text file that is divided
623 into a number of sections. The entries in this file consist of keywords and
624 values, in the style of Smail 3 configuration files. A default configuration
625 file which is suitable for simple online installations is provided in the
626 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
627 </para>
628 </section>
629 <section id="SECID8">
630 <title>Calling interface</title>
631 <para>
632 <indexterm role="concept">
633 <primary>Sendmail compatibility</primary>
634 <secondary>command line interface</secondary>
635 </indexterm>
636 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
637 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
638 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
639 about Sendmail in order to run Exim. For actions other than sending messages,
640 Sendmail-compatible options also exist, but those that produce output (for
641 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
642 format. There are also some additional options that are compatible with Smail
643 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
644 documents all Exim&#x2019;s command line options. This information is automatically
645 made into the man page that forms part of the Exim distribution.
646 </para>
647 <para>
648 Control of messages on the queue can be done via certain privileged command
649 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
650 which displays current information in an X window, and which contains a menu
651 interface to Exim&#x2019;s command line administration options.
652 </para>
653 </section>
654 <section id="SECID9">
655 <title>Terminology</title>
656 <para>
657 <indexterm role="concept">
658 <primary>terminology definitions</primary>
659 </indexterm>
660 <indexterm role="concept">
661 <primary>body of message</primary>
662 <secondary>definition of</secondary>
663 </indexterm>
664 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
665 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
666 below) by a blank line.
667 </para>
668 <para>
669 <indexterm role="concept">
670 <primary>bounce message</primary>
671 <secondary>definition of</secondary>
672 </indexterm>
673 When a message cannot be delivered, it is normally returned to the sender in a
674 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
675 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
676 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
677 failure error report</quote>. Such messages have an empty sender address in the
678 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
679 rise to further bounce messages.
680 </para>
681 <para>
682 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
683 value which is used in the absence of any setting in the configuration. It may
684 also qualify an action which is taken unless a configuration setting specifies
685 otherwise.
686 </para>
687 <para>
688 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
689 destination cannot immediately take place for some reason (a remote host may be
690 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
691 until a later time.
692 </para>
693 <para>
694 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
695 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
696 the part of an email address following the @ sign.
697 </para>
698 <para>
699 <indexterm role="concept">
700 <primary>envelope, definition of</primary>
701 </indexterm>
702 <indexterm role="concept">
703 <primary>sender</primary>
704 <secondary>definition of</secondary>
705 </indexterm>
706 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
707 body. The envelope contains a sender address (to which bounce messages should
708 be delivered), and any number of recipient addresses. References to the
709 sender or the recipients of a message usually mean the addresses in the
710 envelope. An MTA uses these addresses for delivery, and for returning bounce
711 messages, not the addresses that appear in the header lines.
712 </para>
713 <para>
714 <indexterm role="concept">
715 <primary>message</primary>
716 <secondary>header, definition of</secondary>
717 </indexterm>
718 <indexterm role="concept">
719 <primary>header section</primary>
720 <secondary>definition of</secondary>
721 </indexterm>
722 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
723 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
724 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
725 indenting the continuations. The header is separated from the body by a blank
726 line.
727 </para>
728 <para>
729 <indexterm role="concept">
730 <primary>local part</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 <indexterm role="concept">
734 <primary>domain</primary>
735 <secondary>definition of</secondary>
736 </indexterm>
737 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
738 part of an email address that precedes the @ sign. The part that follows the
739 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
740 </para>
741 <para>
742 <indexterm role="concept">
743 <primary>local delivery</primary>
744 <secondary>definition of</secondary>
745 </indexterm>
746 <indexterm role="concept">
747 <primary>remote delivery, definition of</primary>
748 </indexterm>
749 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
750 delivery to a file or a pipe on the local host from delivery by SMTP over
751 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
752 host it is running on are <emphasis>remote</emphasis>.
753 </para>
754 <para>
755 <indexterm role="concept">
756 <primary>return path</primary>
757 <secondary>definition of</secondary>
758 </indexterm>
759 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
760 message&#x2019;s envelope.
761 </para>
762 <para>
763 <indexterm role="concept">
764 <primary>queue</primary>
765 <secondary>definition of</secondary>
766 </indexterm>
767 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
768 because this term is in widespread use in the context of MTAs. However, in
769 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
770 normally no ordering of waiting messages.
771 </para>
772 <para>
773 <indexterm role="concept">
774 <primary>queue runner</primary>
775 <secondary>definition of</secondary>
776 </indexterm>
777 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
778 and attempts to deliver those messages whose retry times have come. This term
779 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
780 the waiting messages are normally processed in an unpredictable order.
781 </para>
782 <para>
783 <indexterm role="concept">
784 <primary>spool directory</primary>
785 <secondary>definition of</secondary>
786 </indexterm>
787 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
788 messages on its queue &ndash; that is, those that it is in the process of
789 delivering. This should not be confused with the directory in which local
790 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
791 the Exim documentation, <quote>spool</quote> is always used in the first sense.
792 </para>
793 </section>
794 </chapter>
795
796 <chapter id="CHID2">
797 <title>Incorporated code</title>
798 <para>
799 <indexterm role="concept">
800 <primary>incorporated code</primary>
801 </indexterm>
802 <indexterm role="concept">
803 <primary>regular expressions</primary>
804 <secondary>library</secondary>
805 </indexterm>
806 <indexterm role="concept">
807 <primary>PCRE</primary>
808 </indexterm>
809 <indexterm role="concept">
810 <primary>OpenDMARC</primary>
811 </indexterm>
812 A number of pieces of external code are included in the Exim distribution.
813 </para>
814 <itemizedlist>
815 <listitem>
816 <para>
817 Regular expressions are supported in the main Exim program and in the
818 Exim monitor using the freely-distributable PCRE library, copyright
819 &copy; University of Cambridge. The source to PCRE is no longer shipped with
820 Exim, so you will need to use the version of PCRE shipped with your system,
821 or obtain and install the full version of the library from
822 <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>.
823 </para>
824 </listitem>
825 <listitem>
826 <para>
827 <indexterm role="concept">
828 <primary>cdb</primary>
829 <secondary>acknowledgment</secondary>
830 </indexterm>
831 Support for the cdb (Constant DataBase) lookup method is provided by code
832 contributed by Nigel Metheringham of (at the time he contributed it) Planet
833 Online Ltd. The implementation is completely contained within the code of Exim.
834 It does not link against an external cdb library. The code contains the
835 following statements:
836 </para>
837 <blockquote>
838 <para>
839 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
840 </para>
841 <para>
842 This program is free software; you can redistribute it and/or modify it under
843 the terms of the GNU General Public License as published by the Free Software
844 Foundation; either version 2 of the License, or (at your option) any later
845 version.
846 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
847 the spec and sample code for cdb can be obtained from
848 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
849 some code from Dan Bernstein&#x2019;s implementation (which has no license
850 restrictions applied to it).
851 </para>
852 </blockquote>
853 </listitem>
854 <listitem>
855 <para>
856 <indexterm role="concept">
857 <primary>SPA authentication</primary>
858 </indexterm>
859 <indexterm role="concept">
860 <primary>Samba project</primary>
861 </indexterm>
862 <indexterm role="concept">
863 <primary>Microsoft Secure Password Authentication</primary>
864 </indexterm>
865 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
866 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
867 Tom Kistner. This includes code taken from the Samba project, which is released
868 under the Gnu GPL.
869 </para>
870 </listitem>
871 <listitem>
872 <para>
873 <indexterm role="concept">
874 <primary>Cyrus</primary>
875 </indexterm>
876 <indexterm role="concept">
877 <primary><emphasis>pwcheck</emphasis> daemon</primary>
878 </indexterm>
879 <indexterm role="concept">
880 <primary><emphasis>pwauthd</emphasis> daemon</primary>
881 </indexterm>
882 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
883 by code taken from the Cyrus-SASL library and adapted by Alexander S.
884 Sabourenkov. The permission notice appears below, in accordance with the
885 conditions expressed therein.
886 </para>
887 <blockquote>
888 <para>
889 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
890 </para>
891 <para>
892 Redistribution and use in source and binary forms, with or without
893 modification, are permitted provided that the following conditions
894 are met:
895 </para>
896 <orderedlist numeration="arabic">
897 <listitem>
898 <para>
899 Redistributions of source code must retain the above copyright
900 notice, this list of conditions and the following disclaimer.
901 </para>
902 </listitem>
903 <listitem>
904 <para>
905 Redistributions in binary form must reproduce the above copyright
906 notice, this list of conditions and the following disclaimer in
907 the documentation and/or other materials provided with the
908 distribution.
909 </para>
910 </listitem>
911 <listitem>
912 <para>
913 The name <quote>Carnegie Mellon University</quote> must not be used to
914 endorse or promote products derived from this software without
915 prior written permission. For permission or any other legal
916 details, please contact
917 </para>
918 <literallayout>
919               Office of Technology Transfer
920               Carnegie Mellon University
921               5000 Forbes Avenue
922               Pittsburgh, PA  15213-3890
923               (412) 268-4387, fax: (412) 268-7395
924               tech-transfer@andrew.cmu.edu
925 </literallayout>
926 </listitem>
927 <listitem>
928 <para>
929 Redistributions of any form whatsoever must retain the following
930 acknowledgment:
931 </para>
932 <para>
933 <quote>This product includes software developed by Computing Services
934 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
935 </para>
936 <para>
937 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
938 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
939 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
940 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
941 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
942 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
943 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
944 </para>
945 </listitem>
946 </orderedlist>
947 </blockquote>
948 </listitem>
949 <listitem>
950 <para>
951 <indexterm role="concept">
952 <primary>Exim monitor</primary>
953 <secondary>acknowledgment</secondary>
954 </indexterm>
955 <indexterm role="concept">
956 <primary>X-windows</primary>
957 </indexterm>
958 <indexterm role="concept">
959 <primary>Athena</primary>
960 </indexterm>
961 The Exim Monitor program, which is an X-Window application, includes
962 modified versions of the Athena StripChart and TextPop widgets.
963 This code is copyright by DEC and MIT, and their permission notice appears
964 below, in accordance with the conditions expressed therein.
965 </para>
966 <blockquote>
967 <para>
968 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
969 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
970 </para>
971 <para>
972 All Rights Reserved
973 </para>
974 <para>
975 Permission to use, copy, modify, and distribute this software and its
976 documentation for any purpose and without fee is hereby granted,
977 provided that the above copyright notice appear in all copies and that
978 both that copyright notice and this permission notice appear in
979 supporting documentation, and that the names of Digital or MIT not be
980 used in advertising or publicity pertaining to distribution of the
981 software without specific, written prior permission.
982 </para>
983 <para>
984 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
985 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
986 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
987 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
988 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
989 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
990 SOFTWARE.
991 </para>
992 </blockquote>
993 </listitem>
994 <listitem>
995 <para>
996 <indexterm role="concept">
997 <primary>opendmarc</primary>
998 <secondary>acknowledgment</secondary>
999 </indexterm>
1000 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
1001 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
1002 derived code are indicated in the respective source files. The full OpenDMARC
1003 license is provided in the LICENSE.opendmarc file contained in the distributed
1004 source code.
1005 </para>
1006 </listitem>
1007 <listitem>
1008 <para>
1009 Many people have contributed code fragments, some large, some small, that were
1010 not covered by any specific licence requirements. It is assumed that the
1011 contributors are happy to see their code incorporated into Exim under the GPL.
1012 </para>
1013 </listitem>
1014 </itemizedlist>
1015 </chapter>
1016
1017 <chapter id="CHID11">
1018 <title>How Exim receives and delivers mail</title>
1019 <titleabbrev>Receiving and delivering mail</titleabbrev>
1020 <section id="SECID10">
1021 <title>Overall philosophy</title>
1022 <para>
1023 <indexterm role="concept">
1024 <primary>design philosophy</primary>
1025 </indexterm>
1026 Exim is designed to work efficiently on systems that are permanently connected
1027 to the Internet and are handling a general mix of mail. In such circumstances,
1028 most messages can be delivered immediately. Consequently, Exim does not
1029 maintain independent queues of messages for specific domains or hosts, though
1030 it does try to send several messages in a single SMTP connection after a host
1031 has been down, and it also maintains per-host retry information.
1032 </para>
1033 </section>
1034 <section id="SECID11">
1035 <title>Policy control</title>
1036 <para>
1037 <indexterm role="concept">
1038 <primary>policy control</primary>
1039 <secondary>overview</secondary>
1040 </indexterm>
1041 Policy controls are now an important feature of MTAs that are connected to the
1042 Internet. Perhaps their most important job is to stop MTAs being abused as
1043 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1044 unsolicited junk, and want to disguise its source. Exim provides flexible
1045 facilities for specifying policy controls on incoming mail:
1046 </para>
1047 <itemizedlist>
1048 <listitem>
1049 <para>
1050 <indexterm role="concept">
1051 <primary>access control lists (ACLs)</primary>
1052 <secondary>introduction</secondary>
1053 </indexterm>
1054 Exim 4 (unlike previous versions of Exim) implements policy controls on
1055 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1056 series of statements that may either grant or deny access. ACLs can be used at
1057 several places in the SMTP dialogue while receiving a message from a remote
1058 host. However, the most common places are after each RCPT command, and at the
1059 very end of the message. The sysadmin can specify conditions for accepting or
1060 rejecting individual recipients or the entire message, respectively, at these
1061 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1062 error code.
1063 </para>
1064 </listitem>
1065 <listitem>
1066 <para>
1067 An ACL is also available for locally generated, non-SMTP messages. In this
1068 case, the only available actions are to accept or deny the entire message.
1069 </para>
1070 </listitem>
1071 <listitem>
1072 <para>
1073 When Exim is compiled with the content-scanning extension, facilities are
1074 provided in the ACL mechanism for passing the message to external virus and/or
1075 spam scanning software. The result of such a scan is passed back to the ACL,
1076 which can then use it to decide what to do with the message.
1077 </para>
1078 </listitem>
1079 <listitem>
1080 <para>
1081 When a message has been received, either from a remote host or from the local
1082 host, but before the final acknowledgment has been sent, a locally supplied C
1083 function called <function>local_scan()</function> can be run to inspect the message and decide
1084 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1085 is accepted, the list of recipients can be modified by the function.
1086 </para>
1087 </listitem>
1088 <listitem>
1089 <para>
1090 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1091 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1092 Exim to be compiled with the content-scanning extension.
1093 </para>
1094 </listitem>
1095 <listitem>
1096 <para>
1097 After a message has been accepted, a further checking mechanism is available in
1098 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1099 runs at the start of every delivery process.
1100 </para>
1101 </listitem>
1102 </itemizedlist>
1103 </section>
1104 <section id="SECID12">
1105 <title>User filters</title>
1106 <para>
1107 <indexterm role="concept">
1108 <primary>filter</primary>
1109 <secondary>introduction</secondary>
1110 </indexterm>
1111 <indexterm role="concept">
1112 <primary>Sieve filter</primary>
1113 </indexterm>
1114 In a conventional Exim configuration, users are able to run private filters by
1115 setting up appropriate <filename>.forward</filename> files in their home directories. See
1116 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1117 configuration needed to support this, and the separate document entitled
1118 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1119 of filtering are available:
1120 </para>
1121 <itemizedlist>
1122 <listitem>
1123 <para>
1124 Sieve filters are written in the standard filtering language that is defined
1125 by RFC 3028.
1126 </para>
1127 </listitem>
1128 <listitem>
1129 <para>
1130 Exim filters are written in a syntax that is unique to Exim, but which is more
1131 powerful than Sieve, which it pre-dates.
1132 </para>
1133 </listitem>
1134 </itemizedlist>
1135 <para>
1136 User filters are run as part of the routing process, described below.
1137 </para>
1138 </section>
1139 <section id="SECTmessiden">
1140 <title>Message identification</title>
1141 <para>
1142 <indexterm role="concept">
1143 <primary>message ids</primary>
1144 <secondary>details of format</secondary>
1145 </indexterm>
1146 <indexterm role="concept">
1147 <primary>format</primary>
1148 <secondary>of message id</secondary>
1149 </indexterm>
1150 <indexterm role="concept">
1151 <primary>id of message</primary>
1152 </indexterm>
1153 <indexterm role="concept">
1154 <primary>base62</primary>
1155 </indexterm>
1156 <indexterm role="concept">
1157 <primary>base36</primary>
1158 </indexterm>
1159 <indexterm role="concept">
1160 <primary>Darwin</primary>
1161 </indexterm>
1162 <indexterm role="concept">
1163 <primary>Cygwin</primary>
1164 </indexterm>
1165 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1166 characters long. It is divided into three parts, separated by hyphens, for
1167 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1168 normally encoding numbers in base 62. However, in the Darwin operating
1169 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1170 (avoiding the use of lower case letters) is used instead, because the message
1171 id is used to construct file names, and the names of files in those systems are
1172 not always case-sensitive.
1173 </para>
1174 <para>
1175 <indexterm role="concept">
1176 <primary>pid (process id)</primary>
1177 <secondary>re-use of</secondary>
1178 </indexterm>
1179 The detail of the contents of the message id have changed as Exim has evolved.
1180 Earlier versions relied on the operating system not re-using a process id (pid)
1181 within one second. On modern operating systems, this assumption can no longer
1182 be made, so the algorithm had to be changed. To retain backward compatibility,
1183 the format of the message id was retained, which is why the following rules are
1184 somewhat eccentric:
1185 </para>
1186 <itemizedlist>
1187 <listitem>
1188 <para>
1189 The first six characters of the message id are the time at which the message
1190 started to be received, to a granularity of one second. That is, this field
1191 contains the number of seconds since the start of the epoch (the normal Unix
1192 way of representing the date and time of day).
1193 </para>
1194 </listitem>
1195 <listitem>
1196 <para>
1197 After the first hyphen, the next six characters are the id of the process that
1198 received the message.
1199 </para>
1200 </listitem>
1201 <listitem>
1202 <para>
1203 There are two different possibilities for the final two characters:
1204 </para>
1205 <orderedlist numeration="arabic">
1206 <listitem>
1207 <para>
1208 <indexterm role="option">
1209 <primary><option>localhost_number</option></primary>
1210 </indexterm>
1211 If <option>localhost_number</option> is not set, this value is the fractional part of the
1212 time of reception, normally in units of 1/2000 of a second, but for systems
1213 that must use base 36 instead of base 62 (because of case-insensitive file
1214 systems), the units are 1/1000 of a second.
1215 </para>
1216 </listitem>
1217 <listitem>
1218 <para>
1219 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1220 the fractional part of the time, which in this case is in units of 1/200
1221 (1/100) of a second.
1222 </para>
1223 </listitem>
1224 </orderedlist>
1225 </listitem>
1226 </itemizedlist>
1227 <para>
1228 After a message has been received, Exim waits for the clock to tick at the
1229 appropriate resolution before proceeding, so that if another message is
1230 received by the same process, or by another process with the same (re-used)
1231 pid, it is guaranteed that the time will be different. In most cases, the clock
1232 will already have ticked while the message was being received.
1233 </para>
1234 </section>
1235 <section id="SECID13">
1236 <title>Receiving mail</title>
1237 <para>
1238 <indexterm role="concept">
1239 <primary>receiving mail</primary>
1240 </indexterm>
1241 <indexterm role="concept">
1242 <primary>message</primary>
1243 <secondary>reception</secondary>
1244 </indexterm>
1245 The only way Exim can receive mail from another host is using SMTP over
1246 TCP/IP, in which case the sender and recipient addresses are transferred using
1247 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1248 there are several possibilities:
1249 </para>
1250 <itemizedlist>
1251 <listitem>
1252 <para>
1253 If the process runs Exim with the <option>-bm</option> option, the message is read
1254 non-interactively (usually via a pipe), with the recipients taken from the
1255 command line, or from the body of the message if <option>-t</option> is also used.
1256 </para>
1257 </listitem>
1258 <listitem>
1259 <para>
1260 If the process runs Exim with the <option>-bS</option> option, the message is also read
1261 non-interactively, but in this case the recipients are listed at the start of
1262 the message in a series of SMTP RCPT commands, terminated by a DATA
1263 command. This is so-called <quote>batch SMTP</quote> format,
1264 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1265 envelope addresses in a non-interactive submission.
1266 </para>
1267 </listitem>
1268 <listitem>
1269 <para>
1270 If the process runs Exim with the <option>-bs</option> option, the message is read
1271 interactively, using the SMTP protocol. A two-way pipe is normally used for
1272 passing data between the local process and the Exim process.
1273 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1274 example, the ACLs for SMTP commands are used for this form of submission.
1275 </para>
1276 </listitem>
1277 <listitem>
1278 <para>
1279 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1280 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1281 does not treat the loopback address specially. It treats all such connections
1282 in the same way as connections from other hosts.
1283 </para>
1284 </listitem>
1285 </itemizedlist>
1286 <para>
1287 <indexterm role="concept">
1288 <primary>message sender, constructed by Exim</primary>
1289 </indexterm>
1290 <indexterm role="concept">
1291 <primary>sender</primary>
1292 <secondary>constructed by Exim</secondary>
1293 </indexterm>
1294 In the three cases that do not involve TCP/IP, the sender address is
1295 constructed from the login name of the user that called Exim and a default
1296 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1297 option). For local or batch SMTP, a sender address that is passed using the
1298 SMTP MAIL command is ignored. However, the system administrator may allow
1299 certain users (<quote>trusted users</quote>) to specify a different sender address
1300 unconditionally, or all users to specify certain forms of different sender
1301 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1302 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1303 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1304 users to change sender addresses.
1305 </para>
1306 <para>
1307 Messages received by either of the non-interactive mechanisms are subject to
1308 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1309 (either over TCP/IP, or interacting with a local process) can be checked by a
1310 number of ACLs that operate at different times during the SMTP session. Either
1311 individual recipients, or the entire message, can be rejected if local policy
1312 requirements are not met. The <function>local_scan()</function> function (see chapter
1313 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1314 </para>
1315 <para>
1316 Exim can be configured not to start a delivery process when a message is
1317 received; this can be unconditional, or depend on the number of incoming SMTP
1318 connections or the system load. In these situations, new messages wait on the
1319 queue until a queue runner process picks them up. However, in standard
1320 configurations under normal conditions, delivery is started as soon as a
1321 message is received.
1322 </para>
1323 </section>
1324 <section id="SECID14">
1325 <title>Handling an incoming message</title>
1326 <para>
1327 <indexterm role="concept">
1328 <primary>spool directory</primary>
1329 <secondary>files that hold a message</secondary>
1330 </indexterm>
1331 <indexterm role="concept">
1332 <primary>file</primary>
1333 <secondary>how a message is held</secondary>
1334 </indexterm>
1335 When Exim accepts a message, it writes two files in its spool directory. The
1336 first contains the envelope information, the current status of the message, and
1337 the header lines, and the second contains the body of the message. The names of
1338 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1339 file containing the envelope and header, and <literal>-D</literal> for the data file.
1340 </para>
1341 <para>
1342 <indexterm role="concept">
1343 <primary>spool directory</primary>
1344 <secondary><filename>input</filename> sub-directory</secondary>
1345 </indexterm>
1346 By default all these message files are held in a single directory called
1347 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1348 not perform very well if the number of files in a directory gets large; to
1349 improve performance in such cases, the <option>split_spool_directory</option> option can be
1350 used. This causes Exim to split up the input files into 62 sub-directories
1351 whose names are single letters or digits. When this is done, the queue is
1352 processed one sub-directory at a time instead of all at once, which can improve
1353 overall performance even when there are not enough files in each directory to
1354 affect file system performance.
1355 </para>
1356 <para>
1357 The envelope information consists of the address of the message&#x2019;s sender and
1358 the addresses of the recipients. This information is entirely separate from
1359 any addresses contained in the header lines. The status of the message includes
1360 a list of recipients who have already received the message. The format of the
1361 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1362 </para>
1363 <para>
1364 <indexterm role="concept">
1365 <primary>rewriting</primary>
1366 <secondary>addresses</secondary>
1367 </indexterm>
1368 Address rewriting that is specified in the rewrite section of the configuration
1369 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1370 both in the header lines and the envelope, at the time the message is accepted.
1371 If during the course of delivery additional addresses are generated (for
1372 example, via aliasing), these new addresses are rewritten as soon as they are
1373 generated. At the time a message is actually delivered (transported) further
1374 rewriting can take place; because this is a transport option, it can be
1375 different for different forms of delivery. It is also possible to specify the
1376 addition or removal of certain header lines at the time the message is
1377 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1378 <xref linkend="CHAPtransportgeneric"/>).
1379 </para>
1380 </section>
1381 <section id="SECID15">
1382 <title>Life of a message</title>
1383 <para>
1384 <indexterm role="concept">
1385 <primary>message</primary>
1386 <secondary>life of</secondary>
1387 </indexterm>
1388 <indexterm role="concept">
1389 <primary>message</primary>
1390 <secondary>frozen</secondary>
1391 </indexterm>
1392 A message remains in the spool directory until it is completely delivered to
1393 its recipients or to an error address, or until it is deleted by an
1394 administrator or by the user who originally created it. In cases when delivery
1395 cannot proceed &ndash; for example, when a message can neither be delivered to its
1396 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1397 spool, and no more deliveries are attempted.
1398 </para>
1399 <para>
1400 <indexterm role="concept">
1401 <primary>frozen messages</primary>
1402 <secondary>thawing</secondary>
1403 </indexterm>
1404 <indexterm role="concept">
1405 <primary>message</primary>
1406 <secondary>thawing frozen</secondary>
1407 </indexterm>
1408 An administrator can <quote>thaw</quote> such messages when the problem has been
1409 corrected, and can also freeze individual messages by hand if necessary. In
1410 addition, an administrator can force a delivery error, causing a bounce message
1411 to be sent.
1412 </para>
1413 <para>
1414 <indexterm role="option">
1415 <primary><option>timeout_frozen_after</option></primary>
1416 </indexterm>
1417 <indexterm role="option">
1418 <primary><option>ignore_bounce_errors_after</option></primary>
1419 </indexterm>
1420 There are options called <option>ignore_bounce_errors_after</option> and
1421 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1422 The first applies only to frozen bounces, the second to any frozen messages.
1423 </para>
1424 <para>
1425 <indexterm role="concept">
1426 <primary>message</primary>
1427 <secondary>log file for</secondary>
1428 </indexterm>
1429 <indexterm role="concept">
1430 <primary>log</primary>
1431 <secondary>file for each message</secondary>
1432 </indexterm>
1433 While Exim is working on a message, it writes information about each delivery
1434 attempt to its main log file. This includes successful, unsuccessful, and
1435 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1436 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1437 These logs are solely for the benefit of the administrator, and are normally
1438 deleted along with the spool files when processing of a message is complete.
1439 The use of individual message logs can be disabled by setting
1440 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1441 systems.
1442 </para>
1443 <para>
1444 <indexterm role="concept">
1445 <primary>journal file</primary>
1446 </indexterm>
1447 <indexterm role="concept">
1448 <primary>file</primary>
1449 <secondary>journal</secondary>
1450 </indexterm>
1451 All the information Exim itself needs to set up a delivery is kept in the first
1452 spool file, along with the header lines. When a successful delivery occurs, the
1453 address is immediately written at the end of a journal file, whose name is the
1454 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1455 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1456 is updated to indicate which these are, and the journal file is then deleted.
1457 Updating the spool file is done by writing a new file and renaming it, to
1458 minimize the possibility of data loss.
1459 </para>
1460 <para>
1461 Should the system or the program crash after a successful delivery but before
1462 the spool file has been updated, the journal is left lying around. The next
1463 time Exim attempts to deliver the message, it reads the journal file and
1464 updates the spool file before proceeding. This minimizes the chances of double
1465 deliveries caused by crashes.
1466 </para>
1467 </section>
1468 <section id="SECTprocaddress">
1469 <title>Processing an address for delivery</title>
1470 <para>
1471 <indexterm role="concept">
1472 <primary>drivers</primary>
1473 <secondary>definition of</secondary>
1474 </indexterm>
1475 <indexterm role="concept">
1476 <primary>router</primary>
1477 <secondary>definition of</secondary>
1478 </indexterm>
1479 <indexterm role="concept">
1480 <primary>transport</primary>
1481 <secondary>definition of</secondary>
1482 </indexterm>
1483 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1484 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1485 number of them is provided in the source distribution, and compile-time options
1486 specify which ones are included in the binary. Run time options specify which
1487 ones are actually used for delivering messages.
1488 </para>
1489 <para>
1490 <indexterm role="concept">
1491 <primary>drivers</primary>
1492 <secondary>instance definition</secondary>
1493 </indexterm>
1494 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1495 of that particular driver type. Multiple instances are allowed; for example,
1496 you can set up several different <command>smtp</command> transports, each with different
1497 option values that might specify different ports or different timeouts. Each
1498 instance has its own identifying name. In what follows we will normally use the
1499 instance name when discussing one particular instance (that is, one specific
1500 configuration of the driver), and the generic driver name when discussing
1501 the driver&#x2019;s features in general.
1502 </para>
1503 <para>
1504 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1505 its delivery should happen, by assigning it to a specific transport, or
1506 converting the address into one or more new addresses (for example, via an
1507 alias file). A router may also explicitly choose to fail an address, causing it
1508 to be bounced.
1509 </para>
1510 <para>
1511 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1512 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1513 transport, the destination is a file or a pipe on the local host, whereas for a
1514 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1515 to a specific transport as a result of successful routing. If a message has
1516 several recipients, it may be passed to a number of different transports.
1517 </para>
1518 <para>
1519 <indexterm role="concept">
1520 <primary>preconditions</primary>
1521 <secondary>definition of</secondary>
1522 </indexterm>
1523 An address is processed by passing it to each configured router instance in
1524 turn, subject to certain preconditions, until a router accepts the address or
1525 specifies that it should be bounced. We will describe this process in more
1526 detail shortly. First, as a simple example, we consider how each recipient
1527 address in a message is processed in a small configuration of three routers.
1528 </para>
1529 <para>
1530 To make this a more concrete example, it is described in terms of some actual
1531 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1532 routers in many different ways, and there may be any number of routers in a
1533 configuration.
1534 </para>
1535 <para>
1536 The first router that is specified in a configuration is often one that handles
1537 addresses in domains that are not recognized specially by the local host. These
1538 are typically addresses for arbitrary domains on the Internet. A precondition
1539 is set up which looks for the special domains known to the host (for example,
1540 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1541 match. Typically, this is a router that looks up domains in the DNS in order to
1542 find the hosts to which this address routes. If it succeeds, the address is
1543 assigned to a suitable SMTP transport; if it does not succeed, the router is
1544 configured to fail the address.
1545 </para>
1546 <para>
1547 The second router is reached only when the domain is recognized as one that
1548 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1549 aliasing and forwarding. When it generates one or more new addresses from the
1550 original, each of them is routed independently from the start. Otherwise, the
1551 router may cause an address to fail, or it may simply decline to handle the
1552 address, in which case the address is passed to the next router.
1553 </para>
1554 <para>
1555 The final router in many configurations is one that checks to see if the
1556 address belongs to a local mailbox. The precondition may involve a check to
1557 see if the local part is the name of a login account, or it may look up the
1558 local part in a file or a database. If its preconditions are not met, or if
1559 the router declines, we have reached the end of the routers. When this happens,
1560 the address is bounced.
1561 </para>
1562 </section>
1563 <section id="SECID16">
1564 <title>Processing an address for verification</title>
1565 <para>
1566 <indexterm role="concept">
1567 <primary>router</primary>
1568 <secondary>for verification</secondary>
1569 </indexterm>
1570 <indexterm role="concept">
1571 <primary>verifying address</primary>
1572 <secondary>overview</secondary>
1573 </indexterm>
1574 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1575 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1576 one of the checks to be performed in an ACL for incoming messages, on both
1577 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1578 <option>-bvs</option> command line options.
1579 </para>
1580 <para>
1581 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1582 does not affect the way the routers work, but it is a state that can be
1583 detected. By this means, a router can be skipped or made to behave differently
1584 when verifying. A common example is a configuration in which the first router
1585 sends all messages to a message-scanning program, unless they have been
1586 previously scanned. Thus, the first router accepts all addresses without any
1587 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1588 would be set for such a router, causing it to be skipped in verify mode.
1589 </para>
1590 </section>
1591 <section id="SECTrunindrou">
1592 <title>Running an individual router</title>
1593 <para>
1594 <indexterm role="concept">
1595 <primary>router</primary>
1596 <secondary>running details</secondary>
1597 </indexterm>
1598 <indexterm role="concept">
1599 <primary>preconditions</primary>
1600 <secondary>checking</secondary>
1601 </indexterm>
1602 <indexterm role="concept">
1603 <primary>router</primary>
1604 <secondary>result of running</secondary>
1605 </indexterm>
1606 As explained in the example above, a number of preconditions are checked before
1607 running a router. If any are not met, the router is skipped, and the address is
1608 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1609 the router is run. What happens next depends on the outcome, which is one of
1610 the following:
1611 </para>
1612 <itemizedlist>
1613 <listitem>
1614 <para>
1615 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1616 transport, or generates one or more <quote>child</quote> addresses. Processing the
1617 original address ceases,
1618 <indexterm role="option">
1619 <primary><option>unseen</option></primary>
1620 </indexterm>
1621 unless the <option>unseen</option> option is set on the router. This option
1622 can be used to set up multiple deliveries with different routing (for example,
1623 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1624 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1625 end of routing.
1626 </para>
1627 <para>
1628 Any child addresses generated by the router are processed independently,
1629 starting with the first router by default. It is possible to change this by
1630 setting the <option>redirect_router</option> option to specify which router to start at for
1631 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1632 <option>redirect_router</option> may be anywhere in the router configuration.
1633 </para>
1634 </listitem>
1635 <listitem>
1636 <para>
1637 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1638 requests that the address be passed to another router. By default the address
1639 is passed to the next router, but this can be changed by setting the
1640 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1641 must be below the current router (to avoid loops).
1642 </para>
1643 </listitem>
1644 <listitem>
1645 <para>
1646 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1647 recognize it at all. By default, the address is passed to the next router, but
1648 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1649 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1650 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1651 </para>
1652 </listitem>
1653 <listitem>
1654 <para>
1655 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1656 the generation of a bounce message. There is no further processing of the
1657 original address unless <option>unseen</option> is set on the router.
1658 </para>
1659 </listitem>
1660 <listitem>
1661 <para>
1662 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1663 database may be offline, or a DNS lookup may have timed out.) No further
1664 processing of the address happens in this delivery attempt. It is tried again
1665 next time the message is considered for delivery.
1666 </para>
1667 </listitem>
1668 <listitem>
1669 <para>
1670 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1671 its configuration). The action is as for defer.
1672 </para>
1673 </listitem>
1674 </itemizedlist>
1675 <para>
1676 If an address reaches the end of the routers without having been accepted by
1677 any of them, it is bounced as unrouteable. The default error message in this
1678 situation is <quote>unrouteable address</quote>, but you can set your own message by
1679 making use of the <option>cannot_route_message</option> option. This can be set for any
1680 router; the value from the last router that <quote>saw</quote> the address is used.
1681 </para>
1682 <para>
1683 Sometimes while routing you want to fail a delivery when some conditions are
1684 met but others are not, instead of passing the address on for further routing.
1685 You can do this by having a second router that explicitly fails the delivery
1686 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1687 facility for this purpose.
1688 </para>
1689 </section>
1690 <section id="SECID17">
1691 <title>Duplicate addresses</title>
1692 <para>
1693 <indexterm role="concept">
1694 <primary>case of local parts</primary>
1695 </indexterm>
1696 <indexterm role="concept">
1697 <primary>address duplicate, discarding</primary>
1698 </indexterm>
1699 <indexterm role="concept">
1700 <primary>duplicate addresses</primary>
1701 </indexterm>
1702 Once routing is complete, Exim scans the addresses that are assigned to local
1703 and remote transports, and discards any duplicates that it finds. During this
1704 check, local parts are treated as case-sensitive. This happens only when
1705 actually delivering a message; when testing routers with <option>-bt</option>, all the
1706 routed addresses are shown.
1707 </para>
1708 </section>
1709 <section id="SECTrouprecon">
1710 <title>Router preconditions</title>
1711 <para>
1712 <indexterm role="concept">
1713 <primary>router</primary>
1714 <secondary>preconditions, order of processing</secondary>
1715 </indexterm>
1716 <indexterm role="concept">
1717 <primary>preconditions</primary>
1718 <secondary>order of processing</secondary>
1719 </indexterm>
1720 The preconditions that are tested for each router are listed below, in the
1721 order in which they are tested. The individual configuration options are
1722 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1723 </para>
1724 <itemizedlist>
1725 <listitem>
1726 <para>
1727 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1728 the local parts handled by the router may or must have certain prefixes and/or
1729 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1730 skipped. These conditions are tested first. When an affix is present, it is
1731 removed from the local part before further processing, including the evaluation
1732 of any other conditions.
1733 </para>
1734 </listitem>
1735 <listitem>
1736 <para>
1737 Routers can be designated for use only when not verifying an address, that is,
1738 only when routing it for delivery (or testing its delivery routing). If the
1739 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1740 address.
1741 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1742 <option>verify_recipient</option>, which independently control the use of the router for
1743 sender and recipient verification. You can set these options directly if
1744 you want a router to be used for only one type of verification.
1745 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1746 </para>
1747 </listitem>
1748 <listitem>
1749 <para>
1750 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1751 run with the <option>-bt</option> option to test an address routing. This can be helpful
1752 when the first router sends all new messages to a scanner of some sort; it
1753 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1754 having to simulate the effect of the scanner.
1755 </para>
1756 </listitem>
1757 <listitem>
1758 <para>
1759 Routers can be designated for use only when verifying an address, as
1760 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1761 Again, cutthrough delivery counts as a verification.
1762 </para>
1763 </listitem>
1764 <listitem>
1765 <para>
1766 Individual routers can be explicitly skipped when running the routers to
1767 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1768 </para>
1769 </listitem>
1770 <listitem>
1771 <para>
1772 If the <option>domains</option> option is set, the domain of the address must be in the set
1773 of domains that it defines.
1774 </para>
1775 </listitem>
1776 <listitem>
1777 <para>
1778 <indexterm role="variable">
1779 <primary><varname>$local_part_prefix</varname></primary>
1780 </indexterm>
1781 <indexterm role="variable">
1782 <primary><varname>$local_part</varname></primary>
1783 </indexterm>
1784 <indexterm role="variable">
1785 <primary><varname>$local_part_suffix</varname></primary>
1786 </indexterm>
1787 If the <option>local_parts</option> option is set, the local part of the address must be in
1788 the set of local parts that it defines. If <option>local_part_prefix</option> or
1789 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1790 part before this check. If you want to do precondition tests on local parts
1791 that include affixes, you can do so by using a <option>condition</option> option (see below)
1792 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1793 <varname>$local_part_suffix</varname> as necessary.
1794 </para>
1795 </listitem>
1796 <listitem>
1797 <para>
1798 <indexterm role="variable">
1799 <primary><varname>$local_user_uid</varname></primary>
1800 </indexterm>
1801 <indexterm role="variable">
1802 <primary><varname>$local_user_gid</varname></primary>
1803 </indexterm>
1804 <indexterm role="variable">
1805 <primary><varname>$home</varname></primary>
1806 </indexterm>
1807 If the <option>check_local_user</option> option is set, the local part must be the name of
1808 an account on the local host. If this check succeeds, the uid and gid of the
1809 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1810 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1811 remaining preconditions.
1812 </para>
1813 </listitem>
1814 <listitem>
1815 <para>
1816 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1817 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1818 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1819 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1820 could lead to confusion.
1821 </para>
1822 </listitem>
1823 <listitem>
1824 <para>
1825 If the <option>senders</option> option is set, the envelope sender address must be in the
1826 set of addresses that it defines.
1827 </para>
1828 </listitem>
1829 <listitem>
1830 <para>
1831 If the <option>require_files</option> option is set, the existence or non-existence of
1832 specified files is tested.
1833 </para>
1834 </listitem>
1835 <listitem>
1836 <para>
1837 <indexterm role="concept">
1838 <primary>customizing</primary>
1839 <secondary>precondition</secondary>
1840 </indexterm>
1841 If the <option>condition</option> option is set, it is evaluated and tested. This option
1842 uses an expanded string to allow you to set up your own custom preconditions.
1843 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1844 </para>
1845 </listitem>
1846 </itemizedlist>
1847 <para>
1848 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1849 it to check for the existence of a file in which to lookup up a domain, local
1850 part, or sender. However, as these options are all expanded, you can use the
1851 <option>exists</option> expansion condition to make such tests within each condition. The
1852 <option>require_files</option> option is intended for checking files that the router may be
1853 going to use internally, or which are needed by a specific transport (for
1854 example, <filename>.procmailrc</filename>).
1855 </para>
1856 </section>
1857 <section id="SECID18">
1858 <title>Delivery in detail</title>
1859 <para>
1860 <indexterm role="concept">
1861 <primary>delivery</primary>
1862 <secondary>in detail</secondary>
1863 </indexterm>
1864 When a message is to be delivered, the sequence of events is as follows:
1865 </para>
1866 <itemizedlist>
1867 <listitem>
1868 <para>
1869 If a system-wide filter file is specified, the message is passed to it. The
1870 filter may add recipients to the message, replace the recipients, discard the
1871 message, cause a new message to be generated, or cause the message delivery to
1872 fail. The format of the system filter file is the same as for Exim user filter
1873 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1874 filtering</emphasis>.
1875 <indexterm role="concept">
1876 <primary>Sieve filter</primary>
1877 <secondary>not available for system filter</secondary>
1878 </indexterm>
1879 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1880 </para>
1881 <para>
1882 Some additional features are available in system filters &ndash; see chapter
1883 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1884 filter only once per delivery attempt, however many recipients it has. However,
1885 if there are several delivery attempts because one or more addresses could not
1886 be immediately delivered, the system filter is run each time. The filter
1887 condition <option>first_delivery</option> can be used to detect the first run of the system
1888 filter.
1889 </para>
1890 </listitem>
1891 <listitem>
1892 <para>
1893 Each recipient address is offered to each configured router in turn, subject to
1894 its preconditions, until one is able to handle it. If no router can handle the
1895 address, that is, if they all decline, the address is failed. Because routers
1896 can be targeted at particular domains, several locally handled domains can be
1897 processed entirely independently of each other.
1898 </para>
1899 </listitem>
1900 <listitem>
1901 <para>
1902 <indexterm role="concept">
1903 <primary>routing</primary>
1904 <secondary>loops in</secondary>
1905 </indexterm>
1906 <indexterm role="concept">
1907 <primary>loop</primary>
1908 <secondary>while routing</secondary>
1909 </indexterm>
1910 A router that accepts an address may assign it to a local or a remote
1911 transport. However, the transport is not run at this time. Instead, the address
1912 is placed on a list for the particular transport, which will be run later.
1913 Alternatively, the router may generate one or more new addresses (typically
1914 from alias, forward, or filter files). New addresses are fed back into this
1915 process from the top, but in order to avoid loops, a router ignores any address
1916 which has an identically-named ancestor that was processed by itself.
1917 </para>
1918 </listitem>
1919 <listitem>
1920 <para>
1921 When all the routing has been done, addresses that have been successfully
1922 handled are passed to their assigned transports. When local transports are
1923 doing real local deliveries, they handle only one address at a time, but if a
1924 local transport is being used as a pseudo-remote transport (for example, to
1925 collect batched SMTP messages for transmission by some other means) multiple
1926 addresses can be handled. Remote transports can always handle more than one
1927 address at a time, but can be configured not to do so, or to restrict multiple
1928 addresses to the same domain.
1929 </para>
1930 </listitem>
1931 <listitem>
1932 <para>
1933 Each local delivery to a file or a pipe runs in a separate process under a
1934 non-privileged uid, and these deliveries are run one at a time. Remote
1935 deliveries also run in separate processes, normally under a uid that is private
1936 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1937 run in parallel. The maximum number of simultaneous remote deliveries for any
1938 one message is set by the <option>remote_max_parallel</option> option.
1939 The order in which deliveries are done is not defined, except that all local
1940 deliveries happen before any remote deliveries.
1941 </para>
1942 </listitem>
1943 <listitem>
1944 <para>
1945 <indexterm role="concept">
1946 <primary>queue runner</primary>
1947 </indexterm>
1948 When it encounters a local delivery during a queue run, Exim checks its retry
1949 database to see if there has been a previous temporary delivery failure for the
1950 address before running the local transport. If there was a previous failure,
1951 Exim does not attempt a new delivery until the retry time for the address is
1952 reached. However, this happens only for delivery attempts that are part of a
1953 queue run. Local deliveries are always attempted when delivery immediately
1954 follows message reception, even if retry times are set for them. This makes for
1955 better behaviour if one particular message is causing problems (for example,
1956 causing quota overflow, or provoking an error in a filter file).
1957 </para>
1958 </listitem>
1959 <listitem>
1960 <para>
1961 <indexterm role="concept">
1962 <primary>delivery</primary>
1963 <secondary>retry in remote transports</secondary>
1964 </indexterm>
1965 Remote transports do their own retry handling, since an address may be
1966 deliverable to one of a number of hosts, each of which may have a different
1967 retry time. If there have been previous temporary failures and no host has
1968 reached its retry time, no delivery is attempted, whether in a queue run or
1969 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1970 </para>
1971 </listitem>
1972 <listitem>
1973 <para>
1974 If there were any permanent errors, a bounce message is returned to an
1975 appropriate address (the sender in the common case), with details of the error
1976 for each failing address. Exim can be configured to send copies of bounce
1977 messages to other addresses.
1978 </para>
1979 </listitem>
1980 <listitem>
1981 <para>
1982 <indexterm role="concept">
1983 <primary>delivery</primary>
1984 <secondary>deferral</secondary>
1985 </indexterm>
1986 If one or more addresses suffered a temporary failure, the message is left on
1987 the queue, to be tried again later. Delivery of these addresses is said to be
1988 <emphasis>deferred</emphasis>.
1989 </para>
1990 </listitem>
1991 <listitem>
1992 <para>
1993 When all the recipient addresses have either been delivered or bounced,
1994 handling of the message is complete. The spool files and message log are
1995 deleted, though the message log can optionally be preserved if required.
1996 </para>
1997 </listitem>
1998 </itemizedlist>
1999 </section>
2000 <section id="SECID19">
2001 <title>Retry mechanism</title>
2002 <para>
2003 <indexterm role="concept">
2004 <primary>delivery</primary>
2005 <secondary>retry mechanism</secondary>
2006 </indexterm>
2007 <indexterm role="concept">
2008 <primary>retry</primary>
2009 <secondary>description of mechanism</secondary>
2010 </indexterm>
2011 <indexterm role="concept">
2012 <primary>queue runner</primary>
2013 </indexterm>
2014 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2015 attempt is the queue runner process. You must either run an Exim daemon that
2016 uses the <option>-q</option> option with a time interval to start queue runners at regular
2017 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2018 not arrange for queue runners to be run, messages that fail temporarily at the
2019 first attempt will remain on your queue for ever. A queue runner process works
2020 its way through the queue, one message at a time, trying each delivery that has
2021 passed its retry time.
2022 You can run several queue runners at once.
2023 </para>
2024 <para>
2025 Exim uses a set of configured rules to determine when next to retry the failing
2026 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2027 should give up trying to deliver to the address, at which point it generates a
2028 bounce message. If no retry rules are set for a particular host, address, and
2029 error combination, no retries are attempted, and temporary errors are treated
2030 as permanent.
2031 </para>
2032 </section>
2033 <section id="SECID20">
2034 <title>Temporary delivery failure</title>
2035 <para>
2036 <indexterm role="concept">
2037 <primary>delivery</primary>
2038 <secondary>temporary failure</secondary>
2039 </indexterm>
2040 There are many reasons why a message may not be immediately deliverable to a
2041 particular address. Failure to connect to a remote machine (because it, or the
2042 connection to it, is down) is one of the most common. Temporary failures may be
2043 detected during routing as well as during the transport stage of delivery.
2044 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2045 is on a file system where the user is over quota. Exim can be configured to
2046 impose its own quotas on local mailboxes; where system quotas are set they will
2047 also apply.
2048 </para>
2049 <para>
2050 If a host is unreachable for a period of time, a number of messages may be
2051 waiting for it by the time it recovers, and sending them in a single SMTP
2052 connection is clearly beneficial. Whenever a delivery to a remote host is
2053 deferred,
2054 <indexterm role="concept">
2055 <primary>hints database</primary>
2056 <secondary>deferred deliveries</secondary>
2057 </indexterm>
2058 Exim makes a note in its hints database, and whenever a successful
2059 SMTP delivery has happened, it looks to see if any other messages are waiting
2060 for the same host. If any are found, they are sent over the same SMTP
2061 connection, subject to a configuration limit as to the maximum number in any
2062 one connection.
2063 </para>
2064 </section>
2065 <section id="SECID21">
2066 <title>Permanent delivery failure</title>
2067 <para>
2068 <indexterm role="concept">
2069 <primary>delivery</primary>
2070 <secondary>permanent failure</secondary>
2071 </indexterm>
2072 <indexterm role="concept">
2073 <primary>bounce message</primary>
2074 <secondary>when generated</secondary>
2075 </indexterm>
2076 When a message cannot be delivered to some or all of its intended recipients, a
2077 bounce message is generated. Temporary delivery failures turn into permanent
2078 errors when their timeout expires. All the addresses that fail in a given
2079 delivery attempt are listed in a single message. If the original message has
2080 many recipients, it is possible for some addresses to fail in one delivery
2081 attempt and others to fail subsequently, giving rise to more than one bounce
2082 message. The wording of bounce messages can be customized by the administrator.
2083 See chapter <xref linkend="CHAPemsgcust"/> for details.
2084 </para>
2085 <para>
2086 <indexterm role="concept">
2087 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2088 </indexterm>
2089 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2090 failed addresses, for the benefit of programs that try to analyse such messages
2091 automatically.
2092 </para>
2093 <para>
2094 <indexterm role="concept">
2095 <primary>bounce message</primary>
2096 <secondary>recipient of</secondary>
2097 </indexterm>
2098 A bounce message is normally sent to the sender of the original message, as
2099 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2100 address given in the MAIL command. However, when an address is expanded via a
2101 forward or alias file, an alternative address can be specified for delivery
2102 failures of the generated addresses. For a mailing list expansion (see section
2103 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2104 of the list.
2105 </para>
2106 </section>
2107 <section id="SECID22">
2108 <title>Failures to deliver bounce messages</title>
2109 <para>
2110 <indexterm role="concept">
2111 <primary>bounce message</primary>
2112 <secondary>failure to deliver</secondary>
2113 </indexterm>
2114 If a bounce message (either locally generated or received from a remote host)
2115 itself suffers a permanent delivery failure, the message is left on the queue,
2116 but it is frozen, awaiting the attention of an administrator. There are options
2117 that can be used to make Exim discard such failed messages, or to keep them
2118 for only a short time (see <option>timeout_frozen_after</option> and
2119 <option>ignore_bounce_errors_after</option>).
2120 </para>
2121 </section>
2122 </chapter>
2123
2124 <chapter id="CHID3">
2125 <title>Building and installing Exim</title>
2126 <para>
2127 <indexterm role="concept" id="IIDbuex" class="startofrange">
2128 <primary>building Exim</primary>
2129 </indexterm>
2130 </para>
2131 <section id="SECID23">
2132 <title>Unpacking</title>
2133 <para>
2134 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2135 creates a directory with the name of the current release (for example,
2136 <filename>exim-4.89.1</filename>) into which the following files are placed:
2137 </para>
2138 <informaltable frame="none">
2139 <tgroup cols="2" colsep="0" rowsep="0">
2140 <colspec colwidth="140pt" align="left"/>
2141 <colspec colwidth="254pt" align="left"/>
2142 <tbody>
2143 <row>
2144 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2145 <entry>contains some acknowledgments</entry>
2146 </row>
2147 <row>
2148 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2149 <entry>contains a reference to where changes are documented</entry>
2150 </row>
2151 <row>
2152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2153 <entry>the GNU General Public Licence</entry>
2154 </row>
2155 <row>
2156 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2157 <entry>top-level make file</entry>
2158 </row>
2159 <row>
2160 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2161 <entry>conditions for the use of Exim</entry>
2162 </row>
2163 <row>
2164 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2165 <entry>list of files, directories and simple build instructions</entry>
2166 </row>
2167 </tbody>
2168 </tgroup>
2169 </informaltable>
2170 <para>
2171 Other files whose names begin with <filename>README</filename> may also be present. The
2172 following subdirectories are created:
2173 </para>
2174 <informaltable frame="none">
2175 <tgroup cols="2" colsep="0" rowsep="0">
2176 <colspec colwidth="140pt" align="left"/>
2177 <colspec colwidth="254pt" align="left"/>
2178 <tbody>
2179 <row>
2180 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2181 <entry>an empty directory for local configuration files</entry>
2182 </row>
2183 <row>
2184 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2185 <entry>OS-specific files</entry>
2186 </row>
2187 <row>
2188 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2189 <entry>documentation files</entry>
2190 </row>
2191 <row>
2192 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2193 <entry>source files for the Exim monitor</entry>
2194 </row>
2195 <row>
2196 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2197 <entry>scripts used in the build process</entry>
2198 </row>
2199 <row>
2200 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2201 <entry>remaining source files</entry>
2202 </row>
2203 <row>
2204 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2205 <entry>independent utilities</entry>
2206 </row>
2207 </tbody>
2208 </tgroup>
2209 </informaltable>
2210 <para>
2211 The main utility programs are contained in the <filename>src</filename> directory, and are built
2212 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2213 that may be useful to some sites.
2214 </para>
2215 </section>
2216 <section id="SECID24">
2217 <title>Multiple machine architectures and operating systems</title>
2218 <para>
2219 <indexterm role="concept">
2220 <primary>building Exim</primary>
2221 <secondary>multiple OS/architectures</secondary>
2222 </indexterm>
2223 The building process for Exim is arranged to make it easy to build binaries for
2224 a number of different architectures and operating systems from the same set of
2225 source files. Compilation does not take place in the <filename>src</filename> directory.
2226 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2227 system.
2228 <indexterm role="concept">
2229 <primary>symbolic link</primary>
2230 <secondary>to build directory</secondary>
2231 </indexterm>
2232 Symbolic links to the sources are installed in this directory, which is where
2233 the actual building takes place. In most cases, Exim can discover the machine
2234 architecture and operating system for itself, but the defaults can be
2235 overridden if necessary.
2236 </para>
2237 </section>
2238 <section id="SECTpcre">
2239 <title>PCRE library</title>
2240 <para>
2241 <indexterm role="concept">
2242 <primary>PCRE library</primary>
2243 </indexterm>
2244 Exim no longer has an embedded PCRE library as the vast majority of
2245 modern systems include PCRE as a system library, although you may need
2246 to install the PCRE or PCRE development package for your operating
2247 system. If your system has a normal PCRE installation the Exim build
2248 process will need no further configuration. If the library or the
2249 headers are in an unusual location you will need to either set the PCRE_LIBS
2250 and INCLUDE directives appropriately,
2251 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2252 If your operating system has no
2253 PCRE support then you will need to obtain and build the current PCRE
2254 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>.
2255 More information on PCRE is available at <emphasis role="bold"><ulink url="http://www.pcre.org/">http://www.pcre.org/</ulink></emphasis>.
2256 </para>
2257 </section>
2258 <section id="SECTdb">
2259 <title>DBM libraries</title>
2260 <para>
2261 <indexterm role="concept">
2262 <primary>DBM libraries</primary>
2263 <secondary>discussion of</secondary>
2264 </indexterm>
2265 <indexterm role="concept">
2266 <primary>hints database</primary>
2267 <secondary>DBM files used for</secondary>
2268 </indexterm>
2269 Even if you do not use any DBM files in your configuration, Exim still needs a
2270 DBM library in order to operate, because it uses indexed files for its hints
2271 databases. Unfortunately, there are a number of DBM libraries in existence, and
2272 different operating systems often have different ones installed.
2273 </para>
2274 <para>
2275 <indexterm role="concept">
2276 <primary>Solaris</primary>
2277 <secondary>DBM library for</secondary>
2278 </indexterm>
2279 <indexterm role="concept">
2280 <primary>IRIX, DBM library for</primary>
2281 </indexterm>
2282 <indexterm role="concept">
2283 <primary>BSD, DBM library for</primary>
2284 </indexterm>
2285 <indexterm role="concept">
2286 <primary>Linux, DBM library for</primary>
2287 </indexterm>
2288 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2289 Linux distribution, the DBM configuration should happen automatically, and you
2290 may be able to ignore this section. Otherwise, you may have to learn more than
2291 you would like about DBM libraries from what follows.
2292 </para>
2293 <para>
2294 <indexterm role="concept">
2295 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2296 </indexterm>
2297 Licensed versions of Unix normally contain a library of DBM functions operating
2298 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2299 versions of Unix seem to vary in what they contain as standard. In particular,
2300 some early versions of Linux have no default DBM library, and different
2301 distributors have chosen to bundle different libraries with their packaged
2302 versions. However, the more recent releases seem to have standardized on the
2303 Berkeley DB library.
2304 </para>
2305 <para>
2306 Different DBM libraries have different conventions for naming the files they
2307 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2308 possibilities:
2309 </para>
2310 <orderedlist numeration="arabic">
2311 <listitem>
2312 <para>
2313 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2314 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2315 </para>
2316 </listitem>
2317 <listitem>
2318 <para>
2319 <indexterm role="concept">
2320 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2321 </indexterm>
2322 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2323 compatibility interface it makes two different hard links to it with names
2324 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2325 file name is used unmodified.
2326 </para>
2327 </listitem>
2328 <listitem>
2329 <para>
2330 <indexterm role="concept">
2331 <primary>Berkeley DB library</primary>
2332 </indexterm>
2333 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2334 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2335 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2336 </para>
2337 </listitem>
2338 <listitem>
2339 <para>
2340 If the Berkeley package is used in its native mode, it operates on a single
2341 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2342 the traditional <emphasis>ndbm</emphasis> interface.
2343 </para>
2344 </listitem>
2345 <listitem>
2346 <para>
2347 To complicate things further, there are several very different versions of the
2348 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2349 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2350 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2351 versions of Berkeley DB can be obtained from
2352 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2353 </para>
2354 </listitem>
2355 <listitem>
2356 <para>
2357 <indexterm role="concept">
2358 <primary><emphasis>tdb</emphasis> DBM library</primary>
2359 </indexterm>
2360 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2361 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2362 operates on a single file.
2363 </para>
2364 </listitem>
2365 </orderedlist>
2366 <para>
2367 <indexterm role="concept">
2368 <primary>USE_DB</primary>
2369 </indexterm>
2370 <indexterm role="concept">
2371 <primary>DBM libraries</primary>
2372 <secondary>configuration for building</secondary>
2373 </indexterm>
2374 Exim and its utilities can be compiled to use any of these interfaces. In order
2375 to use any version of the Berkeley DB package in native mode, you must set
2376 USE_DB in an appropriate configuration file (typically
2377 <filename>Local/Makefile</filename>). For example:
2378 </para>
2379 <literallayout class="monospaced">
2380 USE_DB=yes
2381 </literallayout>
2382 <para>
2383 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2384 error is diagnosed if you set more than one of these.
2385 </para>
2386 <para>
2387 At the lowest level, the build-time configuration sets none of these options,
2388 thereby assuming an interface of type (1). However, some operating system
2389 configuration files (for example, those for the BSD operating systems and
2390 Linux) assume type (4) by setting USE_DB as their default, and the
2391 configuration files for Cygwin set USE_GDBM. Anything you set in
2392 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2393 </para>
2394 <para>
2395 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2396 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2397 in one of these lines:
2398 </para>
2399 <literallayout class="monospaced">
2400 DBMLIB = -ldb
2401 DBMLIB = -ltdb
2402 </literallayout>
2403 <para>
2404 Settings like that will work if the DBM library is installed in the standard
2405 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2406 the default path. You may need to set INCLUDE to specify where the header
2407 file is, and to specify the path to the library more fully in DBMLIB, as in
2408 this example:
2409 </para>
2410 <literallayout class="monospaced">
2411 INCLUDE=-I/usr/local/include/db-4.1
2412 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2413 </literallayout>
2414 <para>
2415 There is further detailed discussion about the various DBM libraries in the
2416 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2417 </para>
2418 </section>
2419 <section id="SECID25">
2420 <title>Pre-building configuration</title>
2421 <para>
2422 <indexterm role="concept">
2423 <primary>building Exim</primary>
2424 <secondary>pre-building configuration</secondary>
2425 </indexterm>
2426 <indexterm role="concept">
2427 <primary>configuration for building Exim</primary>
2428 </indexterm>
2429 <indexterm role="concept">
2430 <primary><filename>Local/Makefile</filename></primary>
2431 </indexterm>
2432 <indexterm role="concept">
2433 <primary><filename>src/EDITME</filename></primary>
2434 </indexterm>
2435 Before building Exim, a local configuration file that specifies options
2436 independent of any operating system has to be created with the name
2437 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2438 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2439 therein. These descriptions are therefore not repeated here. If you are
2440 building Exim for the first time, the simplest thing to do is to copy
2441 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2442 </para>
2443 <para>
2444 There are three settings that you must supply, because Exim will not build
2445 without them. They are the location of the run time configuration file
2446 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2447 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2448 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2449 a colon-separated list of file names; Exim uses the first of them that exists.
2450 </para>
2451 <para>
2452 There are a few other parameters that can be specified either at build time or
2453 at run time, to enable the same binary to be used on a number of different
2454 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2455 directory (if not within the spool directory) are fixed, it is recommended that
2456 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2457 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2458 be logged.
2459 </para>
2460 <para>
2461 <indexterm role="concept">
2462 <primary>content scanning</primary>
2463 <secondary>specifying at build time</secondary>
2464 </indexterm>
2465 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2466 access control lists are not compiled by default. If you want to include these
2467 facilities, you need to set
2468 </para>
2469 <literallayout class="monospaced">
2470 WITH_CONTENT_SCAN=yes
2471 </literallayout>
2472 <para>
2473 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2474 chapter <xref linkend="CHAPexiscan"/>.
2475 </para>
2476 <para>
2477 <indexterm role="concept">
2478 <primary><filename>Local/eximon.conf</filename></primary>
2479 </indexterm>
2480 <indexterm role="concept">
2481 <primary><filename>exim_monitor/EDITME</filename></primary>
2482 </indexterm>
2483 If you are going to build the Exim monitor, a similar configuration process is
2484 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2485 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2486 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2487 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2488 </para>
2489 <para>
2490 This is all the configuration that is needed in straightforward cases for known
2491 operating systems. However, the building process is set up so that it is easy
2492 to override options that are set by default or by operating-system-specific
2493 configuration files, for example to change the name of the C compiler, which
2494 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2495 do this.
2496 </para>
2497 </section>
2498 <section id="SECID26">
2499 <title>Support for iconv()</title>
2500 <para>
2501 <indexterm role="concept">
2502 <primary><function>iconv()</function> support</primary>
2503 </indexterm>
2504 <indexterm role="concept">
2505 <primary>RFC 2047</primary>
2506 </indexterm>
2507 The contents of header lines in messages may be encoded according to the rules
2508 described RFC 2047. This makes it possible to transmit characters that are not
2509 in the ASCII character set, and to label them as being in a particular
2510 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2511 mechanism, it decodes them, and translates them into a specified character set
2512 (default is set at build time). The translation is possible only if the operating system
2513 supports the <function>iconv()</function> function.
2514 </para>
2515 <para>
2516 However, some of the operating systems that supply <function>iconv()</function> do not support
2517 very many conversions. The GNU <option>libiconv</option> library (available from
2518 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2519 systems to remedy this deficiency, as well as on systems that do not supply
2520 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2521 </para>
2522 <literallayout class="monospaced">
2523 HAVE_ICONV=yes
2524 </literallayout>
2525 <para>
2526 to your <filename>Local/Makefile</filename> and rebuild Exim.
2527 </para>
2528 </section>
2529 <section id="SECTinctlsssl">
2530 <title>Including TLS/SSL encryption support</title>
2531 <para>
2532 <indexterm role="concept">
2533 <primary>TLS</primary>
2534 <secondary>including support for TLS</secondary>
2535 </indexterm>
2536 <indexterm role="concept">
2537 <primary>encryption</primary>
2538 <secondary>including support for</secondary>
2539 </indexterm>
2540 <indexterm role="concept">
2541 <primary>SUPPORT_TLS</primary>
2542 </indexterm>
2543 <indexterm role="concept">
2544 <primary>OpenSSL</primary>
2545 <secondary>building Exim with</secondary>
2546 </indexterm>
2547 <indexterm role="concept">
2548 <primary>GnuTLS</primary>
2549 <secondary>building Exim with</secondary>
2550 </indexterm>
2551 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2552 command as per RFC 2487. It can also support legacy clients that expect to
2553 start a TLS session immediately on connection to a non-standard port (see the
2554 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2555 line option).
2556 </para>
2557 <para>
2558 If you want to build Exim with TLS support, you must first install either the
2559 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2560 implementing SSL.
2561 </para>
2562 <para>
2563 If OpenSSL is installed, you should set
2564 </para>
2565 <literallayout class="monospaced">
2566 SUPPORT_TLS=yes
2567 TLS_LIBS=-lssl -lcrypto
2568 </literallayout>
2569 <para>
2570 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2571 OpenSSL library and include files. For example:
2572 </para>
2573 <literallayout class="monospaced">
2574 SUPPORT_TLS=yes
2575 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2576 TLS_INCLUDE=-I/usr/local/openssl/include/
2577 </literallayout>
2578 <para>
2579 <indexterm role="concept">
2580 <primary>pkg-config</primary>
2581 <secondary>OpenSSL</secondary>
2582 </indexterm>
2583 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2584 </para>
2585 <literallayout class="monospaced">
2586 SUPPORT_TLS=yes
2587 USE_OPENSSL_PC=openssl
2588 </literallayout>
2589 <para>
2590 <indexterm role="concept">
2591 <primary>USE_GNUTLS</primary>
2592 </indexterm>
2593 If GnuTLS is installed, you should set
2594 </para>
2595 <literallayout class="monospaced">
2596 SUPPORT_TLS=yes
2597 USE_GNUTLS=yes
2598 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2599 </literallayout>
2600 <para>
2601 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2602 library and include files. For example:
2603 </para>
2604 <literallayout class="monospaced">
2605 SUPPORT_TLS=yes
2606 USE_GNUTLS=yes
2607 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2608 TLS_INCLUDE=-I/usr/gnu/include
2609 </literallayout>
2610 <para>
2611 <indexterm role="concept">
2612 <primary>pkg-config</primary>
2613 <secondary>GnuTLS</secondary>
2614 </indexterm>
2615 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2616 </para>
2617 <literallayout class="monospaced">
2618 SUPPORT_TLS=yes
2619 USE_GNUTLS=yes
2620 USE_GNUTLS_PC=gnutls
2621 </literallayout>
2622 <para>
2623 You do not need to set TLS_INCLUDE if the relevant directory is already
2624 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2625 given in chapter <xref linkend="CHAPTLS"/>.
2626 </para>
2627 </section>
2628 <section id="SECID27">
2629 <title>Use of tcpwrappers</title>
2630 <para>
2631 <indexterm role="concept">
2632 <primary>tcpwrappers, building Exim to support</primary>
2633 </indexterm>
2634 <indexterm role="concept">
2635 <primary>USE_TCP_WRAPPERS</primary>
2636 </indexterm>
2637 <indexterm role="concept">
2638 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2639 </indexterm>
2640 <indexterm role="concept">
2641 <primary>tcp_wrappers_daemon_name</primary>
2642 </indexterm>
2643 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2644 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2645 alternative to Exim&#x2019;s own checking facilities for installations that are
2646 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2647 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2648 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2649 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2650 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2651 you might have
2652 </para>
2653 <literallayout class="monospaced">
2654 USE_TCP_WRAPPERS=yes
2655 CFLAGS=-O -I/usr/local/include
2656 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2657 </literallayout>
2658 <para>
2659 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2660 files is <quote>exim</quote>. For example, the line
2661 </para>
2662 <literallayout class="monospaced">
2663 exim : LOCAL  192.168.1.  .friendly.domain.example
2664 </literallayout>
2665 <para>
2666 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2667 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2668 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2669 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2670 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2671 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2672 further details.
2673 </para>
2674 </section>
2675 <section id="SECID28">
2676 <title>Including support for IPv6</title>
2677 <para>
2678 <indexterm role="concept">
2679 <primary>IPv6</primary>
2680 <secondary>including support for</secondary>
2681 </indexterm>
2682 Exim contains code for use on systems that have IPv6 support. Setting
2683 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2684 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2685 where the IPv6 support is not fully integrated into the normal include and
2686 library files.
2687 </para>
2688 <para>
2689 Two different types of DNS record for handling IPv6 addresses have been
2690 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2691 currently seen as the mainstream. Another record type called A6 was proposed
2692 as better than AAAA because it had more flexibility. However, it was felt to be
2693 over-complex, and its status was reduced to <quote>experimental</quote>.
2694 Exim used to
2695 have a compile option for including A6 record support but this has now been
2696 withdrawn.
2697 </para>
2698 </section>
2699 <section id="SECTdynamicmodules">
2700 <title>Dynamically loaded lookup module support</title>
2701 <para>
2702 <indexterm role="concept">
2703 <primary>lookup modules</primary>
2704 </indexterm>
2705 <indexterm role="concept">
2706 <primary>dynamic modules</primary>
2707 </indexterm>
2708 <indexterm role="concept">
2709 <primary>.so building</primary>
2710 </indexterm>
2711 On some platforms, Exim supports not compiling all lookup types directly into
2712 the main binary, instead putting some into external modules which can be loaded
2713 on demand.
2714 This permits packagers to build Exim with support for lookups with extensive
2715 library dependencies without requiring all users to install all of those
2716 dependencies.
2717 Most, but not all, lookup types can be built this way.
2718 </para>
2719 <para>
2720 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2721 installed; Exim will only load modules from that directory, as a security
2722 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2723 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2724 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2725 see <filename>src/EDITME</filename> for details.
2726 </para>
2727 <para>
2728 Then, for each module to be loaded dynamically, define the relevant
2729 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2730 For example, this will build in lsearch but load sqlite and mysql support
2731 on demand:
2732 </para>
2733 <literallayout class="monospaced">
2734 LOOKUP_LSEARCH=yes
2735 LOOKUP_SQLITE=2
2736 LOOKUP_MYSQL=2
2737 </literallayout>
2738 </section>
2739 <section id="SECID29">
2740 <title>The building process</title>
2741 <para>
2742 <indexterm role="concept">
2743 <primary>build directory</primary>
2744 </indexterm>
2745 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2746 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2747 operating system types, and creates a build directory if one does not exist.
2748 For example, on a Sun system running Solaris 8, the directory
2749 <filename>build-SunOS5-5.8-sparc</filename> is created.
2750 <indexterm role="concept">
2751 <primary>symbolic link</primary>
2752 <secondary>to source files</secondary>
2753 </indexterm>
2754 Symbolic links to relevant source files are installed in the build directory.
2755 </para>
2756 <para>
2757 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2758 a make file inside the build directory, using the configuration files from the
2759 <filename>Local</filename> directory. The new make file is then passed to another instance of
2760 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2761 then compiling and linking the binaries for the Exim monitor (if configured), a
2762 number of utility programs, and finally Exim itself. The command <literal>make
2763 makefile</literal> can be used to force a rebuild of the make file in the build
2764 directory, should this ever be necessary.
2765 </para>
2766 <para>
2767 If you have problems building Exim, check for any comments there may be in the
2768 <filename>README</filename> file concerning your operating system, and also take a look at the
2769 FAQ, where some common problems are covered.
2770 </para>
2771 </section>
2772 <section id="SECID283">
2773 <title>Output from <quote>make</quote></title>
2774 <para>
2775 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2776 unreadable, because these lines can be very long. For this reason, the normal
2777 output is suppressed by default, and instead output similar to that which
2778 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2779 each module that is being compiled or linked. However, it is still possible to
2780 get the full output, by calling <emphasis>make</emphasis> like this:
2781 </para>
2782 <literallayout class="monospaced">
2783 FULLECHO='' make -e
2784 </literallayout>
2785 <para>
2786 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2787 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2788 given in addition to the short output.
2789 </para>
2790 </section>
2791 <section id="SECToverride">
2792 <title>Overriding build-time options for Exim</title>
2793 <para>
2794 <indexterm role="concept">
2795 <primary>build-time options, overriding</primary>
2796 </indexterm>
2797 The main make file that is created at the beginning of the building process
2798 consists of the concatenation of a number of files which set configuration
2799 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2800 more than once, the last setting overrides any previous ones. This provides a
2801 convenient way of overriding defaults. The files that are concatenated are, in
2802 order:
2803 </para>
2804 <literallayout>
2805 <filename>OS/Makefile-Default</filename>
2806 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2807 <filename>Local/Makefile</filename>
2808 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2809 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2810 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2811 <filename>OS/Makefile-Base</filename>
2812 </literallayout>
2813 <para>
2814 <indexterm role="concept">
2815 <primary><filename>Local/Makefile</filename></primary>
2816 </indexterm>
2817 <indexterm role="concept">
2818 <primary>building Exim</primary>
2819 <secondary>operating system type</secondary>
2820 </indexterm>
2821 <indexterm role="concept">
2822 <primary>building Exim</primary>
2823 <secondary>architecture type</secondary>
2824 </indexterm>
2825 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2826 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2827 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2828 and are often not needed.
2829 </para>
2830 <para>
2831 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2832 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2833 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2834 values are used, thereby providing a means of forcing particular settings.
2835 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2836 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2837 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2838 that Exim expects. You can run these scripts directly from the shell in order
2839 to find out what values are being used on your system.
2840 </para>
2841 <para>
2842 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2843 therein. Some (but not all) are mentioned below. If there is something that
2844 needs changing, review the contents of this file and the contents of the make
2845 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2846 default values are.
2847 </para>
2848 <para>
2849 <indexterm role="concept">
2850 <primary>building Exim</primary>
2851 <secondary>overriding default settings</secondary>
2852 </indexterm>
2853 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2854 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2855 need to change the original files. Instead, you should make the changes by
2856 putting the new values in an appropriate <filename>Local</filename> file. For example,
2857 <indexterm role="concept">
2858 <primary>Tru64-Unix build-time settings</primary>
2859 </indexterm>
2860 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2861 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2862 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2863 called with the option <option>-std1</option>, to make it recognize some of the features of
2864 Standard C that Exim uses. (Most other compilers recognize Standard C by
2865 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2866 containing the lines
2867 </para>
2868 <literallayout class="monospaced">
2869 CC=cc
2870 CFLAGS=-std1
2871 </literallayout>
2872 <para>
2873 If you are compiling for just one operating system, it may be easier to put
2874 these lines directly into <filename>Local/Makefile</filename>.
2875 </para>
2876 <para>
2877 Keeping all your local configuration settings separate from the distributed
2878 files makes it easy to transfer them to new versions of Exim simply by copying
2879 the contents of the <filename>Local</filename> directory.
2880 </para>
2881 <para>
2882 <indexterm role="concept">
2883 <primary>NIS lookup type</primary>
2884 <secondary>including support for</secondary>
2885 </indexterm>
2886 <indexterm role="concept">
2887 <primary>NIS+ lookup type</primary>
2888 <secondary>including support for</secondary>
2889 </indexterm>
2890 <indexterm role="concept">
2891 <primary>LDAP</primary>
2892 <secondary>including support for</secondary>
2893 </indexterm>
2894 <indexterm role="concept">
2895 <primary>lookup</primary>
2896 <secondary>inclusion in binary</secondary>
2897 </indexterm>
2898 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2899 lookup, but not all systems have these components installed, so the default is
2900 not to include the relevant code in the binary. All the different kinds of file
2901 and database lookup that Exim supports are implemented as separate code modules
2902 which are included only if the relevant compile-time options are set. In the
2903 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2904 </para>
2905 <literallayout class="monospaced">
2906 LOOKUP_LDAP=yes
2907 LOOKUP_NIS=yes
2908 LOOKUP_NISPLUS=yes
2909 </literallayout>
2910 <para>
2911 and similar settings apply to the other lookup types. They are all listed in
2912 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2913 libraries need to be installed before compiling Exim.
2914 <indexterm role="concept">
2915 <primary>cdb</primary>
2916 <secondary>including support for</secondary>
2917 </indexterm>
2918 However, there are some optional lookup types (such as cdb) for which
2919 the code is entirely contained within Exim, and no external include
2920 files or libraries are required. When a lookup type is not included in the
2921 binary, attempts to configure Exim to use it cause run time configuration
2922 errors.
2923 </para>
2924 <para>
2925 <indexterm role="concept">
2926 <primary>pkg-config</primary>
2927 <secondary>lookups</secondary>
2928 </indexterm>
2929 <indexterm role="concept">
2930 <primary>pkg-config</primary>
2931 <secondary>authenticators</secondary>
2932 </indexterm>
2933 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2934 about how to compile against a library; Exim has some initial support for
2935 being able to use pkg-config for lookups and authenticators.  For any given
2936 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2937 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2938 name of the package to be queried.  The results of querying via the
2939 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2940 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2941 syntax.  For instance:
2942 </para>
2943 <literallayout class="monospaced">
2944 LOOKUP_SQLITE=yes
2945 LOOKUP_SQLITE_PC=sqlite3
2946 AUTH_GSASL=yes
2947 AUTH_GSASL_PC=libgsasl
2948 AUTH_HEIMDAL_GSSAPI=yes
2949 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2950 </literallayout>
2951 <para>
2952 <indexterm role="concept">
2953 <primary>Perl</primary>
2954 <secondary>including support for</secondary>
2955 </indexterm>
2956 Exim can be linked with an embedded Perl interpreter, allowing Perl
2957 subroutines to be called during string expansion. To enable this facility,
2958 </para>
2959 <literallayout class="monospaced">
2960 EXIM_PERL=perl.o
2961 </literallayout>
2962 <para>
2963 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2964 chapter <xref linkend="CHAPperl"/>.
2965 </para>
2966 <para>
2967 <indexterm role="concept">
2968 <primary>X11 libraries, location of</primary>
2969 </indexterm>
2970 The location of the X11 libraries is something that varies a lot between
2971 operating systems, and there may be different versions of X11 to cope
2972 with. Exim itself makes no use of X11, but if you are compiling the Exim
2973 monitor, the X11 libraries must be available.
2974 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2975 </para>
2976 <literallayout class="monospaced">
2977 X11=/usr/X11R6
2978 XINCLUDE=-I$(X11)/include
2979 XLFLAGS=-L$(X11)/lib
2980 </literallayout>
2981 <para>
2982 These are overridden in some of the operating-system configuration files. For
2983 example, in <filename>OS/Makefile-SunOS5</filename> there is
2984 </para>
2985 <literallayout class="monospaced">
2986 X11=/usr/openwin
2987 XINCLUDE=-I$(X11)/include
2988 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2989 </literallayout>
2990 <para>
2991 If you need to override the default setting for your operating system, place a
2992 definition of all three of these variables into your
2993 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2994 </para>
2995 <para>
2996 <indexterm role="concept">
2997 <primary>EXTRALIBS</primary>
2998 </indexterm>
2999 If you need to add any extra libraries to the link steps, these can be put in a
3000 variable called EXTRALIBS, which appears in all the link commands, but by
3001 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3002 command for linking the main Exim binary, and not for any associated utilities.
3003 </para>
3004 <para>
3005 <indexterm role="concept">
3006 <primary>DBM libraries</primary>
3007 <secondary>configuration for building</secondary>
3008 </indexterm>
3009 There is also DBMLIB, which appears in the link commands for binaries that
3010 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3011 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3012 binary, and which can be used, for example, to include additional X11
3013 libraries.
3014 </para>
3015 <para>
3016 <indexterm role="concept">
3017 <primary>configuration file</primary>
3018 <secondary>editing</secondary>
3019 </indexterm>
3020 The make file copes with rebuilding Exim correctly if any of the configuration
3021 files are edited. However, if an optional configuration file is deleted, it is
3022 necessary to touch the associated non-optional file (that is,
3023 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3024 </para>
3025 </section>
3026 <section id="SECID30">
3027 <title>OS-specific header files</title>
3028 <para>
3029 <indexterm role="concept">
3030 <primary><filename>os.h</filename></primary>
3031 </indexterm>
3032 <indexterm role="concept">
3033 <primary>building Exim</primary>
3034 <secondary>OS-specific C header files</secondary>
3035 </indexterm>
3036 The <filename>OS</filename> directory contains a number of files with names of the form
3037 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3038 normally need to be changed. There is a list of macro settings that are
3039 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3040 are porting Exim to a new operating system.
3041 </para>
3042 </section>
3043 <section id="SECID31">
3044 <title>Overriding build-time options for the monitor</title>
3045 <para>
3046 <indexterm role="concept">
3047 <primary>building Eximon</primary>
3048 </indexterm>
3049 A similar process is used for overriding things when building the Exim monitor,
3050 where the files that are involved are
3051 </para>
3052 <literallayout>
3053 <filename>OS/eximon.conf-Default</filename>
3054 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3055 <filename>Local/eximon.conf</filename>
3056 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3057 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3058 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3059 </literallayout>
3060 <para>
3061 <indexterm role="concept">
3062 <primary><filename>Local/eximon.conf</filename></primary>
3063 </indexterm>
3064 As with Exim itself, the final three files need not exist, and in this case the
3065 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3066 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3067 variables of the same name, preceded by EXIMON_. For example, setting
3068 EXIMON_LOG_DEPTH in the environment overrides the value of
3069 LOG_DEPTH at run time.
3070 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3071 </para>
3072 </section>
3073 <section id="SECID32">
3074 <title>Installing Exim binaries and scripts</title>
3075 <para>
3076 <indexterm role="concept">
3077 <primary>installing Exim</primary>
3078 </indexterm>
3079 <indexterm role="concept">
3080 <primary>BIN_DIRECTORY</primary>
3081 </indexterm>
3082 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3083 arguments. The script copies binaries and utility scripts into the directory
3084 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3085 <indexterm role="concept">
3086 <primary>setuid</primary>
3087 <secondary>installing Exim with</secondary>
3088 </indexterm>
3089 The install script copies files only if they are newer than the files they are
3090 going to replace. The Exim binary is required to be owned by root and have the
3091 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3092 install</literal> as root so that it can set up the Exim binary in this way. However, in
3093 some special situations (for example, if a host is doing no local deliveries)
3094 it may be possible to run Exim without making the binary setuid root (see
3095 chapter <xref linkend="CHAPsecurity"/> for details).
3096 </para>
3097 <para>
3098 <indexterm role="concept">
3099 <primary>CONFIGURE_FILE</primary>
3100 </indexterm>
3101 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
3102 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3103 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3104 by the installation script. If a run time configuration file already exists, it
3105 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3106 alternative files, no default is installed.
3107 </para>
3108 <para>
3109 <indexterm role="concept">
3110 <primary>system aliases file</primary>
3111 </indexterm>
3112 <indexterm role="concept">
3113 <primary><filename>/etc/aliases</filename></primary>
3114 </indexterm>
3115 One change is made to the default configuration file when it is installed: the
3116 default configuration contains a router that references a system aliases file.
3117 The path to this file is set to the value specified by
3118 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3119 If the system aliases file does not exist, the installation script creates it,
3120 and outputs a comment to the user.
3121 </para>
3122 <para>
3123 The created file contains no aliases, but it does contain comments about the
3124 aliases a site should normally have. Mail aliases have traditionally been
3125 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3126 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3127 Exim&#x2019;s configuration if necessary.
3128 </para>
3129 <para>
3130 The default configuration uses the local host&#x2019;s name as the only local domain,
3131 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3132 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3133 directories are supported, but no NIS or NIS+ support is configured. Domains
3134 other than the name of the local host are routed using the DNS, with delivery
3135 over SMTP.
3136 </para>
3137 <para>
3138 It is possible to install Exim for special purposes (such as building a binary
3139 distribution) in a private part of the file system. You can do this by a
3140 command such as
3141 </para>
3142 <literallayout class="monospaced">
3143 make DESTDIR=/some/directory/ install
3144 </literallayout>
3145 <para>
3146 This has the effect of pre-pending the specified directory to all the file
3147 paths, except the name of the system aliases file that appears in the default
3148 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3149 For backwards compatibility, ROOT is used if DESTDIR is not set,
3150 but this usage is deprecated.
3151 </para>
3152 <para>
3153 <indexterm role="concept">
3154 <primary>installing Exim</primary>
3155 <secondary>what is not installed</secondary>
3156 </indexterm>
3157 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3158 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3159 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3160 directory are copied, except for the info files when you have set
3161 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3162 </para>
3163 <para>
3164 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3165 to their names. The Exim binary itself, however, is handled differently. It is
3166 installed under a name that includes the version number and the compile number,
3167 for example <filename>exim-4.89.1-1</filename>. The script then arranges for a symbolic link
3168 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3169 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3170 from the directory (as seen by other processes).
3171 </para>
3172 <para>
3173 <indexterm role="concept">
3174 <primary>installing Exim</primary>
3175 <secondary>testing the script</secondary>
3176 </indexterm>
3177 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3178 real, you can pass the <option>-n</option> option to the installation script by this
3179 command:
3180 </para>
3181 <literallayout class="monospaced">
3182 make INSTALL_ARG=-n install
3183 </literallayout>
3184 <para>
3185 The contents of the variable INSTALL_ARG are passed to the installation
3186 script. You do not need to be root to run this test. Alternatively, you can run
3187 the installation script directly, but this must be from within the build
3188 directory. For example, from the top-level Exim directory you could use this
3189 command:
3190 </para>
3191 <literallayout class="monospaced">
3192 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3193 </literallayout>
3194 <para>
3195 <indexterm role="concept">
3196 <primary>installing Exim</primary>
3197 <secondary>install script options</secondary>
3198 </indexterm>
3199 There are two other options that can be supplied to the installation script.
3200 </para>
3201 <itemizedlist>
3202 <listitem>
3203 <para>
3204 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3205 to root, and the call to make it a setuid binary.
3206 </para>
3207 </listitem>
3208 <listitem>
3209 <para>
3210 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3211 installed binary.
3212 </para>
3213 </listitem>
3214 </itemizedlist>
3215 <para>
3216 INSTALL_ARG can be used to pass these options to the script. For example:
3217 </para>
3218 <literallayout class="monospaced">
3219 make INSTALL_ARG=-no_symlink install
3220 </literallayout>
3221 <para>
3222 The installation script can also be given arguments specifying which files are
3223 to be copied. For example, to install just the Exim binary, and nothing else,
3224 without creating the symbolic link, you could use:
3225 </para>
3226 <literallayout class="monospaced">
3227 make INSTALL_ARG='-no_symlink exim' install
3228 </literallayout>
3229 </section>
3230 <section id="SECTinsinfdoc">
3231 <title>Installing info documentation</title>
3232 <para>
3233 <indexterm role="concept">
3234 <primary>installing Exim</primary>
3235 <secondary><emphasis>info</emphasis> documentation</secondary>
3236 </indexterm>
3237 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3238 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3239 distribution. Instead it is available separately from the ftp site (see section
3240 <xref linkend="SECTavail"/>).
3241 </para>
3242 <para>
3243 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3244 source of the documentation is found in the source tree, running <literal>make
3245 install</literal> automatically builds the info files and installs them.
3246 </para>
3247 </section>
3248 <section id="SECID33">
3249 <title>Setting up the spool directory</title>
3250 <para>
3251 <indexterm role="concept">
3252 <primary>spool directory</primary>
3253 <secondary>creating</secondary>
3254 </indexterm>
3255 When it starts up, Exim tries to create its spool directory if it does not
3256 exist. The Exim uid and gid are used for the owner and group of the spool
3257 directory. Sub-directories are automatically created in the spool directory as
3258 necessary.
3259 </para>
3260 </section>
3261 <section id="SECID34">
3262 <title>Testing</title>
3263 <para>
3264 <indexterm role="concept">
3265 <primary>testing</primary>
3266 <secondary>installation</secondary>
3267 </indexterm>
3268 Having installed Exim, you can check that the run time configuration file is
3269 syntactically valid by running the following command, which assumes that the
3270 Exim binary directory is within your PATH environment variable:
3271 </para>
3272 <literallayout class="monospaced">
3273 exim -bV
3274 </literallayout>
3275 <para>
3276 If there are any errors in the configuration file, Exim outputs error messages.
3277 Otherwise it outputs the version number and build date,
3278 the DBM library that is being used, and information about which drivers and
3279 other optional code modules are included in the binary.
3280 Some simple routing tests can be done by using the address testing option. For
3281 example,
3282 </para>
3283 <literallayout>
3284 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3285 </literallayout>
3286 <para>
3287 should verify that it recognizes a local mailbox, and
3288 </para>
3289 <literallayout>
3290 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3291 </literallayout>
3292 <para>
3293 a remote one. Then try getting it to deliver mail, both locally and remotely.
3294 This can be done by passing messages directly to Exim, without going through a
3295 user agent. For example:
3296 </para>
3297 <literallayout class="monospaced">
3298 exim -v postmaster@your.domain.example
3299 From: user@your.domain.example
3300 To: postmaster@your.domain.example
3301 Subject: Testing Exim
3302
3303 This is a test message.
3304 ^D
3305 </literallayout>
3306 <para>
3307 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3308 In this case you should see copies of three log lines, one for the message&#x2019;s
3309 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3310 </para>
3311 <para>
3312 <indexterm role="concept">
3313 <primary>delivery</primary>
3314 <secondary>problems with</secondary>
3315 </indexterm>
3316 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3317 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3318 of information is running Exim with debugging turned on, by specifying the
3319 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3320 with debugging turned on by a command of the form
3321 </para>
3322 <literallayout>
3323 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3324 </literallayout>
3325 <para>
3326 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3327 produces rather a lot of output, but you can cut this down to specific areas.
3328 For example, if you use <option>-d-all+route</option> only the debugging information
3329 relevant to routing is included. (See the <option>-d</option> option in chapter
3330 <xref linkend="CHAPcommandline"/> for more details.)
3331 </para>
3332 <para>
3333 <indexterm role="concept">
3334 <primary><quote>sticky</quote> bit</primary>
3335 </indexterm>
3336 <indexterm role="concept">
3337 <primary>lock files</primary>
3338 </indexterm>
3339 One specific problem that has shown up on some sites is the inability to do
3340 local deliveries into a shared mailbox directory, because it does not have the
3341 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3342 writing to a mailbox file, and if it cannot create the lock file, the delivery
3343 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3344 directory, or by setting a specific group for local deliveries and allowing
3345 that group to create files in the directory (see the comments above the
3346 <command>local_delivery</command> transport in the default configuration file). Another
3347 approach is to configure Exim not to use lock files, but just to rely on
3348 <function>fcntl()</function> locking instead. However, you should do this only if all user
3349 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3350 see chapter <xref linkend="CHAPappendfile"/>.
3351 </para>
3352 <para>
3353 One thing that cannot be tested on a system that is already running an MTA is
3354 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3355 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3356 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3357 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3358 incoming SMTP mail.
3359 </para>
3360 <para>
3361 Testing a new version on a system that is already running Exim can most easily
3362 be done by building a binary with a different CONFIGURE_FILE setting. From
3363 within the run time configuration, all other file and directory names
3364 that Exim uses can be altered, in order to keep it entirely clear of the
3365 production version.
3366 </para>
3367 </section>
3368 <section id="SECID35">
3369 <title>Replacing another MTA with Exim</title>
3370 <para>
3371 <indexterm role="concept">
3372 <primary>replacing another MTA</primary>
3373 </indexterm>
3374 Building and installing Exim for the first time does not of itself put it in
3375 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3376 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3377 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3378 binary in order to get the user agents to pass messages to Exim. This is
3379 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3380 or <filename>/usr/lib/sendmail</filename>
3381 <indexterm role="concept">
3382 <primary>symbolic link</primary>
3383 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3384 </indexterm>
3385 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3386 privilege and executable status from the old MTA. It is then necessary to stop
3387 and restart the mailer daemon, if one is running.
3388 </para>
3389 <para>
3390 <indexterm role="concept">
3391 <primary>FreeBSD, MTA indirection</primary>
3392 </indexterm>
3393 <indexterm role="concept">
3394 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3395 </indexterm>
3396 Some operating systems have introduced alternative ways of switching MTAs. For
3397 example, if you are running FreeBSD, you need to edit the file
3398 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3399 described. A typical example of the contents of this file for running Exim is
3400 as follows:
3401 </para>
3402 <literallayout class="monospaced">
3403 sendmail            /usr/exim/bin/exim
3404 send-mail           /usr/exim/bin/exim
3405 mailq               /usr/exim/bin/exim -bp
3406 newaliases          /usr/bin/true
3407 </literallayout>
3408 <para>
3409 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3410 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3411 favourite user agent.
3412 </para>
3413 <para>
3414 You should consider what to tell your users about the change of MTA. Exim may
3415 have different capabilities to what was previously running, and there are
3416 various operational differences such as the text of messages produced by
3417 command line options and in bounce messages. If you allow your users to make
3418 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3419 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3420 </para>
3421 </section>
3422 <section id="SECID36">
3423 <title>Upgrading Exim</title>
3424 <para>
3425 <indexterm role="concept">
3426 <primary>upgrading Exim</primary>
3427 </indexterm>
3428 If you are already running Exim on your host, building and installing a new
3429 version automatically makes it available to MUAs, or any other programs that
3430 call the MTA directly. However, if you are running an Exim daemon, you do need
3431 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3432 new binary. You do not need to stop processing mail in order to install a new
3433 version of Exim. The install script does not modify an existing runtime
3434 configuration file.
3435 </para>
3436 </section>
3437 <section id="SECID37">
3438 <title>Stopping the Exim daemon on Solaris</title>
3439 <para>
3440 <indexterm role="concept">
3441 <primary>Solaris</primary>
3442 <secondary>stopping Exim on</secondary>
3443 </indexterm>
3444 The standard command for stopping the mailer daemon on Solaris is
3445 </para>
3446 <literallayout class="monospaced">
3447 /etc/init.d/sendmail stop
3448 </literallayout>
3449 <para>
3450 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3451 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3452 for the text <quote>sendmail</quote>; this is not present because the actual program name
3453 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3454 solution is to replace the line that finds the process id with something like
3455 </para>
3456 <literallayout class="monospaced">
3457 pid=`cat /var/spool/exim/exim-daemon.pid`
3458 </literallayout>
3459 <para>
3460 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3461 </para>
3462 <para>
3463 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3464 still be received from local processes, and if automatic delivery is configured
3465 (the normal case), deliveries will still occur.
3466 </para>
3467 </section>
3468 </chapter>
3469
3470 <chapter id="CHAPcommandline">
3471 <title>The Exim command line</title>
3472 <para>
3473 <indexterm role="concept" id="IIDclo1" class="startofrange">
3474 <primary>command line</primary>
3475 <secondary>options</secondary>
3476 </indexterm>
3477 <indexterm role="concept" id="IIDclo2" class="startofrange">
3478 <primary>options</primary>
3479 <secondary>command line</secondary>
3480 </indexterm>
3481 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3482 each starting with a hyphen character, followed by a number of arguments. The
3483 options are compatible with the main options of Sendmail, and there are also
3484 some additional options, some of which are compatible with Smail 3. Certain
3485 combinations of options do not make sense, and provoke an error if used.
3486 The form of the arguments depends on which options are set.
3487 </para>
3488 <section id="SECID38">
3489 <title>Setting options by program name</title>
3490 <para>
3491 <indexterm role="concept">
3492 <primary><emphasis>mailq</emphasis></primary>
3493 </indexterm>
3494 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3495 were present before any other options.
3496 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3497 standard output.
3498 This feature is for compatibility with some systems that contain a command of
3499 that name in one of the standard libraries, symbolically linked to
3500 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3501 </para>
3502 <para>
3503 <indexterm role="concept">
3504 <primary><emphasis>rsmtp</emphasis></primary>
3505 </indexterm>
3506 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3507 were present before any other options, for compatibility with Smail. The
3508 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3509 format.
3510 </para>
3511 <para>
3512 <indexterm role="concept">
3513 <primary><emphasis>rmail</emphasis></primary>
3514 </indexterm>
3515 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3516 <option>-oee</option> options were present before any other options, for compatibility with
3517 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3518 </para>
3519 <para>
3520 <indexterm role="concept">
3521 <primary><emphasis>runq</emphasis></primary>
3522 </indexterm>
3523 <indexterm role="concept">
3524 <primary>queue runner</primary>
3525 </indexterm>
3526 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3527 were present before any other options, for compatibility with Smail. The <option>-q</option>
3528 option causes a single queue runner process to be started.
3529 </para>
3530 <para>
3531 <indexterm role="concept">
3532 <primary><emphasis>newaliases</emphasis></primary>
3533 </indexterm>
3534 <indexterm role="concept">
3535 <primary>alias file</primary>
3536 <secondary>building</secondary>
3537 </indexterm>
3538 <indexterm role="concept">
3539 <primary>Sendmail compatibility</primary>
3540 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3541 </indexterm>
3542 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3543 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3544 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3545 the concept of a single alias file, but can be configured to run a given
3546 command if called with the <option>-bi</option> option.
3547 </para>
3548 </section>
3549 <section id="SECTtrustedadmin">
3550 <title>Trusted and admin users</title>
3551 <para>
3552 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3553 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3554 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3555 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3556 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3557 </para>
3558 <itemizedlist>
3559 <listitem>
3560 <para>
3561 <indexterm role="concept">
3562 <primary>trusted users</primary>
3563 <secondary>definition of</secondary>
3564 </indexterm>
3565 <indexterm role="concept">
3566 <primary>user</primary>
3567 <secondary>trusted definition of</secondary>
3568 </indexterm>
3569 The trusted users are root, the Exim user, any user listed in the
3570 <option>trusted_users</option> configuration option, and any user whose current group or any
3571 supplementary group is one of those listed in the <option>trusted_groups</option>
3572 configuration option. Note that the Exim group is not automatically trusted.
3573 </para>
3574 <para>
3575 <indexterm role="concept">
3576 <primary><quote>From</quote> line</primary>
3577 </indexterm>
3578 <indexterm role="concept">
3579 <primary>envelope sender</primary>
3580 </indexterm>
3581 Trusted users are always permitted to use the <option>-f</option> option or a leading
3582 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3583 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3584 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3585 users to set envelope senders.
3586 </para>
3587 <para>
3588 <indexterm role="concept">
3589 <primary><emphasis>From:</emphasis> header line</primary>
3590 </indexterm>
3591 <indexterm role="concept">
3592 <primary><emphasis>Sender:</emphasis> header line</primary>
3593 </indexterm>
3594 <indexterm role="concept">
3595 <primary>header lines</primary>
3596 <secondary>From:</secondary>
3597 </indexterm>
3598 <indexterm role="concept">
3599 <primary>header lines</primary>
3600 <secondary>Sender:</secondary>
3601 </indexterm>
3602 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3603 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3604 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3605 </para>
3606 <para>
3607 Trusted users may also specify a host name, host address, interface address,
3608 protocol name, ident value, and authentication data when submitting a message
3609 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3610 have the characteristics of messages received from a remote host. Untrusted
3611 users may in some circumstances use <option>-f</option>, but can never set the other values
3612 that are available to trusted users.
3613 </para>
3614 </listitem>
3615 <listitem>
3616 <para>
3617 <indexterm role="concept">
3618 <primary>user</primary>
3619 <secondary>admin definition of</secondary>
3620 </indexterm>
3621 <indexterm role="concept">
3622 <primary>admin user</primary>
3623 <secondary>definition of</secondary>
3624 </indexterm>
3625 The admin users are root, the Exim user, and any user that is a member of the
3626 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3627 The current group does not have to be one of these groups.
3628 </para>
3629 <para>
3630 Admin users are permitted to list the queue, and to carry out certain
3631 operations on messages, for example, to force delivery failures. It is also
3632 necessary to be an admin user in order to see the full information provided by
3633 the Exim monitor, and full debugging output.
3634 </para>
3635 <para>
3636 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3637 Exim to attempt delivery of messages on its queue is restricted to admin users.
3638 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3639 option false (that is, specifying <option>no_prod_requires_admin</option>).
3640 </para>
3641 <para>
3642 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3643 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3644 false.
3645 </para>
3646 </listitem>
3647 </itemizedlist>
3648 <para>
3649 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3650 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3651 getting root. There is further discussion of this issue at the start of chapter
3652 <xref linkend="CHAPconf"/>.
3653 </para>
3654 </section>
3655 <section id="SECID39">
3656 <title>Command line options</title>
3657 <para>
3658 Exim&#x2019;s command line options are described in alphabetical order below. If none
3659 of the options that specifies a specific action (such as starting the daemon or
3660 a queue runner, or testing an address, or receiving a message in a specific
3661 format, or listing the queue) are present, and there is at least one argument
3662 on the command line, <option>-bm</option> (accept a local message on the standard input,
3663 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3664 outputs a brief message about itself and exits.
3665 </para>
3666 <!-- === Start of command line options === -->
3667 <variablelist>
3668 <varlistentry>
3669 <term><option>--</option></term>
3670 <listitem>
3671 <para>
3672 <indexterm role="option">
3673 <primary>--</primary>
3674 </indexterm>
3675 <indexterm role="concept">
3676 <primary>options</primary>
3677 <secondary>command line; terminating</secondary>
3678 </indexterm>
3679 This is a pseudo-option whose only purpose is to terminate the options and
3680 therefore to cause subsequent command line items to be treated as arguments
3681 rather than options, even if they begin with hyphens.
3682 </para>
3683 </listitem></varlistentry>
3684 <varlistentry>
3685 <term><option>--help</option></term>
3686 <listitem>
3687 <para>
3688 <indexterm role="option">
3689 <primary><option>--help</option></primary>
3690 </indexterm>
3691 This option causes Exim to output a few sentences stating what it is.
3692 The same output is generated if the Exim binary is called with no options and
3693 no arguments.
3694 </para>
3695 </listitem></varlistentry>
3696 <varlistentry>
3697 <term><option>--version</option></term>
3698 <listitem>
3699 <para>
3700 <indexterm role="option">
3701 <primary><option>--version</option></primary>
3702 </indexterm>
3703 This option is an alias for <option>-bV</option> and causes version information to be
3704 displayed.
3705 </para>
3706 </listitem></varlistentry>
3707 <varlistentry>
3708 <term><option>-Ac</option></term>
3709 <term><option>-Am</option></term>
3710 <listitem>
3711 <para>
3712 <indexterm role="option">
3713 <primary><option>-Ac</option></primary>
3714 </indexterm>
3715 <indexterm role="option">
3716 <primary><option>-Am</option></primary>
3717 </indexterm>
3718 These options are used by Sendmail for selecting configuration files and are
3719 ignored by Exim.
3720 </para>
3721 </listitem></varlistentry>
3722 <varlistentry>
3723 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3724 <listitem>
3725 <para>
3726 <indexterm role="option">
3727 <primary><option>-B</option></primary>
3728 </indexterm>
3729 <indexterm role="concept">
3730 <primary>8-bit characters</primary>
3731 </indexterm>
3732 <indexterm role="concept">
3733 <primary>Sendmail compatibility</primary>
3734 <secondary>8-bit characters</secondary>
3735 </indexterm>
3736 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3737 clean; it ignores this option.
3738 </para>
3739 </listitem></varlistentry>
3740 <varlistentry>
3741 <term><option>-bd</option></term>
3742 <listitem>
3743 <para>
3744 <indexterm role="option">
3745 <primary><option>-bd</option></primary>
3746 </indexterm>
3747 <indexterm role="concept">
3748 <primary>daemon</primary>
3749 </indexterm>
3750 <indexterm role="concept">
3751 <primary>SMTP</primary>
3752 <secondary>listener</secondary>
3753 </indexterm>
3754 <indexterm role="concept">
3755 <primary>queue runner</primary>
3756 </indexterm>
3757 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3758 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3759 that the daemon should also initiate periodic queue runs.
3760 </para>
3761 <para>
3762 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3763 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3764 disconnect from the controlling terminal. When running this way, it can be
3765 stopped by pressing ctrl-C.
3766 </para>
3767 <para>
3768 By default, Exim listens for incoming connections to the standard SMTP port on
3769 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3770 ports, on multiple ports, and only on specific interfaces. Chapter
3771 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3772 </para>
3773 <para>
3774 When a listening daemon
3775 <indexterm role="concept">
3776 <primary>daemon</primary>
3777 <secondary>process id (pid)</secondary>
3778 </indexterm>
3779 <indexterm role="concept">
3780 <primary>pid (process id)</primary>
3781 <secondary>of daemon</secondary>
3782 </indexterm>
3783 is started without the use of <option>-oX</option> (that is, without overriding the normal
3784 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3785 in Exim&#x2019;s spool directory. This location can be overridden by setting
3786 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3787 running as root.
3788 </para>
3789 <para>
3790 When <option>-oX</option> is used on the command line to start a listening daemon, the
3791 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3792 used to specify a path on the command line if a pid file is required.
3793 </para>
3794 <para>
3795 The SIGHUP signal
3796 <indexterm role="concept">
3797 <primary>SIGHUP</primary>
3798 </indexterm>
3799 <indexterm role="concept">
3800 <primary>daemon</primary>
3801 <secondary>restarting</secondary>
3802 </indexterm>
3803 can be used to cause the daemon to re-execute itself. This should be done
3804 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3805 means of the <option>.include</option> facility, is changed, and also whenever a new version
3806 of Exim is installed. It is not necessary to do this when other files that are
3807 referenced from the configuration (for example, alias files) are changed,
3808 because these are reread each time they are used.
3809 </para>
3810 </listitem></varlistentry>
3811 <varlistentry>
3812 <term><option>-bdf</option></term>
3813 <listitem>
3814 <para>
3815 <indexterm role="option">
3816 <primary><option>-bdf</option></primary>
3817 </indexterm>
3818 This option has the same effect as <option>-bd</option> except that it never disconnects
3819 from the controlling terminal, even when no debugging is specified.
3820 </para>
3821 </listitem></varlistentry>
3822 <varlistentry>
3823 <term><option>-be</option></term>
3824 <listitem>
3825 <para>
3826 <indexterm role="option">
3827 <primary><option>-be</option></primary>
3828 </indexterm>
3829 <indexterm role="concept">
3830 <primary>testing</primary>
3831 <secondary>string expansion</secondary>
3832 </indexterm>
3833 <indexterm role="concept">
3834 <primary>expansion</primary>
3835 <secondary>testing</secondary>
3836 </indexterm>
3837 Run Exim in expansion testing mode. Exim discards its root privilege, to
3838 prevent ordinary users from using this mode to read otherwise inaccessible
3839 files. If no arguments are given, Exim runs interactively, prompting for lines
3840 of data. Otherwise, it processes each argument in turn.
3841 </para>
3842 <para>
3843 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3844 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3845 used without command line arguments. If successful, it uses the <function>readline()</function>
3846 function, which provides extensive line-editing facilities, for reading the
3847 test data. A line history is supported.
3848 </para>
3849 <para>
3850 Long expansion expressions can be split over several lines by using backslash
3851 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3852 continuation lines is ignored. Each argument or data line is passed through the
3853 string expansion mechanism, and the result is output. Variable values from the
3854 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3855 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
3856 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3857 </para>
3858 <para>
3859 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3860 files or databases you are using, you must exit and restart Exim before trying
3861 the same lookup again. Otherwise, because each Exim process caches the results
3862 of lookups, you will just get the same result as before.
3863 </para>
3864 </listitem></varlistentry>
3865 <varlistentry>
3866 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3867 <listitem>
3868 <para>
3869 <indexterm role="option">
3870 <primary><option>-bem</option></primary>
3871 </indexterm>
3872 <indexterm role="concept">
3873 <primary>testing</primary>
3874 <secondary>string expansion</secondary>
3875 </indexterm>
3876 <indexterm role="concept">
3877 <primary>expansion</primary>
3878 <secondary>testing</secondary>
3879 </indexterm>
3880 This option operates like <option>-be</option> except that it must be followed by the name
3881 of a file. For example:
3882 </para>
3883 <literallayout class="monospaced">
3884 exim -bem /tmp/testmessage
3885 </literallayout>
3886 <para>
3887 The file is read as a message (as if receiving a locally-submitted non-SMTP
3888 message) before any of the test expansions are done. Thus, message-specific
3889 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3890 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3891 recipients are read from the headers in the normal way, and are shown in the
3892 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3893 line, because further arguments are taken as strings to expand (just like
3894 <option>-be</option>).
3895 </para>
3896 </listitem></varlistentry>
3897 <varlistentry>
3898 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3899 <listitem>
3900 <para>
3901 <indexterm role="option">
3902 <primary><option>-bF</option></primary>
3903 </indexterm>
3904 <indexterm role="concept">
3905 <primary>system filter</primary>
3906 <secondary>testing</secondary>
3907 </indexterm>
3908 <indexterm role="concept">
3909 <primary>testing</primary>
3910 <secondary>system filter</secondary>
3911 </indexterm>
3912 This option is the same as <option>-bf</option> except that it assumes that the filter being
3913 tested is a system filter. The additional commands that are available only in
3914 system filters are recognized.
3915 </para>
3916 </listitem></varlistentry>
3917 <varlistentry>
3918 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3919 <listitem>
3920 <para>
3921 <indexterm role="option">
3922 <primary><option>-bf</option></primary>
3923 </indexterm>
3924 <indexterm role="concept">
3925 <primary>filter</primary>
3926 <secondary>testing</secondary>
3927 </indexterm>
3928 <indexterm role="concept">
3929 <primary>testing</primary>
3930 <secondary>filter file</secondary>
3931 </indexterm>
3932 <indexterm role="concept">
3933 <primary>forward file</primary>
3934 <secondary>testing</secondary>
3935 </indexterm>
3936 <indexterm role="concept">
3937 <primary>testing</primary>
3938 <secondary>forward file</secondary>
3939 </indexterm>
3940 <indexterm role="concept">
3941 <primary>Sieve filter</primary>
3942 <secondary>testing</secondary>
3943 </indexterm>
3944 This option runs Exim in user filter testing mode; the file is the filter file
3945 to be tested, and a test message must be supplied on the standard input. If
3946 there are no message-dependent tests in the filter, an empty file can be
3947 supplied.
3948 </para>
3949 <para>
3950 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3951 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3952 filter and a user filter in the same run. For example:
3953 </para>
3954 <literallayout class="monospaced">
3955 exim -bF /system/filter -bf /user/filter &lt;/test/message
3956 </literallayout>
3957 <para>
3958 This is helpful when the system filter adds header lines or sets filter
3959 variables that are used by the user filter.
3960 </para>
3961 <para>
3962 If the test filter file does not begin with one of the special lines
3963 </para>
3964 <literallayout class="monospaced">
3965 # Exim filter
3966 # Sieve filter
3967 </literallayout>
3968 <para>
3969 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3970 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3971 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3972 redirection lists.
3973 </para>
3974 <para>
3975 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3976 detected, is a list of the actions that Exim would try to take if presented
3977 with the message for real. More details of filter testing are given in the
3978 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3979 </para>
3980 <para>
3981 When testing a filter file,
3982 <indexterm role="concept">
3983 <primary><quote>From</quote> line</primary>
3984 </indexterm>
3985 <indexterm role="concept">
3986 <primary>envelope sender</primary>
3987 </indexterm>
3988 <indexterm role="option">
3989 <primary><option>-f</option></primary>
3990 <secondary>for filter testing</secondary>
3991 </indexterm>
3992 the envelope sender can be set by the <option>-f</option> option,
3993 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3994 that would normally be taken from the envelope recipient address of the message
3995 can be set by means of additional command line options (see the next four
3996 options).
3997 </para>
3998 </listitem></varlistentry>
3999 <varlistentry>
4000 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
4001 <listitem>
4002 <para>
4003 <indexterm role="option">
4004 <primary><option>-bfd</option></primary>
4005 </indexterm>
4006 <indexterm role="variable">
4007 <primary><varname>$qualify_domain</varname></primary>
4008 </indexterm>
4009 This sets the domain of the recipient address when a filter file is being
4010 tested by means of the <option>-bf</option> option. The default is the value of
4011 <varname>$qualify_domain</varname>.
4012 </para>
4013 </listitem></varlistentry>
4014 <varlistentry>
4015 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4016 <listitem>
4017 <para>
4018 <indexterm role="option">
4019 <primary><option>-bfl</option></primary>
4020 </indexterm>
4021 This sets the local part of the recipient address when a filter file is being
4022 tested by means of the <option>-bf</option> option. The default is the username of the
4023 process that calls Exim. A local part should be specified with any prefix or
4024 suffix stripped, because that is how it appears to the filter when a message is
4025 actually being delivered.
4026 </para>
4027 </listitem></varlistentry>
4028 <varlistentry>
4029 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4030 <listitem>
4031 <para>
4032 <indexterm role="option">
4033 <primary><option>-bfp</option></primary>
4034 </indexterm>
4035 This sets the prefix of the local part of the recipient address when a filter
4036 file is being tested by means of the <option>-bf</option> option. The default is an empty
4037 prefix.
4038 </para>
4039 </listitem></varlistentry>
4040 <varlistentry>
4041 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4042 <listitem>
4043 <para>
4044 <indexterm role="option">
4045 <primary><option>-bfs</option></primary>
4046 </indexterm>
4047 This sets the suffix of the local part of the recipient address when a filter
4048 file is being tested by means of the <option>-bf</option> option. The default is an empty
4049 suffix.
4050 </para>
4051 </listitem></varlistentry>
4052 <varlistentry>
4053 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4054 <listitem>
4055 <para>
4056 <indexterm role="option">
4057 <primary><option>-bh</option></primary>
4058 </indexterm>
4059 <indexterm role="concept">
4060 <primary>testing</primary>
4061 <secondary>incoming SMTP</secondary>
4062 </indexterm>
4063 <indexterm role="concept">
4064 <primary>SMTP</primary>
4065 <secondary>testing incoming</secondary>
4066 </indexterm>
4067 <indexterm role="concept">
4068 <primary>testing</primary>
4069 <secondary>relay control</secondary>
4070 </indexterm>
4071 <indexterm role="concept">
4072 <primary>relaying</primary>
4073 <secondary>testing configuration</secondary>
4074 </indexterm>
4075 <indexterm role="concept">
4076 <primary>policy control</primary>
4077 <secondary>testing</secondary>
4078 </indexterm>
4079 <indexterm role="concept">
4080 <primary>debugging</primary>
4081 <secondary><option>-bh</option> option</secondary>
4082 </indexterm>
4083 This option runs a fake SMTP session as if from the given IP address, using the
4084 standard input and output. The IP address may include a port number at the end,
4085 after a full stop. For example:
4086 </para>
4087 <literallayout class="monospaced">
4088 exim -bh 10.9.8.7.1234
4089 exim -bh fe80::a00:20ff:fe86:a061.5678
4090 </literallayout>
4091 <para>
4092 When an IPv6 address is given, it is converted into canonical form. In the case
4093 of the second example above, the value of <varname>$sender_host_address</varname> after
4094 conversion to the canonical form is
4095 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4096 </para>
4097 <para>
4098 Comments as to what is going on are written to the standard error file. These
4099 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4100 This facility is provided for testing configuration options for incoming
4101 messages, to make sure they implement the required policy. For example, you can
4102 test your relay controls using <option>-bh</option>.
4103 </para>
4104 <para>
4105 <emphasis role="bold">Warning 1</emphasis>:
4106 <indexterm role="concept">
4107 <primary>RFC 1413</primary>
4108 </indexterm>
4109 You can test features of the configuration that rely on ident (RFC 1413)
4110 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4111 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4112 connection.
4113 </para>
4114 <para>
4115 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4116 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4117 occur, use <option>-bhc</option> instead.
4118 </para>
4119 <para>
4120 Messages supplied during the testing session are discarded, and nothing is
4121 written to any of the real log files. There may be pauses when DNS (and other)
4122 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4123 can be used to specify a specific IP interface and port if this is important,
4124 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4125 session were authenticated.
4126 </para>
4127 <para>
4128 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4129 output just states whether a given recipient address from a given host is
4130 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4131 </para>
4132 <para>
4133 Features such as authentication and encryption, where the client input is not
4134 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4135 specialized SMTP test program such as
4136 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4137 </para>
4138 </listitem></varlistentry>
4139 <varlistentry>
4140 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4141 <listitem>
4142 <para>
4143 <indexterm role="option">
4144 <primary><option>-bhc</option></primary>
4145 </indexterm>
4146 This option operates in the same way as <option>-bh</option>, except that address
4147 verification callouts are performed if required. This includes consulting and
4148 updating the callout cache database.
4149 </para>
4150 </listitem></varlistentry>
4151 <varlistentry>
4152 <term><option>-bi</option></term>
4153 <listitem>
4154 <para>
4155 <indexterm role="option">
4156 <primary><option>-bi</option></primary>
4157 </indexterm>
4158 <indexterm role="concept">
4159 <primary>alias file</primary>
4160 <secondary>building</secondary>
4161 </indexterm>
4162 <indexterm role="concept">
4163 <primary>building alias file</primary>
4164 </indexterm>
4165 <indexterm role="concept">
4166 <primary>Sendmail compatibility</primary>
4167 <secondary><option>-bi</option> option</secondary>
4168 </indexterm>
4169 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4170 Exim does not have the concept of a single alias file, and so it cannot mimic
4171 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4172 tend to appear in various scripts such as NIS make files, so the option must be
4173 recognized.
4174 </para>
4175 <para>
4176 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4177 configuration option is run, under the uid and gid of the caller of Exim. If
4178 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4179 The command set by <option>bi_command</option> may not contain arguments. The command can
4180 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4181 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4182 <option>-bi</option> is a no-op.
4183 </para>
4184 </listitem></varlistentry>
4185 <varlistentry>
4186 <term><option>-bI:help</option></term>
4187 <listitem>
4188 <para>
4189 <indexterm role="option">
4190 <primary><option>-bI:help</option></primary>
4191 </indexterm>
4192 <indexterm role="concept">
4193 <primary>querying exim information</primary>
4194 </indexterm>
4195 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4196 information.  The output of many of these will be intended for machine
4197 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4198 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4199 options shall cause Exim to exit after producing the requested output.
4200 </para>
4201 </listitem></varlistentry>
4202 <varlistentry>
4203 <term><option>-bI:dscp</option></term>
4204 <listitem>
4205 <para>
4206 <indexterm role="option">
4207 <primary><option>-bI:dscp</option></primary>
4208 </indexterm>
4209 <indexterm role="concept">
4210 <primary>DSCP</primary>
4211 <secondary>values</secondary>
4212 </indexterm>
4213 This option causes Exim to emit an alphabetically sorted list of all
4214 recognised DSCP names.
4215 </para>
4216 </listitem></varlistentry>
4217 <varlistentry>
4218 <term><option>-bI:sieve</option></term>
4219 <listitem>
4220 <para>
4221 <indexterm role="option">
4222 <primary><option>-bI:sieve</option></primary>
4223 </indexterm>
4224 <indexterm role="concept">
4225 <primary>Sieve filter</primary>
4226 <secondary>capabilities</secondary>
4227 </indexterm>
4228 This option causes Exim to emit an alphabetically sorted list of all supported
4229 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4230 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4231 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4232 compile-time build options, which this option will adapt to, this is the only
4233 way to guarantee a correct response.
4234 </para>
4235 </listitem></varlistentry>
4236 <varlistentry>
4237 <term><option>-bm</option></term>
4238 <listitem>
4239 <para>
4240 <indexterm role="option">
4241 <primary><option>-bm</option></primary>
4242 </indexterm>
4243 <indexterm role="concept">
4244 <primary>local message reception</primary>
4245 </indexterm>
4246 This option runs an Exim receiving process that accepts an incoming,
4247 locally-generated message on the standard input. The recipients are given as the
4248 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4249 argument can be a comma-separated list of RFC 2822 addresses. This is the
4250 default option for selecting the overall action of an Exim call; it is assumed
4251 if no other conflicting option is present.
4252 </para>
4253 <para>
4254 If any addresses in the message are unqualified (have no domain), they are
4255 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4256 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4257 suppressing this for special cases.
4258 </para>
4259 <para>
4260 Policy checks on the contents of local messages can be enforced by means of
4261 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4262 </para>
4263 <para>
4264 <indexterm role="concept">
4265 <primary>return code</primary>
4266 <secondary>for <option>-bm</option></secondary>
4267 </indexterm>
4268 The return code is zero if the message is successfully accepted. Otherwise, the
4269 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4270 </para>
4271 <para>
4272 The format
4273 <indexterm role="concept">
4274 <primary>message</primary>
4275 <secondary>format</secondary>
4276 </indexterm>
4277 <indexterm role="concept">
4278 <primary>format</primary>
4279 <secondary>message</secondary>
4280 </indexterm>
4281 <indexterm role="concept">
4282 <primary><quote>From</quote> line</primary>
4283 </indexterm>
4284 <indexterm role="concept">
4285 <primary>UUCP</primary>
4286 <secondary><quote>From</quote> line</secondary>
4287 </indexterm>
4288 <indexterm role="concept">
4289 <primary>Sendmail compatibility</primary>
4290 <secondary><quote>From</quote> line</secondary>
4291 </indexterm>
4292 of the message must be as defined in RFC 2822, except that, for
4293 compatibility with Sendmail and Smail, a line in one of the forms
4294 </para>
4295 <literallayout class="monospaced">
4296 From sender Fri Jan  5 12:55 GMT 1997
4297 From sender Fri, 5 Jan 97 12:55:01
4298 </literallayout>
4299 <para>
4300 (with the weekday optional, and possibly with additional text after the date)
4301 is permitted to appear at the start of the message. There appears to be no
4302 authoritative specification of the format of this line. Exim recognizes it by
4303 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4304 option, which can be changed if necessary.
4305 </para>
4306 <para>
4307 <indexterm role="option">
4308 <primary><option>-f</option></primary>
4309 <secondary>overriding <quote>From</quote> line</secondary>
4310 </indexterm>
4311 The specified sender is treated as if it were given as the argument to the
4312 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4313 preference to the address taken from the message. The caller of Exim must be a
4314 trusted user for the sender of a message to be set in this way.
4315 </para>
4316 </listitem></varlistentry>
4317 <varlistentry>
4318 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4319 <listitem>
4320 <para>
4321 <indexterm role="option">
4322 <primary><option>-bmalware</option></primary>
4323 </indexterm>
4324 <indexterm role="concept">
4325 <primary>testing</primary>
4326 <secondary>,</secondary>
4327 </indexterm>
4328 <indexterm role="concept">
4329 <primary>malware scan test</primary>
4330 </indexterm>
4331 This debugging option causes Exim to scan the given file or directory
4332 (depending on the used scanner interface),
4333 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4334 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4335 the expansion should have defaults which apply to this invocation.  ACLs are
4336 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4337 will never be populated and <option>-bmalware</option> will fail.
4338 </para>
4339 <para>
4340 Exim will have changed working directory before resolving the filename, so
4341 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4342 user when it tries to open the file, rather than as the invoking user.
4343 This option requires admin privileges.
4344 </para>
4345 <para>
4346 The <option>-bmalware</option> option will not be extended to be more generally useful,
4347 there are better tools for file-scanning.  This option exists to help
4348 administrators verify their Exim and AV scanner configuration.
4349 </para>
4350 </listitem></varlistentry>
4351 <varlistentry>
4352 <term><option>-bnq</option></term>
4353 <listitem>
4354 <para>
4355 <indexterm role="option">
4356 <primary><option>-bnq</option></primary>
4357 </indexterm>
4358 <indexterm role="concept">
4359 <primary>address qualification, suppressing</primary>
4360 </indexterm>
4361 By default, Exim automatically qualifies unqualified addresses (those
4362 without domains) that appear in messages that are submitted locally (that
4363 is, not over TCP/IP). This qualification applies both to addresses in
4364 envelopes, and addresses in header lines. Sender addresses are qualified using
4365 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4366 defaults to the value of <option>qualify_domain</option>).
4367 </para>
4368 <para>
4369 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4370 being used to re-submit messages that originally came from remote hosts after
4371 content scanning, you probably do not want to qualify unqualified addresses in
4372 header lines. (Such lines will be present only if you have not enabled a header
4373 syntax check in the appropriate ACL.)
4374 </para>
4375 <para>
4376 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4377 messages that originate on the local host. When this is used, unqualified
4378 addresses in the envelope provoke errors (causing message rejection) and
4379 unqualified addresses in header lines are left alone.
4380 </para>
4381 </listitem></varlistentry>
4382 <varlistentry>
4383 <term><option>-bP</option></term>
4384 <listitem>
4385 <para>
4386 <indexterm role="option">
4387 <primary><option>-bP</option></primary>
4388 </indexterm>
4389 <indexterm role="concept">
4390 <primary>configuration options</primary>
4391 <secondary>extracting</secondary>
4392 </indexterm>
4393 <indexterm role="concept">
4394 <primary>options</primary>
4395 <secondary>configuration &ndash; extracting</secondary>
4396 </indexterm>
4397 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4398 main configuration options to be written to the standard output. The values
4399 of one or more specific options can be requested by giving their names as
4400 arguments, for example:
4401 </para>
4402 <literallayout class="monospaced">
4403 exim -bP qualify_domain hold_domains
4404 </literallayout>
4405 <para>
4406 <indexterm role="concept">
4407 <primary>hiding configuration option values</primary>
4408 </indexterm>
4409 <indexterm role="concept">
4410 <primary>configuration options</primary>
4411 <secondary>hiding value of</secondary>
4412 </indexterm>
4413 <indexterm role="concept">
4414 <primary>options</primary>
4415 <secondary>hiding value of</secondary>
4416 </indexterm>
4417 However, any option setting that is preceded by the word <quote>hide</quote> in the
4418 configuration file is not shown in full, except to an admin user. For other
4419 users, the output is as in this example:
4420 </para>
4421 <literallayout class="monospaced">
4422 mysql_servers = &lt;value not displayable&gt;
4423 </literallayout>
4424 <para>
4425 If <option>config</option> is given as an argument, the config is
4426 output, as it was parsed, any include file resolved, any comment removed.
4427 </para>
4428 <para>
4429 If <option>config_file</option> is given as an argument, the name of the run time
4430 configuration file is output. (<option>configure_file</option> works too, for
4431 backward compatibility.)
4432 If a list of configuration files was supplied, the value that is output here
4433 is the name of the file that was actually used.
4434 </para>
4435 <para>
4436 <indexterm role="concept">
4437 <primary>options</primary>
4438 <secondary>hiding name of</secondary>
4439 </indexterm>
4440 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4441 name will not be output.
4442 </para>
4443 <para>
4444 <indexterm role="concept">
4445 <primary>daemon</primary>
4446 <secondary>process id (pid)</secondary>
4447 </indexterm>
4448 <indexterm role="concept">
4449 <primary>pid (process id)</primary>
4450 <secondary>of daemon</secondary>
4451 </indexterm>
4452 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4453 directories where log files and daemon pid files are written are output,
4454 respectively. If these values are unset, log files are written in a
4455 sub-directory of the spool directory called <option>log</option>, and the pid file is
4456 written directly into the spool directory.
4457 </para>
4458 <para>
4459 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4460 </para>
4461 <literallayout class="monospaced">
4462 exim -bP +local_domains
4463 </literallayout>
4464 <para>
4465 it searches for a matching named list of any type (domain, host, address, or
4466 local part) and outputs what it finds.
4467 </para>
4468 <para>
4469 <indexterm role="concept">
4470 <primary>options</primary>
4471 <secondary>router &ndash; extracting</secondary>
4472 </indexterm>
4473 <indexterm role="concept">
4474 <primary>options</primary>
4475 <secondary>transport &ndash; extracting</secondary>
4476 </indexterm>
4477 <indexterm role="concept">
4478 <primary>options</primary>
4479 <secondary>authenticator &ndash; extracting</secondary>
4480 </indexterm>
4481 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4482 followed by the name of an appropriate driver instance, the option settings for
4483 that driver are output. For example:
4484 </para>
4485 <literallayout class="monospaced">
4486 exim -bP transport local_delivery
4487 </literallayout>
4488 <para>
4489 The generic driver options are output first, followed by the driver&#x2019;s private
4490 options. A list of the names of drivers of a particular type can be obtained by
4491 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4492 <option>authenticator_list</option>, and a complete list of all drivers with their option
4493 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4494 <option>authenticators</option>.
4495 </para>
4496 <para>
4497 <indexterm role="concept">
4498 <primary>environment</primary>
4499 </indexterm>
4500 If <option>environment</option> is given as an argument, the set of environment
4501 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4502 variables.
4503 </para>
4504 <para>
4505 <indexterm role="concept">
4506 <primary>options</primary>
4507 <secondary>macro &ndash; extracting</secondary>
4508 </indexterm>
4509 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4510 are available, similarly to the drivers.  Because macros are sometimes used
4511 for storing passwords, this option is restricted.
4512 The output format is one item per line.
4513 </para>
4514 </listitem></varlistentry>
4515 <varlistentry>
4516 <term><option>-bp</option></term>
4517 <listitem>
4518 <para>
4519 <indexterm role="option">
4520 <primary><option>-bp</option></primary>
4521 </indexterm>
4522 <indexterm role="concept">
4523 <primary>queue</primary>
4524 <secondary>listing messages on</secondary>
4525 </indexterm>
4526 <indexterm role="concept">
4527 <primary>listing</primary>
4528 <secondary>messages on the queue</secondary>
4529 </indexterm>
4530 This option requests a listing of the contents of the mail queue on the
4531 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4532 just those messages are listed. By default, this option can be used only by an
4533 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4534 to allow any user to see the queue.
4535 </para>
4536 <para>
4537 Each message on the queue is displayed as in the following example:
4538 </para>
4539 <literallayout class="monospaced">
4540 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4541           red.king@looking-glass.fict.example
4542           &lt;other addresses&gt;
4543 </literallayout>
4544 <para>
4545 <indexterm role="concept">
4546 <primary>message</primary>
4547 <secondary>size in queue listing</secondary>
4548 </indexterm>
4549 <indexterm role="concept">
4550 <primary>size</primary>
4551 <secondary>of message</secondary>
4552 </indexterm>
4553 The first line contains the length of time the message has been on the queue
4554 (in this case 25 minutes), the size of the message (2.9K), the unique local
4555 identifier for the message, and the message sender, as contained in the
4556 envelope. For bounce messages, the sender address is empty, and appears as
4557 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4558 the default sender address, the user&#x2019;s login name is shown in parentheses
4559 before the sender address.
4560 </para>
4561 <para>
4562 <indexterm role="concept">
4563 <primary>frozen messages</primary>
4564 <secondary>in queue listing</secondary>
4565 </indexterm>
4566 If the message is frozen (attempts to deliver it are suspended) then the text
4567 <quote>*** frozen ***</quote> is displayed at the end of this line.
4568 </para>
4569 <para>
4570 The recipients of the message (taken from the envelope, not the headers) are
4571 displayed on subsequent lines. Those addresses to which the message has already
4572 been delivered are marked with the letter D. If an original address gets
4573 expanded into several addresses via an alias or forward file, the original is
4574 displayed with a D only when deliveries for all of its child addresses are
4575 complete.
4576 </para>
4577 </listitem></varlistentry>
4578 <varlistentry>
4579 <term><option>-bpa</option></term>
4580 <listitem>
4581 <para>
4582 <indexterm role="option">
4583 <primary><option>-bpa</option></primary>
4584 </indexterm>
4585 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4586 that were generated from the original top level address(es) in each message by
4587 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4588 of just <quote>D</quote>.
4589 </para>
4590 </listitem></varlistentry>
4591 <varlistentry>
4592 <term><option>-bpc</option></term>
4593 <listitem>
4594 <para>
4595 <indexterm role="option">
4596 <primary><option>-bpc</option></primary>
4597 </indexterm>
4598 <indexterm role="concept">
4599 <primary>queue</primary>
4600 <secondary>count of messages on</secondary>
4601 </indexterm>
4602 This option counts the number of messages on the queue, and writes the total
4603 to the standard output. It is restricted to admin users, unless
4604 <option>queue_list_requires_admin</option> is set false.
4605 </para>
4606 </listitem></varlistentry>
4607 <varlistentry>
4608 <term><option>-bpr</option></term>
4609 <listitem>
4610 <para>
4611 <indexterm role="option">
4612 <primary><option>-bpr</option></primary>
4613 </indexterm>
4614 This option operates like <option>-bp</option>, but the output is not sorted into
4615 chronological order of message arrival. This can speed it up when there are
4616 lots of messages on the queue, and is particularly useful if the output is
4617 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4618 </para>
4619 </listitem></varlistentry>
4620 <varlistentry>
4621 <term><option>-bpra</option></term>
4622 <listitem>
4623 <para>
4624 <indexterm role="option">
4625 <primary><option>-bpra</option></primary>
4626 </indexterm>
4627 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4628 </para>
4629 </listitem></varlistentry>
4630 <varlistentry>
4631 <term><option>-bpru</option></term>
4632 <listitem>
4633 <para>
4634 <indexterm role="option">
4635 <primary><option>-bpru</option></primary>
4636 </indexterm>
4637 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4638 </para>
4639 </listitem></varlistentry>
4640 <varlistentry>
4641 <term><option>-bpu</option></term>
4642 <listitem>
4643 <para>
4644 <indexterm role="option">
4645 <primary><option>-bpu</option></primary>
4646 </indexterm>
4647 This option operates like <option>-bp</option> but shows only undelivered top-level
4648 addresses for each message displayed. Addresses generated by aliasing or
4649 forwarding are not shown, unless the message was deferred after processing by a
4650 router with the <option>one_time</option> option set.
4651 </para>
4652 </listitem></varlistentry>
4653 <varlistentry>
4654 <term><option>-brt</option></term>
4655 <listitem>
4656 <para>
4657 <indexterm role="option">
4658 <primary><option>-brt</option></primary>
4659 </indexterm>
4660 <indexterm role="concept">
4661 <primary>testing</primary>
4662 <secondary>retry configuration</secondary>
4663 </indexterm>
4664 <indexterm role="concept">
4665 <primary>retry</primary>
4666 <secondary>configuration testing</secondary>
4667 </indexterm>
4668 This option is for testing retry rules, and it must be followed by up to three
4669 arguments. It causes Exim to look for a retry rule that matches the values
4670 and to write it to the standard output. For example:
4671 </para>
4672 <literallayout class="monospaced">
4673 exim -brt bach.comp.mus.example
4674 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4675 </literallayout>
4676 <para>
4677 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4678 argument, which is required, can be a complete address in the form
4679 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4680 contains a dot, it is interpreted as an optional second domain name; if no
4681 retry rule is found for the first argument, the second is tried. This ties in
4682 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4683 rule is found that matches the host, one that matches the mail domain is
4684 sought. Finally, an argument that is the name of a specific delivery error, as
4685 used in setting up retry rules, can be given. For example:
4686 </para>
4687 <literallayout class="monospaced">
4688 exim -brt haydn.comp.mus.example quota_3d
4689 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4690 </literallayout>
4691 </listitem></varlistentry>
4692 <varlistentry>
4693 <term><option>-brw</option></term>
4694 <listitem>
4695 <para>
4696 <indexterm role="option">
4697 <primary><option>-brw</option></primary>
4698 </indexterm>
4699 <indexterm role="concept">
4700 <primary>testing</primary>
4701 <secondary>rewriting</secondary>
4702 </indexterm>
4703 <indexterm role="concept">
4704 <primary>rewriting</primary>
4705 <secondary>testing</secondary>
4706 </indexterm>
4707 This option is for testing address rewriting rules, and it must be followed by
4708 a single argument, consisting of either a local part without a domain, or a
4709 complete address with a fully qualified domain. Exim outputs how this address
4710 would be rewritten for each possible place it might appear. See chapter
4711 <xref linkend="CHAPrewrite"/> for further details.
4712 </para>
4713 </listitem></varlistentry>
4714 <varlistentry>
4715 <term><option>-bS</option></term>
4716 <listitem>
4717 <para>
4718 <indexterm role="option">
4719 <primary><option>-bS</option></primary>
4720 </indexterm>
4721 <indexterm role="concept">
4722 <primary>SMTP</primary>
4723 <secondary>batched incoming</secondary>
4724 </indexterm>
4725 <indexterm role="concept">
4726 <primary>batched SMTP input</primary>
4727 </indexterm>
4728 This option is used for batched SMTP input, which is an alternative interface
4729 for non-interactive local message submission. A number of messages can be
4730 submitted in a single run. However, despite its name, this is not really SMTP
4731 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4732 input, but generates no responses. If the caller is trusted, or
4733 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4734 believed; otherwise the sender is always the caller of Exim.
4735 </para>
4736 <para>
4737 The message itself is read from the standard input, in SMTP format (leading
4738 dots doubled), terminated by a line containing just a single dot. An error is
4739 provoked if the terminating dot is missing. A further message may then follow.
4740 </para>
4741 <para>
4742 As for other local message submissions, the contents of incoming batch SMTP
4743 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4744 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4745 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4746 </para>
4747 <para>
4748 Some other SMTP commands are recognized in the input. HELO and EHLO act
4749 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4750 QUIT quits, ignoring the rest of the standard input.
4751 </para>
4752 <para>
4753 <indexterm role="concept">
4754 <primary>return code</primary>
4755 <secondary>for <option>-bS</option></secondary>
4756 </indexterm>
4757 If any error is encountered, reports are written to the standard output and
4758 error streams, and Exim gives up immediately. The return code is 0 if no error
4759 was detected; it is 1 if one or more messages were accepted before the error
4760 was detected; otherwise it is 2.
4761 </para>
4762 <para>
4763 More details of input using batched SMTP are given in section
4764 <xref linkend="SECTincomingbatchedSMTP"/>.
4765 </para>
4766 </listitem></varlistentry>
4767 <varlistentry>
4768 <term><option>-bs</option></term>
4769 <listitem>
4770 <para>
4771 <indexterm role="option">
4772 <primary><option>-bs</option></primary>
4773 </indexterm>
4774 <indexterm role="concept">
4775 <primary>SMTP</primary>
4776 <secondary>local input</secondary>
4777 </indexterm>
4778 <indexterm role="concept">
4779 <primary>local SMTP input</primary>
4780 </indexterm>
4781 This option causes Exim to accept one or more messages by reading SMTP commands
4782 on the standard input, and producing SMTP replies on the standard output. SMTP
4783 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4784 Some user agents use this interface as a way of passing locally-generated
4785 messages to the MTA.
4786 </para>
4787 <para>
4788 In
4789 <indexterm role="concept">
4790 <primary>sender</primary>
4791 <secondary>source of</secondary>
4792 </indexterm>
4793 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4794 set, the senders of messages are taken from the SMTP MAIL commands.
4795 Otherwise the content of these commands is ignored and the sender is set up as
4796 the calling user. Unqualified addresses are automatically qualified using
4797 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4798 <option>-bnq</option> option is used.
4799 </para>
4800 <para>
4801 <indexterm role="concept">
4802 <primary>inetd</primary>
4803 </indexterm>
4804 The
4805 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4806 using a listening daemon. Exim can distinguish the two cases by checking
4807 whether the standard input is a TCP/IP socket. When Exim is called from
4808 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4809 above concerning senders and qualification do not apply. In this situation,
4810 Exim behaves in exactly the same way as it does when receiving a message via
4811 the listening daemon.
4812 </para>
4813 </listitem></varlistentry>
4814 <varlistentry>
4815 <term><option>-bt</option></term>
4816 <listitem>
4817 <para>
4818 <indexterm role="option">
4819 <primary><option>-bt</option></primary>
4820 </indexterm>
4821 <indexterm role="concept">
4822 <primary>testing</primary>
4823 <secondary>addresses</secondary>
4824 </indexterm>
4825 <indexterm role="concept">
4826 <primary>address</primary>
4827 <secondary>testing</secondary>
4828 </indexterm>
4829 This option runs Exim in address testing mode, in which each argument is taken
4830 as a recipient address to be tested for deliverability. The results are
4831 written to the standard output. If a test fails, and the caller is not an admin
4832 user, no details of the failure are output, because these might contain
4833 sensitive information such as usernames and passwords for database lookups.
4834 </para>
4835 <para>
4836 If no arguments are given, Exim runs in an interactive manner, prompting with a
4837 right angle bracket for addresses to be tested.
4838 </para>
4839 <para>
4840 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4841 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4842 security issues.
4843 </para>
4844 <para>
4845 Each address is handled as if it were the recipient address of a message
4846 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4847 written to the standard output. However, any router that has
4848 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4849 genuine routing tests if your first router passes everything to a scanner
4850 program.
4851 </para>
4852 <para>
4853 <indexterm role="concept">
4854 <primary>return code</primary>
4855 <secondary>for <option>-bt</option></secondary>
4856 </indexterm>
4857 The return code is 2 if any address failed outright; it is 1 if no address
4858 failed outright but at least one could not be resolved for some reason. Return
4859 code 0 is given only when all addresses succeed.
4860 </para>
4861 <para>
4862 <indexterm role="concept">
4863 <primary>duplicate addresses</primary>
4864 </indexterm>
4865 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4866 addresses after routing is complete, so that only one delivery takes place.
4867 This does not happen when testing with <option>-bt</option>; the full results of routing are
4868 always shown.
4869 </para>
4870 <para>
4871 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4872 routers in the configuration makes any tests on the sender address of a
4873 message,
4874 <indexterm role="option">
4875 <primary><option>-f</option></primary>
4876 <secondary>for address testing</secondary>
4877 </indexterm>
4878 you can use the <option>-f</option> option to set an appropriate sender when running
4879 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4880 default qualifying domain. However, if you have set up (for example) routers
4881 whose behaviour depends on the contents of an incoming message, you cannot test
4882 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4883 doing such tests.
4884 </para>
4885 </listitem></varlistentry>
4886 <varlistentry>
4887 <term><option>-bV</option></term>
4888 <listitem>
4889 <para>
4890 <indexterm role="option">
4891 <primary><option>-bV</option></primary>
4892 </indexterm>
4893 <indexterm role="concept">
4894 <primary>version number of Exim</primary>
4895 </indexterm>
4896 This option causes Exim to write the current version number, compilation
4897 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4898 It also lists the DBM library that is being used, the optional modules (such as
4899 specific lookup types), the drivers that are included in the binary, and the
4900 name of the run time configuration file that is in use.
4901 </para>
4902 <para>
4903 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4904 configuration file. However, this is a static check only. It cannot check
4905 values that are to be expanded. For example, although a misspelt ACL verb is
4906 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4907 alone to discover (for example) all the typos in the configuration; some
4908 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4909 dynamic testing facilities.
4910 </para>
4911 </listitem></varlistentry>
4912 <varlistentry>
4913 <term><option>-bv</option></term>
4914 <listitem>
4915 <para>
4916 <indexterm role="option">
4917 <primary><option>-bv</option></primary>
4918 </indexterm>
4919 <indexterm role="concept">
4920 <primary>verifying address</primary>
4921 <secondary>using <option>-bv</option></secondary>
4922 </indexterm>
4923 <indexterm role="concept">
4924 <primary>address</primary>
4925 <secondary>verification</secondary>
4926 </indexterm>
4927 This option runs Exim in address verification mode, in which each argument is
4928 taken as a recipient address to be verified by the routers. (This does
4929 not involve any verification callouts). During normal operation, verification
4930 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4931 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4932 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4933 </para>
4934 <para>
4935 If verification fails, and the caller is not an admin user, no details of the
4936 failure are output, because these might contain sensitive information such as
4937 usernames and passwords for database lookups.
4938 </para>
4939 <para>
4940 If no arguments are given, Exim runs in an interactive manner, prompting with a
4941 right angle bracket for addresses to be verified.
4942 </para>
4943 <para>
4944 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4945 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4946 security issues.
4947 </para>
4948 <para>
4949 Verification differs from address testing (the <option>-bt</option> option) in that routers
4950 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4951 router that has <option>fail_verify</option> set, verification fails. The address is
4952 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4953 address, <option>-bvs</option> should be used.
4954 </para>
4955 <para>
4956 If the <option>-v</option> option is not set, the output consists of a single line for each
4957 address, stating whether it was verified or not, and giving a reason in the
4958 latter case. Without <option>-v</option>, generating more than one address by redirection
4959 causes verification to end successfully, without considering the generated
4960 addresses. However, if just one address is generated, processing continues,
4961 and the generated address must verify successfully for the overall verification
4962 to succeed.
4963 </para>
4964 <para>
4965 When <option>-v</option> is set, more details are given of how the address has been handled,
4966 and in the case of address redirection, all the generated addresses are also
4967 considered. Verification may succeed for some and fail for others.
4968 </para>
4969 <para>
4970 The
4971 <indexterm role="concept">
4972 <primary>return code</primary>
4973 <secondary>for <option>-bv</option></secondary>
4974 </indexterm>
4975 return code is 2 if any address failed outright; it is 1 if no address
4976 failed outright but at least one could not be resolved for some reason. Return
4977 code 0 is given only when all addresses succeed.
4978 </para>
4979 <para>
4980 If any of the routers in the configuration makes any tests on the sender
4981 address of a message, you should use the <option>-f</option> option to set an appropriate
4982 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4983 calling user at the default qualifying domain.
4984 </para>
4985 </listitem></varlistentry>
4986 <varlistentry>
4987 <term><option>-bvs</option></term>
4988 <listitem>
4989 <para>
4990 <indexterm role="option">
4991 <primary><option>-bvs</option></primary>
4992 </indexterm>
4993 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4994 than a recipient address. This affects any rewriting and qualification that
4995 might happen.
4996 </para>
4997 </listitem></varlistentry>
4998 <varlistentry>
4999 <term><option>-bw</option></term>
5000 <listitem>
5001 <para>
5002 <indexterm role="option">
5003 <primary><option>-bw</option></primary>
5004 </indexterm>
5005 <indexterm role="concept">
5006 <primary>daemon</primary>
5007 </indexterm>
5008 <indexterm role="concept">
5009 <primary>inetd</primary>
5010 </indexterm>
5011 <indexterm role="concept">
5012 <primary>inetd</primary>
5013 <secondary>wait mode</secondary>
5014 </indexterm>
5015 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5016 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5017 and in the configuration file are ignored.  Queue-running may not be specified.
5018 </para>
5019 <para>
5020 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5021 listening for connections.  This permits the system to start up and have
5022 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5023 each port only when the first connection is received.
5024 </para>
5025 <para>
5026 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5027 which the daemon will exit, which should cause inetd to listen once more.
5028 </para>
5029 </listitem></varlistentry>
5030 <varlistentry>
5031 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5032 <listitem>
5033 <para>
5034 <indexterm role="option">
5035 <primary><option>-C</option></primary>
5036 </indexterm>
5037 <indexterm role="concept">
5038 <primary>configuration file</primary>
5039 <secondary>alternate</secondary>
5040 </indexterm>
5041 <indexterm role="concept">
5042 <primary>CONFIGURE_FILE</primary>
5043 </indexterm>
5044 <indexterm role="concept">
5045 <primary>alternate configuration file</primary>
5046 </indexterm>
5047 This option causes Exim to find the run time configuration file from the given
5048 list instead of from the list specified by the CONFIGURE_FILE
5049 compile-time setting. Usually, the list will consist of just a single file
5050 name, but it can be a colon-separated list of names. In this case, the first
5051 file that exists is used. Failure to open an existing file stops Exim from
5052 proceeding any further along the list, and an error is generated.
5053 </para>
5054 <para>
5055 When this option is used by a caller other than root, and the list is different
5056 from the compiled-in list, Exim gives up its root privilege immediately, and
5057 runs with the real and effective uid and gid set to those of the caller.
5058 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5059 file contains a list of full pathnames, one per line, for configuration files
5060 which are trusted. Root privilege is retained for any configuration file so
5061 listed, as long as the caller is the Exim user (or the user specified in the
5062 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5063 not writeable by inappropriate users or groups.
5064 </para>
5065 <para>
5066 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5067 configuration using <option>-C</option> right through message reception and delivery,
5068 even if the caller is root. The reception works, but by that time, Exim is
5069 running as the Exim user, so when it re-executes to regain privilege for the
5070 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5071 test reception and delivery using two separate commands (one to put a message
5072 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5073 </para>
5074 <para>
5075 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5076 prefix string with which any file named in a <option>-C</option> command line option
5077 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
5078 However, if the value of the <option>-C</option> option is identical to the value of
5079 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5080 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5081 unset, any file name can be used with <option>-C</option>.
5082 </para>
5083 <para>
5084 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5085 to a directory to which only root has access. This prevents someone who has
5086 broken into the Exim account from running a privileged Exim with an arbitrary
5087 configuration file.
5088 </para>
5089 <para>
5090 The <option>-C</option> facility is useful for ensuring that configuration files are
5091 syntactically correct, but cannot be used for test deliveries, unless the
5092 caller is privileged, or unless it is an exotic configuration that does not
5093 require privilege. No check is made on the owner or group of the files
5094 specified by this option.
5095 </para>
5096 </listitem></varlistentry>
5097 <varlistentry>
5098 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5099 <listitem>
5100 <para>
5101 <indexterm role="option">
5102 <primary><option>-D</option></primary>
5103 </indexterm>
5104 <indexterm role="concept">
5105 <primary>macro</primary>
5106 <secondary>setting on command line</secondary>
5107 </indexterm>
5108 This option can be used to override macro definitions in the configuration file
5109 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5110 unprivileged caller, it causes Exim to give up its root privilege.
5111 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5112 completely disabled, and its use causes an immediate error exit.
5113 </para>
5114 <para>
5115 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5116 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5117 supplies macros from this list, and the values are acceptable, then Exim will
5118 not give up root privilege if the caller is root, the Exim run-time user, or
5119 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5120 to be removed in the future.  Acceptable values for the macros satisfy the
5121 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5122 </para>
5123 <para>
5124 The entire option (including equals sign if present) must all be within one
5125 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5126 string, in which case the equals sign is optional. These two commands are
5127 synonymous:
5128 </para>
5129 <literallayout class="monospaced">
5130 exim -DABC  ...
5131 exim -DABC= ...
5132 </literallayout>
5133 <para>
5134 To include spaces in a macro definition item, quotes must be used. If you use
5135 quotes, spaces are permitted around the macro name and the equals sign. For
5136 example:
5137 </para>
5138 <literallayout class="monospaced">
5139 exim '-D ABC = something' ...
5140 </literallayout>
5141 <para>
5142 <option>-D</option> may be repeated up to 10 times on a command line.
5143 Only macro names up to 22 letters long can be set.
5144 </para>
5145 </listitem></varlistentry>
5146 <varlistentry>
5147 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5148 <listitem>
5149 <para>
5150 <indexterm role="option">
5151 <primary><option>-d</option></primary>
5152 </indexterm>
5153 <indexterm role="concept">
5154 <primary>debugging</primary>
5155 <secondary>list of selectors</secondary>
5156 </indexterm>
5157 <indexterm role="concept">
5158 <primary>debugging</primary>
5159 <secondary><option>-d</option> option</secondary>
5160 </indexterm>
5161 This option causes debugging information to be written to the standard
5162 error stream. It is restricted to admin users because debugging output may show
5163 database queries that contain password information. Also, the details of users&#x2019;
5164 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5165 writes an error message to the standard error stream and exits with a non-zero
5166 return code.
5167 </para>
5168 <para>
5169 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5170 standard debugging data is output. This can be reduced, or increased to include
5171 some more rarely needed information, by directly following <option>-d</option> with a string
5172 made up of names preceded by plus or minus characters. These add or remove sets
5173 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5174 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5175 no spaces are allowed in the debug setting. The available debugging categories
5176 are:
5177 </para>
5178 <literallayout>
5179 <literal>acl            </literal> ACL interpretation
5180 <literal>auth           </literal> authenticators
5181 <literal>deliver        </literal> general delivery logic
5182 <literal>dns            </literal> DNS lookups (see also resolver)
5183 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5184 <literal>exec           </literal> arguments for <function>execv()</function> calls
5185 <literal>expand         </literal> detailed debugging for string expansions
5186 <literal>filter         </literal> filter handling
5187 <literal>hints_lookup   </literal> hints data lookups
5188 <literal>host_lookup    </literal> all types of name-to-IP address handling
5189 <literal>ident          </literal> ident lookup
5190 <literal>interface      </literal> lists of local interfaces
5191 <literal>lists          </literal> matching things in lists
5192 <literal>load           </literal> system load checks
5193 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5194 <literal>lookup         </literal> general lookup code and all lookups
5195 <literal>memory         </literal> memory handling
5196 <literal>pid            </literal> add pid to debug output lines
5197 <literal>process_info   </literal> setting info for the process log
5198 <literal>queue_run      </literal> queue runs
5199 <literal>receive        </literal> general message reception logic
5200 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5201 <literal>retry          </literal> retry handling
5202 <literal>rewrite        </literal> address rewriting
5203 <literal>route          </literal> address routing
5204 <literal>timestamp      </literal> add timestamp to debug output lines
5205 <literal>tls            </literal> TLS logic
5206 <literal>transport      </literal> transports
5207 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5208 <literal>verify         </literal> address verification logic
5209 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5210 </literallayout>
5211 <para>
5212 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5213 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5214 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5215 is included, an awful lot of output that is very rarely of interest is
5216 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5217 turn everything off.
5218 </para>
5219 <para>
5220 <indexterm role="concept">
5221 <primary>resolver, debugging output</primary>
5222 </indexterm>
5223 <indexterm role="concept">
5224 <primary>DNS resolver, debugging output</primary>
5225 </indexterm>
5226 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5227 with DEBUG enabled. This is not the case in some operating systems. Also,
5228 unfortunately, debugging output from the DNS resolver is written to stdout
5229 rather than stderr.
5230 </para>
5231 <para>
5232 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5233 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5234 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5235 daemon, which then passes it on to any re-executed Exims. Exim also
5236 automatically adds the pid to debug lines when several remote deliveries are
5237 run in parallel.
5238 </para>
5239 <para>
5240 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5241 of all debug output lines. This can be useful when trying to track down delays
5242 in processing.
5243 </para>
5244 <para>
5245 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5246 any debugging is selected, or if <option>-v</option> is used.
5247 </para>
5248 </listitem></varlistentry>
5249 <varlistentry>
5250 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5251 <listitem>
5252 <para>
5253 <indexterm role="option">
5254 <primary><option>-dd</option></primary>
5255 </indexterm>
5256 This option behaves exactly like <option>-d</option> except when used on a command that
5257 starts a daemon process. In that case, debugging is turned off for the
5258 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5259 behaviour of the daemon without creating as much output as full debugging does.
5260 </para>
5261 </listitem></varlistentry>
5262 <varlistentry>
5263 <term><option>-dropcr</option></term>
5264 <listitem>
5265 <para>
5266 <indexterm role="option">
5267 <primary><option>-dropcr</option></primary>
5268 </indexterm>
5269 This is an obsolete option that is now a no-op. It used to affect the way Exim
5270 handled CR and LF characters in incoming messages. What happens now is
5271 described in section <xref linkend="SECTlineendings"/>.
5272 </para>
5273 </listitem></varlistentry>
5274 <varlistentry>
5275 <term><option>-E</option></term>
5276 <listitem>
5277 <para>
5278 <indexterm role="option">
5279 <primary><option>-E</option></primary>
5280 </indexterm>
5281 <indexterm role="concept">
5282 <primary>bounce message</primary>
5283 <secondary>generating</secondary>
5284 </indexterm>
5285 This option specifies that an incoming message is a locally-generated delivery
5286 failure report. It is used internally by Exim when handling delivery failures
5287 and is not intended for external use. Its only effect is to stop Exim
5288 generating certain messages to the postmaster, as otherwise message cascades
5289 could occur in some situations. As part of the same option, a message id may
5290 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5291 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5292 </para>
5293 </listitem></varlistentry>
5294 <varlistentry>
5295 <term><option>-e</option><emphasis>x</emphasis></term>
5296 <listitem>
5297 <para>
5298 <indexterm role="option">
5299 <primary><option>-e</option><emphasis>x</emphasis></primary>
5300 </indexterm>
5301 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5302 called by various programs without the leading <option>o</option> in the option. For
5303 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5304 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5305 </para>
5306 </listitem></varlistentry>
5307 <varlistentry>
5308 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5309 <listitem>
5310 <para>
5311 <indexterm role="option">
5312 <primary><option>-F</option></primary>
5313 </indexterm>
5314 <indexterm role="concept">
5315 <primary>sender</primary>
5316 <secondary>name</secondary>
5317 </indexterm>
5318 <indexterm role="concept">
5319 <primary>name</primary>
5320 <secondary>of sender</secondary>
5321 </indexterm>
5322 This option sets the sender&#x2019;s full name for use when a locally-generated
5323 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5324 entry from the password data is used. As users are generally permitted to alter
5325 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5326 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5327 </para>
5328 </listitem></varlistentry>
5329 <varlistentry>
5330 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5331 <listitem>
5332 <para>
5333 <indexterm role="option">
5334 <primary><option>-f</option></primary>
5335 </indexterm>
5336 <indexterm role="concept">
5337 <primary>sender</primary>
5338 <secondary>address</secondary>
5339 </indexterm>
5340 <indexterm role="concept">
5341 <primary>address</primary>
5342 <secondary>sender</secondary>
5343 </indexterm>
5344 <indexterm role="concept">
5345 <primary>trusted users</primary>
5346 </indexterm>
5347 <indexterm role="concept">
5348 <primary>envelope sender</primary>
5349 </indexterm>
5350 <indexterm role="concept">
5351 <primary>user</primary>
5352 <secondary>trusted</secondary>
5353 </indexterm>
5354 This option sets the address of the envelope sender of a locally-generated
5355 message (also known as the return path). The option can normally be used only
5356 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5357 users to use it.
5358 </para>
5359 <para>
5360 Processes running as root or the Exim user are always trusted. Other
5361 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5362 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5363 of a local message is set to the caller&#x2019;s login name at the default qualify
5364 domain.
5365 </para>
5366 <para>
5367 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5368 can be specified by any user, trusted or not, to create a message that can
5369 never provoke a bounce. An empty sender can be specified either as an empty
5370 string, or as a pair of angle brackets with nothing between them, as in these
5371 examples of shell commands:
5372 </para>
5373 <literallayout class="monospaced">
5374 exim -f '&lt;&gt;' user@domain
5375 exim -f "" user@domain
5376 </literallayout>
5377 <para>
5378 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5379 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5380 <option>-bv</option> options.
5381 </para>
5382 <para>
5383 Allowing untrusted users to change the sender address does not of itself make
5384 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5385 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5386 though this can be overridden by setting <option>no_local_from_check</option>.
5387 </para>
5388 <para>
5389 White
5390 <indexterm role="concept">
5391 <primary><quote>From</quote> line</primary>
5392 </indexterm>
5393 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5394 given as two arguments or one combined argument). The sender of a
5395 locally-generated message can also be set (when permitted) by an initial
5396 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5397 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5398 </para>
5399 </listitem></varlistentry>
5400 <varlistentry>
5401 <term><option>-G</option></term>
5402 <listitem>
5403 <para>
5404 <indexterm role="option">
5405 <primary><option>-G</option></primary>
5406 </indexterm>
5407 <indexterm role="concept">
5408 <primary>submission fixups, suppressing (command-line)</primary>
5409 </indexterm>
5410 This option is equivalent to an ACL applying:
5411 </para>
5412 <literallayout class="monospaced">
5413 control = suppress_local_fixups
5414 </literallayout>
5415 <para>
5416 for every message received.  Note that Sendmail will complain about such
5417 bad formatting, where Exim silently just does not fix it up.  This may change
5418 in future.
5419 </para>
5420 <para>
5421 As this affects audit information, the caller must be a trusted user to use
5422 this option.
5423 </para>
5424 </listitem></varlistentry>
5425 <varlistentry>
5426 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5427 <listitem>
5428 <para>
5429 <indexterm role="option">
5430 <primary><option>-h</option></primary>
5431 </indexterm>
5432 <indexterm role="concept">
5433 <primary>Sendmail compatibility</primary>
5434 <secondary><option>-h</option> option ignored</secondary>
5435 </indexterm>
5436 This option is accepted for compatibility with Sendmail, but has no effect. (In
5437 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5438 headers.)
5439 </para>
5440 </listitem></varlistentry>
5441 <varlistentry>
5442 <term><option>-i</option></term>
5443 <listitem>
5444 <para>
5445 <indexterm role="option">
5446 <primary><option>-i</option></primary>
5447 </indexterm>
5448 <indexterm role="concept">
5449 <primary>Solaris</primary>
5450 <secondary><emphasis>mail</emphasis> command</secondary>
5451 </indexterm>
5452 <indexterm role="concept">
5453 <primary>dot</primary>
5454 <secondary>in incoming non-SMTP message</secondary>
5455 </indexterm>
5456 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5457 line by itself should not terminate an incoming, non-SMTP message. I can find
5458 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5459 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5460 </para>
5461 </listitem></varlistentry>
5462 <varlistentry>
5463 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5464 <listitem>
5465 <para>
5466 <indexterm role="option">
5467 <primary><option>-L</option></primary>
5468 </indexterm>
5469 <indexterm role="concept">
5470 <primary>syslog</primary>
5471 <secondary>process name; set with flag</secondary>
5472 </indexterm>
5473 This option is equivalent to setting <option>syslog_processname</option> in the config
5474 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5475 Its use is restricted to administrators.  The configuration file has to be
5476 read and parsed, to determine access rights, before this is set and takes
5477 effect, so early configuration file errors will not honour this flag.
5478 </para>
5479 <para>
5480 The tag should not be longer than 32 characters.
5481 </para>
5482 </listitem></varlistentry>
5483 <varlistentry>
5484 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5485 <listitem>
5486 <para>
5487 <indexterm role="option">
5488 <primary><option>-M</option></primary>
5489 </indexterm>
5490 <indexterm role="concept">
5491 <primary>forcing delivery</primary>
5492 </indexterm>
5493 <indexterm role="concept">
5494 <primary>delivery</primary>
5495 <secondary>forcing attempt</secondary>
5496 </indexterm>
5497 <indexterm role="concept">
5498 <primary>frozen messages</primary>
5499 <secondary>forcing delivery</secondary>
5500 </indexterm>
5501 This option requests Exim to run a delivery attempt on each message in turn. If
5502 any of the messages are frozen, they are automatically thawed before the
5503 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5504 and <option>hold_domains</option> are ignored.
5505 </para>
5506 <para>
5507 Retry
5508 <indexterm role="concept">
5509 <primary>hints database</primary>
5510 <secondary>overriding retry hints</secondary>
5511 </indexterm>
5512 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5513 the normal retry time has not yet been reached. This option requires the caller
5514 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5515 which can be set false to relax this restriction (and also the same requirement
5516 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5517 </para>
5518 <para>
5519 The deliveries happen synchronously, that is, the original Exim process does
5520 not terminate until all the delivery attempts have finished. No output is
5521 produced unless there is a serious error. If you want to see what is happening,
5522 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5523 </para>
5524 </listitem></varlistentry>
5525 <varlistentry>
5526 <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>
5527 <listitem>
5528 <para>
5529 <indexterm role="option">
5530 <primary><option>-Mar</option></primary>
5531 </indexterm>
5532 <indexterm role="concept">
5533 <primary>message</primary>
5534 <secondary>adding recipients</secondary>
5535 </indexterm>
5536 <indexterm role="concept">
5537 <primary>recipient</primary>
5538 <secondary>adding</secondary>
5539 </indexterm>
5540 This option requests Exim to add the addresses to the list of recipients of the
5541 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5542 id, and the remaining ones must be email addresses. However, if the message is
5543 active (in the middle of a delivery attempt), it is not altered. This option
5544 can be used only by an admin user.
5545 </para>
5546 </listitem></varlistentry>
5547 <varlistentry>
5548 <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>
5549 <listitem>
5550 <para>
5551 <indexterm role="option">
5552 <primary><option>-MC</option></primary>
5553 </indexterm>
5554 <indexterm role="concept">
5555 <primary>SMTP</primary>
5556 <secondary>passed connection</secondary>
5557 </indexterm>
5558 <indexterm role="concept">
5559 <primary>SMTP</primary>
5560 <secondary>multiple deliveries</secondary>
5561 </indexterm>
5562 <indexterm role="concept">
5563 <primary>multiple SMTP deliveries</primary>
5564 </indexterm>
5565 This option is not intended for use by external callers. It is used internally
5566 by Exim to invoke another instance of itself to deliver a waiting message using
5567 an existing SMTP connection, which is passed as the standard input. Details are
5568 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5569 must be root or the Exim user in order to use it.
5570 </para>
5571 </listitem></varlistentry>
5572 <varlistentry>
5573 <term><option>-MCA</option></term>
5574 <listitem>
5575 <para>
5576 <indexterm role="option">
5577 <primary><option>-MCA</option></primary>
5578 </indexterm>
5579 This option is not intended for use by external callers. It is used internally
5580 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5581 connection to the remote host has been authenticated.
5582 </para>
5583 </listitem></varlistentry>
5584 <varlistentry>
5585 <term><option>-MCD</option></term>
5586 <listitem>
5587 <para>
5588 <indexterm role="option">
5589 <primary><option>-MCD</option></primary>
5590 </indexterm>
5591 This option is not intended for use by external callers. It is used internally
5592 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5593 remote host supports the ESMTP <filename>DSN</filename> extension.
5594 </para>
5595 </listitem></varlistentry>
5596 <varlistentry>
5597 <term><option>-MCG</option></term>
5598 <listitem>
5599 <para>
5600 <indexterm role="option">
5601 <primary><option>-MCG</option></primary>
5602 </indexterm>
5603 This option is not intended for use by external callers. It is used internally
5604 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5605 alternate queue is used, named by the following option.
5606 </para>
5607 </listitem></varlistentry>
5608 <varlistentry>
5609 <term><option>-MCP</option></term>
5610 <listitem>
5611 <para>
5612 <indexterm role="option">
5613 <primary><option>-MCP</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. It signifies that the server to
5617 which Exim is connected supports pipelining.
5618 </para>
5619 </listitem></varlistentry>
5620 <varlistentry>
5621 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5622 <listitem>
5623 <para>
5624 <indexterm role="option">
5625 <primary><option>-MCQ</option></primary>
5626 </indexterm>
5627 This option is not intended for use by external callers. It is used internally
5628 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5629 started by a queue runner. It passes on the process id of the queue runner,
5630 together with the file descriptor number of an open pipe. Closure of the pipe
5631 signals the final completion of the sequence of processes that are passing
5632 messages through the same SMTP connection.
5633 </para>
5634 </listitem></varlistentry>
5635 <varlistentry>
5636 <term><option>-MCS</option></term>
5637 <listitem>
5638 <para>
5639 <indexterm role="option">
5640 <primary><option>-MCS</option></primary>
5641 </indexterm>
5642 This option is not intended for use by external callers. It is used internally
5643 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5644 SMTP SIZE option should be used on messages delivered down the existing
5645 connection.
5646 </para>
5647 </listitem></varlistentry>
5648 <varlistentry>
5649 <term><option>-MCT</option></term>
5650 <listitem>
5651 <para>
5652 <indexterm role="option">
5653 <primary><option>-MCT</option></primary>
5654 </indexterm>
5655 This option is not intended for use by external callers. It is used internally
5656 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5657 host to which Exim is connected supports TLS encryption.
5658 </para>
5659 </listitem></varlistentry>
5660 <varlistentry>
5661 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5662 <listitem>
5663 <para>
5664 <indexterm role="option">
5665 <primary><option>-Mc</option></primary>
5666 </indexterm>
5667 <indexterm role="concept">
5668 <primary>hints database</primary>
5669 <secondary>not overridden by <option>-Mc</option></secondary>
5670 </indexterm>
5671 <indexterm role="concept">
5672 <primary>delivery</primary>
5673 <secondary>manually started &ndash; not forced</secondary>
5674 </indexterm>
5675 This option requests Exim to run a delivery attempt on each message in turn,
5676 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5677 that are found. This option is not very useful to external callers. It is
5678 provided mainly for internal use by Exim when it needs to re-invoke itself in
5679 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5680 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5681 respects retry times and other options such as <option>hold_domains</option> that are
5682 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5683 If you want to run a specific delivery as if in a queue run, you should use
5684 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5685 and other deliveries is made in one or two places.
5686 </para>
5687 </listitem></varlistentry>
5688 <varlistentry>
5689 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5690 <listitem>
5691 <para>
5692 <indexterm role="option">
5693 <primary><option>-Mes</option></primary>
5694 </indexterm>
5695 <indexterm role="concept">
5696 <primary>message</primary>
5697 <secondary>changing sender</secondary>
5698 </indexterm>
5699 <indexterm role="concept">
5700 <primary>sender</primary>
5701 <secondary>changing</secondary>
5702 </indexterm>
5703 This option requests Exim to change the sender address in the message to the
5704 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5705 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5706 be a message id, and the second one an email address. However, if the message
5707 is active (in the middle of a delivery attempt), its status is not altered.
5708 This option can be used only by an admin user.
5709 </para>
5710 </listitem></varlistentry>
5711 <varlistentry>
5712 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5713 <listitem>
5714 <para>
5715 <indexterm role="option">
5716 <primary><option>-Mf</option></primary>
5717 </indexterm>
5718 <indexterm role="concept">
5719 <primary>freezing messages</primary>
5720 </indexterm>
5721 <indexterm role="concept">
5722 <primary>message</primary>
5723 <secondary>manually freezing</secondary>
5724 </indexterm>
5725 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5726 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5727 either manually or as a result of the <option>auto_thaw</option> configuration option.
5728 However, if any of the messages are active (in the middle of a delivery
5729 attempt), their status is not altered. This option can be used only by an admin
5730 user.
5731 </para>
5732 </listitem></varlistentry>
5733 <varlistentry>
5734 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5735 <listitem>
5736 <para>
5737 <indexterm role="option">
5738 <primary><option>-Mg</option></primary>
5739 </indexterm>
5740 <indexterm role="concept">
5741 <primary>giving up on messages</primary>
5742 </indexterm>
5743 <indexterm role="concept">
5744 <primary>message</primary>
5745 <secondary>abandoning delivery attempts</secondary>
5746 </indexterm>
5747 <indexterm role="concept">
5748 <primary>delivery</primary>
5749 <secondary>abandoning further attempts</secondary>
5750 </indexterm>
5751 This option requests Exim to give up trying to deliver the listed messages,
5752 including any that are frozen. However, if any of the messages are active,
5753 their status is not altered. For non-bounce messages, a delivery error message
5754 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5755 Bounce messages are just discarded. This option can be used only by an admin
5756 user.
5757 </para>
5758 </listitem></varlistentry>
5759 <varlistentry>
5760 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5761 <listitem>
5762 <para>
5763 <indexterm role="option">
5764 <primary><option>-Mmad</option></primary>
5765 </indexterm>
5766 <indexterm role="concept">
5767 <primary>delivery</primary>
5768 <secondary>cancelling all</secondary>
5769 </indexterm>
5770 This option requests Exim to mark all the recipient addresses in the messages
5771 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5772 message is active (in the middle of a delivery attempt), its status is not
5773 altered. This option can be used only by an admin user.
5774 </para>
5775 </listitem></varlistentry>
5776 <varlistentry>
5777 <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>
5778 <listitem>
5779 <para>
5780 <indexterm role="option">
5781 <primary><option>-Mmd</option></primary>
5782 </indexterm>
5783 <indexterm role="concept">
5784 <primary>delivery</primary>
5785 <secondary>cancelling by address</secondary>
5786 </indexterm>
5787 <indexterm role="concept">
5788 <primary>recipient</primary>
5789 <secondary>removing</secondary>
5790 </indexterm>
5791 <indexterm role="concept">
5792 <primary>removing recipients</primary>
5793 </indexterm>
5794 This option requests Exim to mark the given addresses as already delivered
5795 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5796 the remaining ones must be email addresses. These are matched to recipient
5797 addresses in the message in a case-sensitive manner. If the message is active
5798 (in the middle of a delivery attempt), its status is not altered. This option
5799 can be used only by an admin user.
5800 </para>
5801 </listitem></varlistentry>
5802 <varlistentry>
5803 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5804 <listitem>
5805 <para>
5806 <indexterm role="option">
5807 <primary><option>-Mrm</option></primary>
5808 </indexterm>
5809 <indexterm role="concept">
5810 <primary>removing messages</primary>
5811 </indexterm>
5812 <indexterm role="concept">
5813 <primary>abandoning mail</primary>
5814 </indexterm>
5815 <indexterm role="concept">
5816 <primary>message</primary>
5817 <secondary>manually discarding</secondary>
5818 </indexterm>
5819 This option requests Exim to remove the given messages from the queue. No
5820 bounce messages are sent; each message is simply forgotten. However, if any of
5821 the messages are active, their status is not altered. This option can be used
5822 only by an admin user or by the user who originally caused the message to be
5823 placed on the queue.
5824 </para>
5825 </listitem></varlistentry>
5826 <varlistentry>
5827 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5828 <listitem>
5829 <para>
5830 <indexterm role="option">
5831 <primary><option>-Mset</option></primary>
5832 </indexterm>
5833 <indexterm role="concept">
5834 <primary>testing</primary>
5835 <secondary>string expansion</secondary>
5836 </indexterm>
5837 <indexterm role="concept">
5838 <primary>expansion</primary>
5839 <secondary>testing</secondary>
5840 </indexterm>
5841 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5842 string expansions). Exim loads the given message from its spool before doing
5843 the test expansions, thus setting message-specific variables such as
5844 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5845 available. This feature is provided to make it easier to test expansions that
5846 make use of these variables. However, this option can be used only by an admin
5847 user. See also <option>-bem</option>.
5848 </para>
5849 </listitem></varlistentry>
5850 <varlistentry>
5851 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5852 <listitem>
5853 <para>
5854 <indexterm role="option">
5855 <primary><option>-Mt</option></primary>
5856 </indexterm>
5857 <indexterm role="concept">
5858 <primary>thawing messages</primary>
5859 </indexterm>
5860 <indexterm role="concept">
5861 <primary>unfreezing messages</primary>
5862 </indexterm>
5863 <indexterm role="concept">
5864 <primary>frozen messages</primary>
5865 <secondary>thawing</secondary>
5866 </indexterm>
5867 <indexterm role="concept">
5868 <primary>message</primary>
5869 <secondary>thawing frozen</secondary>
5870 </indexterm>
5871 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5872 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5873 messages are active, their status is not altered. This option can be used only
5874 by an admin user.
5875 </para>
5876 </listitem></varlistentry>
5877 <varlistentry>
5878 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5879 <listitem>
5880 <para>
5881 <indexterm role="option">
5882 <primary><option>-Mvb</option></primary>
5883 </indexterm>
5884 <indexterm role="concept">
5885 <primary>listing</primary>
5886 <secondary>message body</secondary>
5887 </indexterm>
5888 <indexterm role="concept">
5889 <primary>message</primary>
5890 <secondary>listing body of</secondary>
5891 </indexterm>
5892 This option causes the contents of the message body (-D) spool file to be
5893 written to the standard output. This option can be used only by an admin user.
5894 </para>
5895 </listitem></varlistentry>
5896 <varlistentry>
5897 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5898 <listitem>
5899 <para>
5900 <indexterm role="option">
5901 <primary><option>-Mvc</option></primary>
5902 </indexterm>
5903 <indexterm role="concept">
5904 <primary>message</primary>
5905 <secondary>listing in RFC 2822 format</secondary>
5906 </indexterm>
5907 <indexterm role="concept">
5908 <primary>listing</primary>
5909 <secondary>message in RFC 2822 format</secondary>
5910 </indexterm>
5911 This option causes a copy of the complete message (header lines plus body) to
5912 be written to the standard output in RFC 2822 format. This option can be used
5913 only by an admin user.
5914 </para>
5915 </listitem></varlistentry>
5916 <varlistentry>
5917 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5918 <listitem>
5919 <para>
5920 <indexterm role="option">
5921 <primary><option>-Mvh</option></primary>
5922 </indexterm>
5923 <indexterm role="concept">
5924 <primary>listing</primary>
5925 <secondary>message headers</secondary>
5926 </indexterm>
5927 <indexterm role="concept">
5928 <primary>header lines</primary>
5929 <secondary>listing</secondary>
5930 </indexterm>
5931 <indexterm role="concept">
5932 <primary>message</primary>
5933 <secondary>listing header lines</secondary>
5934 </indexterm>
5935 This option causes the contents of the message headers (-H) spool file to be
5936 written to the standard output. This option can be used only by an admin user.
5937 </para>
5938 </listitem></varlistentry>
5939 <varlistentry>
5940 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5941 <listitem>
5942 <para>
5943 <indexterm role="option">
5944 <primary><option>-Mvl</option></primary>
5945 </indexterm>
5946 <indexterm role="concept">
5947 <primary>listing</primary>
5948 <secondary>message log</secondary>
5949 </indexterm>
5950 <indexterm role="concept">
5951 <primary>message</primary>
5952 <secondary>listing message log</secondary>
5953 </indexterm>
5954 This option causes the contents of the message log spool file to be written to
5955 the standard output. This option can be used only by an admin user.
5956 </para>
5957 </listitem></varlistentry>
5958 <varlistentry>
5959 <term><option>-m</option></term>
5960 <listitem>
5961 <para>
5962 <indexterm role="option">
5963 <primary><option>-m</option></primary>
5964 </indexterm>
5965 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5966 treats it that way too.
5967 </para>
5968 </listitem></varlistentry>
5969 <varlistentry>
5970 <term><option>-N</option></term>
5971 <listitem>
5972 <para>
5973 <indexterm role="option">
5974 <primary><option>-N</option></primary>
5975 </indexterm>
5976 <indexterm role="concept">
5977 <primary>debugging</primary>
5978 <secondary><option>-N</option> option</secondary>
5979 </indexterm>
5980 <indexterm role="concept">
5981 <primary>debugging</primary>
5982 <secondary>suppressing delivery</secondary>
5983 </indexterm>
5984 This is a debugging option that inhibits delivery of a message at the transport
5985 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5986 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5987 had successfully done so. However, it does not make any updates to the retry
5988 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5989 than <quote>=&gt;</quote>.
5990 </para>
5991 <para>
5992 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5993 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5994 words, an ordinary user can use it only when supplying an incoming message to
5995 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5996 address may be deferred because of a configuration problem on a transport, or a
5997 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5998 the message, and applies to any subsequent delivery attempts that may happen
5999 for that message.
6000 </para>
6001 </listitem></varlistentry>
6002 <varlistentry>
6003 <term><option>-n</option></term>
6004 <listitem>
6005 <para>
6006 <indexterm role="option">
6007 <primary><option>-n</option></primary>
6008 </indexterm>
6009 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6010 For normal modes of operation, it is ignored by Exim.
6011 When combined with <option>-bP</option> it makes the output more terse (suppresses
6012 option names, environment values and config pretty printing).
6013 </para>
6014 </listitem></varlistentry>
6015 <varlistentry>
6016 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6017 <listitem>
6018 <para>
6019 <indexterm role="option">
6020 <primary><option>-O</option></primary>
6021 </indexterm>
6022 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6023 Exim.
6024 </para>
6025 </listitem></varlistentry>
6026 <varlistentry>
6027 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6028 <listitem>
6029 <para>
6030 <indexterm role="option">
6031 <primary><option>-oA</option></primary>
6032 </indexterm>
6033 <indexterm role="concept">
6034 <primary>Sendmail compatibility</primary>
6035 <secondary><option>-oA</option> option</secondary>
6036 </indexterm>
6037 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6038 alternative alias file name. Exim handles <option>-bi</option> differently; see the
6039 description above.
6040 </para>
6041 </listitem></varlistentry>
6042 <varlistentry>
6043 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6044 <listitem>
6045 <para>
6046 <indexterm role="option">
6047 <primary><option>-oB</option></primary>
6048 </indexterm>
6049 <indexterm role="concept">
6050 <primary>SMTP</primary>
6051 <secondary>passed connection</secondary>
6052 </indexterm>
6053 <indexterm role="concept">
6054 <primary>SMTP</primary>
6055 <secondary>multiple deliveries</secondary>
6056 </indexterm>
6057 <indexterm role="concept">
6058 <primary>multiple SMTP deliveries</primary>
6059 </indexterm>
6060 This is a debugging option which limits the maximum number of messages that can
6061 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6062 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6063 </para>
6064 </listitem></varlistentry>
6065 <varlistentry>
6066 <term><option>-odb</option></term>
6067 <listitem>
6068 <para>
6069 <indexterm role="option">
6070 <primary><option>-odb</option></primary>
6071 </indexterm>
6072 <indexterm role="concept">
6073 <primary>background delivery</primary>
6074 </indexterm>
6075 <indexterm role="concept">
6076 <primary>delivery</primary>
6077 <secondary>in the background</secondary>
6078 </indexterm>
6079 This option applies to all modes in which Exim accepts incoming messages,
6080 including the listening daemon. It requests <quote>background</quote> delivery of such
6081 messages, which means that the accepting process automatically starts a
6082 delivery process for each message received, but does not wait for the delivery
6083 processes to finish.
6084 </para>
6085 <para>
6086 When all the messages have been received, the reception process exits,
6087 leaving the delivery processes to finish in their own time. The standard output
6088 and error streams are closed at the start of each delivery process.
6089 This is the default action if none of the <option>-od</option> options are present.
6090 </para>
6091 <para>
6092 If one of the queueing options in the configuration file
6093 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6094 overrides it if <option>queue_only_override</option> is set true, which is the default
6095 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6096 </para>
6097 </listitem></varlistentry>
6098 <varlistentry>
6099 <term><option>-odf</option></term>
6100 <listitem>
6101 <para>
6102 <indexterm role="option">
6103 <primary><option>-odf</option></primary>
6104 </indexterm>
6105 <indexterm role="concept">
6106 <primary>foreground delivery</primary>
6107 </indexterm>
6108 <indexterm role="concept">
6109 <primary>delivery</primary>
6110 <secondary>in the foreground</secondary>
6111 </indexterm>
6112 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6113 accepted a locally-generated message. (For the daemon it is exactly the same as
6114 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6115 and Exim waits for it to complete before proceeding.
6116 </para>
6117 <para>
6118 The original Exim reception process does not finish until the delivery
6119 process for the final message has ended. The standard error stream is left open
6120 during deliveries.
6121 </para>
6122 <para>
6123 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6124 false and one of the queueing options in the configuration file is in effect.
6125 </para>
6126 <para>
6127 If there is a temporary delivery error during foreground delivery, the
6128 message is left on the queue for later delivery, and the original reception
6129 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6130 restricted configuration that never queues messages.
6131 </para>
6132 </listitem></varlistentry>
6133 <varlistentry>
6134 <term><option>-odi</option></term>
6135 <listitem>
6136 <para>
6137 <indexterm role="option">
6138 <primary><option>-odi</option></primary>
6139 </indexterm>
6140 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6141 Sendmail.
6142 </para>
6143 </listitem></varlistentry>
6144 <varlistentry>
6145 <term><option>-odq</option></term>
6146 <listitem>
6147 <para>
6148 <indexterm role="option">
6149 <primary><option>-odq</option></primary>
6150 </indexterm>
6151 <indexterm role="concept">
6152 <primary>non-immediate delivery</primary>
6153 </indexterm>
6154 <indexterm role="concept">
6155 <primary>delivery</primary>
6156 <secondary>suppressing immediate</secondary>
6157 </indexterm>
6158 <indexterm role="concept">
6159 <primary>queueing incoming messages</primary>
6160 </indexterm>
6161 This option applies to all modes in which Exim accepts incoming messages,
6162 including the listening daemon. It specifies that the accepting process should
6163 not automatically start a delivery process for each message received. Messages
6164 are placed on the queue, and remain there until a subsequent queue runner
6165 process encounters them. There are several configuration options (such as
6166 <option>queue_only</option>) that can be used to queue incoming messages under certain
6167 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6168 forces queueing.
6169 </para>
6170 </listitem></varlistentry>
6171 <varlistentry>
6172 <term><option>-odqs</option></term>
6173 <listitem>
6174 <para>
6175 <indexterm role="option">
6176 <primary><option>-odqs</option></primary>
6177 </indexterm>
6178 <indexterm role="concept">
6179 <primary>SMTP</primary>
6180 <secondary>delaying delivery</secondary>
6181 </indexterm>
6182 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6183 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6184 <option>queue_only_override</option> is false and one of the queueing options in the
6185 configuration file is in effect.
6186 </para>
6187 <para>
6188 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6189 message, in the background by default, but in the foreground if <option>-odi</option> is
6190 also present. The recipient addresses are routed, and local deliveries are done
6191 in the normal way. However, if any SMTP deliveries are required, they are not
6192 done at this time, so the message remains on the queue until a subsequent queue
6193 runner process encounters it. Because routing was done, Exim knows which
6194 messages are waiting for which hosts, and so a number of messages for the same
6195 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6196 configuration option has the same effect for specific domains. See also the
6197 <option>-qq</option> option.
6198 </para>
6199 </listitem></varlistentry>
6200 <varlistentry>
6201 <term><option>-oee</option></term>
6202 <listitem>
6203 <para>
6204 <indexterm role="option">
6205 <primary><option>-oee</option></primary>
6206 </indexterm>
6207 <indexterm role="concept">
6208 <primary>error</primary>
6209 <secondary>reporting</secondary>
6210 </indexterm>
6211 If an error is detected while a non-SMTP message is being received (for
6212 example, a malformed address), the error is reported to the sender in a mail
6213 message.
6214 </para>
6215 <para>
6216 <indexterm role="concept">
6217 <primary>return code</primary>
6218 <secondary>for <option>-oee</option></secondary>
6219 </indexterm>
6220 Provided
6221 this error message is successfully sent, the Exim receiving process
6222 exits with a return code of zero. If not, the return code is 2 if the problem
6223 is that the original message has no recipients, or 1 for any other error.
6224 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6225 </para>
6226 </listitem></varlistentry>
6227 <varlistentry>
6228 <term><option>-oem</option></term>
6229 <listitem>
6230 <para>
6231 <indexterm role="option">
6232 <primary><option>-oem</option></primary>
6233 </indexterm>
6234 <indexterm role="concept">
6235 <primary>error</primary>
6236 <secondary>reporting</secondary>
6237 </indexterm>
6238 <indexterm role="concept">
6239 <primary>return code</primary>
6240 <secondary>for <option>-oem</option></secondary>
6241 </indexterm>
6242 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6243 return code, whether or not the error message was successfully sent.
6244 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6245 </para>
6246 </listitem></varlistentry>
6247 <varlistentry>
6248 <term><option>-oep</option></term>
6249 <listitem>
6250 <para>
6251 <indexterm role="option">
6252 <primary><option>-oep</option></primary>
6253 </indexterm>
6254 <indexterm role="concept">
6255 <primary>error</primary>
6256 <secondary>reporting</secondary>
6257 </indexterm>
6258 If an error is detected while a non-SMTP message is being received, the
6259 error is reported by writing a message to the standard error file (stderr).
6260 <indexterm role="concept">
6261 <primary>return code</primary>
6262 <secondary>for <option>-oep</option></secondary>
6263 </indexterm>
6264 The return code is 1 for all errors.
6265 </para>
6266 </listitem></varlistentry>
6267 <varlistentry>
6268 <term><option>-oeq</option></term>
6269 <listitem>
6270 <para>
6271 <indexterm role="option">
6272 <primary><option>-oeq</option></primary>
6273 </indexterm>
6274 <indexterm role="concept">
6275 <primary>error</primary>
6276 <secondary>reporting</secondary>
6277 </indexterm>
6278 This option is supported for compatibility with Sendmail, but has the same
6279 effect as <option>-oep</option>.
6280 </para>
6281 </listitem></varlistentry>
6282 <varlistentry>
6283 <term><option>-oew</option></term>
6284 <listitem>
6285 <para>
6286 <indexterm role="option">
6287 <primary><option>-oew</option></primary>
6288 </indexterm>
6289 <indexterm role="concept">
6290 <primary>error</primary>
6291 <secondary>reporting</secondary>
6292 </indexterm>
6293 This option is supported for compatibility with Sendmail, but has the same
6294 effect as <option>-oem</option>.
6295 </para>
6296 </listitem></varlistentry>
6297 <varlistentry>
6298 <term><option>-oi</option></term>
6299 <listitem>
6300 <para>
6301 <indexterm role="option">
6302 <primary><option>-oi</option></primary>
6303 </indexterm>
6304 <indexterm role="concept">
6305 <primary>dot</primary>
6306 <secondary>in incoming non-SMTP message</secondary>
6307 </indexterm>
6308 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6309 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6310 single dot does terminate, though Exim does no special processing for other
6311 lines that start with a dot. This option is set by default if Exim is called as
6312 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6313 </para>
6314 </listitem></varlistentry>
6315 <varlistentry>
6316 <term><option>-oitrue</option></term>
6317 <listitem>
6318 <para>
6319 <indexterm role="option">
6320 <primary><option>-oitrue</option></primary>
6321 </indexterm>
6322 This option is treated as synonymous with <option>-oi</option>.
6323 </para>
6324 </listitem></varlistentry>
6325 <varlistentry>
6326 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6327 <listitem>
6328 <para>
6329 <indexterm role="option">
6330 <primary><option>-oMa</option></primary>
6331 </indexterm>
6332 <indexterm role="concept">
6333 <primary>sender</primary>
6334 <secondary>host address, specifying for local message</secondary>
6335 </indexterm>
6336 A number of options starting with <option>-oM</option> can be used to set values associated
6337 with remote hosts on locally-submitted messages (that is, messages not received
6338 over TCP/IP). These options can be used by any caller in conjunction with the
6339 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6340 other circumstances, they are ignored unless the caller is trusted.
6341 </para>
6342 <para>
6343 The <option>-oMa</option> option sets the sender host address. This may include a port
6344 number at the end, after a full stop (period). For example:
6345 </para>
6346 <literallayout class="monospaced">
6347 exim -bs -oMa 10.9.8.7.1234
6348 </literallayout>
6349 <para>
6350 An alternative syntax is to enclose the IP address in square brackets,
6351 followed by a colon and the port number:
6352 </para>
6353 <literallayout class="monospaced">
6354 exim -bs -oMa [10.9.8.7]:1234
6355 </literallayout>
6356 <para>
6357 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6358 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6359 are present on the command line, the sender host IP address is taken from
6360 whichever one is last.
6361 </para>
6362 </listitem></varlistentry>
6363 <varlistentry>
6364 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6365 <listitem>
6366 <para>
6367 <indexterm role="option">
6368 <primary><option>-oMaa</option></primary>
6369 </indexterm>
6370 <indexterm role="concept">
6371 <primary>authentication</primary>
6372 <secondary>name, specifying for local message</secondary>
6373 </indexterm>
6374 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6375 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6376 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6377 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6378 authenticated SMTP session without actually using the SMTP AUTH command.
6379 </para>
6380 </listitem></varlistentry>
6381 <varlistentry>
6382 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6383 <listitem>
6384 <para>
6385 <indexterm role="option">
6386 <primary><option>-oMai</option></primary>
6387 </indexterm>
6388 <indexterm role="concept">
6389 <primary>authentication</primary>
6390 <secondary>id, specifying for local message</secondary>
6391 </indexterm>
6392 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6393 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6394 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6395 where there is no default) for messages from local sources. See chapter
6396 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6397 </para>
6398 </listitem></varlistentry>
6399 <varlistentry>
6400 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6401 <listitem>
6402 <para>
6403 <indexterm role="option">
6404 <primary><option>-oMas</option></primary>
6405 </indexterm>
6406 <indexterm role="concept">
6407 <primary>authentication</primary>
6408 <secondary>sender, specifying for local message</secondary>
6409 </indexterm>
6410 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6411 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6412 overrides the sender address that is created from the caller&#x2019;s login id for
6413 messages from local sources, except when <option>-bh</option> is used, when there is no
6414 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6415 specified on a MAIL command overrides this value. See chapter
6416 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6417 </para>
6418 </listitem></varlistentry>
6419 <varlistentry>
6420 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6421 <listitem>
6422 <para>
6423 <indexterm role="option">
6424 <primary><option>-oMi</option></primary>
6425 </indexterm>
6426 <indexterm role="concept">
6427 <primary>interface</primary>
6428 <secondary>address, specifying for local message</secondary>
6429 </indexterm>
6430 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6431 option sets the IP interface address value. A port number may be included,
6432 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6433 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6434 </para>
6435 </listitem></varlistentry>
6436 <varlistentry>
6437 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6438 <listitem>
6439 <para>
6440 <indexterm role="option">
6441 <primary><option>-oMm</option></primary>
6442 </indexterm>
6443 <indexterm role="concept">
6444 <primary>message reference</primary>
6445 <secondary>message reference, specifying for local message</secondary>
6446 </indexterm>
6447 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6448 option sets the message reference, e.g. message-id, and is logged during
6449 delivery. This is useful when some kind of audit trail is required to tie
6450 messages together. The format of the message reference is checked and will
6451 abort if the format is invalid. The option will only be accepted if exim is
6452 running in trusted mode, not as any regular user.
6453 </para>
6454 <para>
6455 The best example of a message reference is when Exim sends a bounce message.
6456 The message reference is the message-id of the original message for which Exim
6457 is sending the bounce.
6458 </para>
6459 </listitem></varlistentry>
6460 <varlistentry>
6461 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6462 <listitem>
6463 <para>
6464 <indexterm role="option">
6465 <primary><option>-oMr</option></primary>
6466 </indexterm>
6467 <indexterm role="concept">
6468 <primary>protocol, specifying for local message</primary>
6469 </indexterm>
6470 <indexterm role="variable">
6471 <primary><varname>$received_protocol</varname></primary>
6472 </indexterm>
6473 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6474 option sets the received protocol value that is stored in
6475 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6476 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6477 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6478 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6479 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6480 be set by <option>-oMr</option>. Repeated use of this option is not supported.
6481 </para>
6482 </listitem></varlistentry>
6483 <varlistentry>
6484 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6485 <listitem>
6486 <para>
6487 <indexterm role="option">
6488 <primary><option>-oMs</option></primary>
6489 </indexterm>
6490 <indexterm role="concept">
6491 <primary>sender</primary>
6492 <secondary>host name, specifying for local message</secondary>
6493 </indexterm>
6494 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6495 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6496 present, Exim does not attempt to look up a host name from an IP address; it
6497 uses the name it is given.
6498 </para>
6499 </listitem></varlistentry>
6500 <varlistentry>
6501 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6502 <listitem>
6503 <para>
6504 <indexterm role="option">
6505 <primary><option>-oMt</option></primary>
6506 </indexterm>
6507 <indexterm role="concept">
6508 <primary>sender</primary>
6509 <secondary>ident string, specifying for local message</secondary>
6510 </indexterm>
6511 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6512 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6513 local callers is the login id of the calling process, except when <option>-bh</option> is
6514 used, when there is no default.
6515 </para>
6516 </listitem></varlistentry>
6517 <varlistentry>
6518 <term><option>-om</option></term>
6519 <listitem>
6520 <para>
6521 <indexterm role="option">
6522 <primary><option>-om</option></primary>
6523 </indexterm>
6524 <indexterm role="concept">
6525 <primary>Sendmail compatibility</primary>
6526 <secondary><option>-om</option> option ignored</secondary>
6527 </indexterm>
6528 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6529 message should receive a copy of the message if the sender appears in an alias
6530 expansion. Exim always does this, so the option does nothing.
6531 </para>
6532 </listitem></varlistentry>
6533 <varlistentry>
6534 <term><option>-oo</option></term>
6535 <listitem>
6536 <para>
6537 <indexterm role="option">
6538 <primary><option>-oo</option></primary>
6539 </indexterm>
6540 <indexterm role="concept">
6541 <primary>Sendmail compatibility</primary>
6542 <secondary><option>-oo</option> option ignored</secondary>
6543 </indexterm>
6544 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6545 whatever that means.
6546 </para>
6547 </listitem></varlistentry>
6548 <varlistentry>
6549 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6550 <listitem>
6551 <para>
6552 <indexterm role="option">
6553 <primary><option>-oP</option></primary>
6554 </indexterm>
6555 <indexterm role="concept">
6556 <primary>pid (process id)</primary>
6557 <secondary>of daemon</secondary>
6558 </indexterm>
6559 <indexterm role="concept">
6560 <primary>daemon</primary>
6561 <secondary>process id (pid)</secondary>
6562 </indexterm>
6563 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6564 value. The option specifies the file to which the process id of the daemon is
6565 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6566 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6567 because in those cases, the normal pid file is not used.
6568 </para>
6569 </listitem></varlistentry>
6570 <varlistentry>
6571 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6572 <listitem>
6573 <para>
6574 <indexterm role="option">
6575 <primary><option>-or</option></primary>
6576 </indexterm>
6577 <indexterm role="concept">
6578 <primary>timeout</primary>
6579 <secondary>for non-SMTP input</secondary>
6580 </indexterm>
6581 This option sets a timeout value for incoming non-SMTP messages. If it is not
6582 set, Exim will wait forever for the standard input. The value can also be set
6583 by the <option>receive_timeout</option> option. The format used for specifying times is
6584 described in section <xref linkend="SECTtimeformat"/>.
6585 </para>
6586 </listitem></varlistentry>
6587 <varlistentry>
6588 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6589 <listitem>
6590 <para>
6591 <indexterm role="option">
6592 <primary><option>-os</option></primary>
6593 </indexterm>
6594 <indexterm role="concept">
6595 <primary>timeout</primary>
6596 <secondary>for SMTP input</secondary>
6597 </indexterm>
6598 <indexterm role="concept">
6599 <primary>SMTP</primary>
6600 <secondary>input timeout</secondary>
6601 </indexterm>
6602 This option sets a timeout value for incoming SMTP messages. The timeout
6603 applies to each SMTP command and block of data. The value can also be set by
6604 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6605 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6606 </para>
6607 </listitem></varlistentry>
6608 <varlistentry>
6609 <term><option>-ov</option></term>
6610 <listitem>
6611 <para>
6612 <indexterm role="option">
6613 <primary><option>-ov</option></primary>
6614 </indexterm>
6615 This option has exactly the same effect as <option>-v</option>.
6616 </para>
6617 </listitem></varlistentry>
6618 <varlistentry>
6619 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6620 <listitem>
6621 <para>
6622 <indexterm role="option">
6623 <primary><option>-oX</option></primary>
6624 </indexterm>
6625 <indexterm role="concept">
6626 <primary>TCP/IP</primary>
6627 <secondary>setting listening ports</secondary>
6628 </indexterm>
6629 <indexterm role="concept">
6630 <primary>TCP/IP</primary>
6631 <secondary>setting listening interfaces</secondary>
6632 </indexterm>
6633 <indexterm role="concept">
6634 <primary>port</primary>
6635 <secondary>receiving TCP/IP</secondary>
6636 </indexterm>
6637 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6638 is also given. It controls which ports and interfaces the daemon uses. Details
6639 of the syntax, and how it interacts with configuration file options, are given
6640 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6641 file is written unless <option>-oP</option> is also present to specify a pid file name.
6642 </para>
6643 </listitem></varlistentry>
6644 <varlistentry>
6645 <term><option>-pd</option></term>
6646 <listitem>
6647 <para>
6648 <indexterm role="option">
6649 <primary><option>-pd</option></primary>
6650 </indexterm>
6651 <indexterm role="concept">
6652 <primary>Perl</primary>
6653 <secondary>starting the interpreter</secondary>
6654 </indexterm>
6655 This option applies when an embedded Perl interpreter is linked with Exim (see
6656 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6657 option, forcing the starting of the interpreter to be delayed until it is
6658 needed.
6659 </para>
6660 </listitem></varlistentry>
6661 <varlistentry>
6662 <term><option>-ps</option></term>
6663 <listitem>
6664 <para>
6665 <indexterm role="option">
6666 <primary><option>-ps</option></primary>
6667 </indexterm>
6668 <indexterm role="concept">
6669 <primary>Perl</primary>
6670 <secondary>starting the interpreter</secondary>
6671 </indexterm>
6672 This option applies when an embedded Perl interpreter is linked with Exim (see
6673 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6674 option, forcing the starting of the interpreter to occur as soon as Exim is
6675 started.
6676 </para>
6677 </listitem></varlistentry>
6678 <varlistentry>
6679 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6680 <listitem>
6681 <para>
6682 <indexterm role="option">
6683 <primary><option>-p</option></primary>
6684 </indexterm>
6685 For compatibility with Sendmail, this option is equivalent to
6686 </para>
6687 <literallayout>
6688 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6689 </literallayout>
6690 <para>
6691 It sets the incoming protocol and host name (for trusted callers). The
6692 host name and its colon can be omitted when only the protocol is to be set.
6693 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6694 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6695 or <literal>s</literal> using this option (but that does not seem a real limitation).
6696 Repeated use of this option is not supported.
6697 </para>
6698 </listitem></varlistentry>
6699 <varlistentry>
6700 <term><option>-q</option></term>
6701 <listitem>
6702 <para>
6703 <indexterm role="option">
6704 <primary><option>-q</option></primary>
6705 </indexterm>
6706 <indexterm role="concept">
6707 <primary>queue runner</primary>
6708 <secondary>starting manually</secondary>
6709 </indexterm>
6710 This option is normally restricted to admin users. However, there is a
6711 configuration option called <option>prod_requires_admin</option> which can be set false to
6712 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6713 and <option>-S</option> options).
6714 </para>
6715 <para>
6716 <indexterm role="concept">
6717 <primary>queue runner</primary>
6718 <secondary>description of operation</secondary>
6719 </indexterm>
6720 If other commandline options do not specify an action,
6721 the <option>-q</option> option starts one queue runner process. This scans the queue of
6722 waiting messages, and runs a delivery process for each one in turn. It waits
6723 for each delivery process to finish before starting the next one. A delivery
6724 process may not actually do any deliveries if the retry times for the addresses
6725 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6726 </para>
6727 <para>
6728 If
6729 <indexterm role="concept">
6730 <primary>SMTP</primary>
6731 <secondary>passed connection</secondary>
6732 </indexterm>
6733 <indexterm role="concept">
6734 <primary>SMTP</primary>
6735 <secondary>multiple deliveries</secondary>
6736 </indexterm>
6737 <indexterm role="concept">
6738 <primary>multiple SMTP deliveries</primary>
6739 </indexterm>
6740 the delivery process spawns other processes to deliver other messages down
6741 passed SMTP connections, the queue runner waits for these to finish before
6742 proceeding.
6743 </para>
6744 <para>
6745 When all the queued messages have been considered, the original queue runner
6746 process terminates. In other words, a single pass is made over the waiting
6747 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6748 this to be repeated periodically.
6749 </para>
6750 <para>
6751 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6752 random, but it is likely to be different each time, which is all that matters.
6753 If one particular message screws up a remote MTA, other messages to the same
6754 MTA have a chance of getting through if they get tried first.
6755 </para>
6756 <para>
6757 It is possible to cause the messages to be processed in lexical message id
6758 order, which is essentially the order in which they arrived, by setting the
6759 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6760 </para>
6761 </listitem></varlistentry>
6762 <varlistentry>
6763 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6764 <listitem>
6765 <para>
6766 The <option>-q</option> option may be followed by one or more flag letters that change its
6767 behaviour. They are all optional, but if more than one is present, they must
6768 appear in the correct order. Each flag is described in a separate item below.
6769 </para>
6770 </listitem></varlistentry>
6771 <varlistentry>
6772 <term><option>-qq...</option></term>
6773 <listitem>
6774 <para>
6775 <indexterm role="option">
6776 <primary><option>-qq</option></primary>
6777 </indexterm>
6778 <indexterm role="concept">
6779 <primary>queue</primary>
6780 <secondary>double scanning</secondary>
6781 </indexterm>
6782 <indexterm role="concept">
6783 <primary>queue</primary>
6784 <secondary>routing</secondary>
6785 </indexterm>
6786 <indexterm role="concept">
6787 <primary>routing</primary>
6788 <secondary>whole queue before delivery</secondary>
6789 </indexterm>
6790 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6791 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6792 every domain. Addresses are routed, local deliveries happen, but no remote
6793 transports are run.
6794 </para>
6795 <para>
6796 <indexterm role="concept">
6797 <primary>hints database</primary>
6798 <secondary>remembering routing</secondary>
6799 </indexterm>
6800 The hints database that remembers which messages are waiting for specific hosts
6801 is updated, as if delivery to those hosts had been deferred. After this is
6802 complete, a second, normal queue scan happens, with routing and delivery taking
6803 place as normal. Messages that are routed to the same host should mostly be
6804 delivered down a single SMTP
6805 <indexterm role="concept">
6806 <primary>SMTP</primary>
6807 <secondary>passed connection</secondary>
6808 </indexterm>
6809 <indexterm role="concept">
6810 <primary>SMTP</primary>
6811 <secondary>multiple deliveries</secondary>
6812 </indexterm>
6813 <indexterm role="concept">
6814 <primary>multiple SMTP deliveries</primary>
6815 </indexterm>
6816 connection because of the hints that were set up during the first queue scan.
6817 This option may be useful for hosts that are connected to the Internet
6818 intermittently.
6819 </para>
6820 </listitem></varlistentry>
6821 <varlistentry>
6822 <term><option>-q[q]i...</option></term>
6823 <listitem>
6824 <para>
6825 <indexterm role="option">
6826 <primary><option>-qi</option></primary>
6827 </indexterm>
6828 <indexterm role="concept">
6829 <primary>queue</primary>
6830 <secondary>initial delivery</secondary>
6831 </indexterm>
6832 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6833 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6834 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6835 <option>-odq</option> and want a queue runner just to process the new messages.
6836 </para>
6837 </listitem></varlistentry>
6838 <varlistentry>
6839 <term><option>-q[q][i]f...</option></term>
6840 <listitem>
6841 <para>
6842 <indexterm role="option">
6843 <primary><option>-qf</option></primary>
6844 </indexterm>
6845 <indexterm role="concept">
6846 <primary>queue</primary>
6847 <secondary>forcing delivery</secondary>
6848 </indexterm>
6849 <indexterm role="concept">
6850 <primary>delivery</primary>
6851 <secondary>forcing in queue run</secondary>
6852 </indexterm>
6853 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6854 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6855 their retry times are tried.
6856 </para>
6857 </listitem></varlistentry>
6858 <varlistentry>
6859 <term><option>-q[q][i]ff...</option></term>
6860 <listitem>
6861 <para>
6862 <indexterm role="option">
6863 <primary><option>-qff</option></primary>
6864 </indexterm>
6865 <indexterm role="concept">
6866 <primary>frozen messages</primary>
6867 <secondary>forcing delivery</secondary>
6868 </indexterm>
6869 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6870 frozen or not.
6871 </para>
6872 </listitem></varlistentry>
6873 <varlistentry>
6874 <term><option>-q[q][i][f[f]]l</option></term>
6875 <listitem>
6876 <para>
6877 <indexterm role="option">
6878 <primary><option>-ql</option></primary>
6879 </indexterm>
6880 <indexterm role="concept">
6881 <primary>queue</primary>
6882 <secondary>local deliveries only</secondary>
6883 </indexterm>
6884 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6885 be done. If a message requires any remote deliveries, it remains on the queue
6886 for later delivery.
6887 </para>
6888 </listitem></varlistentry>
6889 <varlistentry>
6890 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
6891 <listitem>
6892 <para>
6893 <indexterm role="option">
6894 <primary><option>-qG</option></primary>
6895 </indexterm>
6896 <indexterm role="concept">
6897 <primary>queue</primary>
6898 <secondary>named</secondary>
6899 </indexterm>
6900 <indexterm role="concept">
6901 <primary>named queues</primary>
6902 </indexterm>
6903 <indexterm role="concept">
6904 <primary>queue</primary>
6905 <secondary>delivering specific messages</secondary>
6906 </indexterm>
6907 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
6908 queue with the given name rather than the default queue.
6909 The name should not contain a <emphasis>/</emphasis> character.
6910 For a periodic queue run (see below)
6911 append to the name a slash and a time value.
6912 </para>
6913 <para>
6914 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
6915 will specify a queue to operate on.
6916 For example:
6917 </para>
6918 <literallayout class="monospaced">
6919 exim -bp -qGquarantine
6920 mailq -qGquarantine
6921 exim -qGoffpeak -Rf @special.domain.example
6922 </literallayout>
6923 </listitem></varlistentry>
6924 <varlistentry>
6925 <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>
6926 <listitem>
6927 <para>
6928 When scanning the queue, Exim can be made to skip over messages whose ids are
6929 lexically less than a given value by following the <option>-q</option> option with a
6930 starting message id. For example:
6931 </para>
6932 <literallayout class="monospaced">
6933 exim -q 0t5C6f-0000c8-00
6934 </literallayout>
6935 <para>
6936 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6937 second message id is given, messages whose ids are lexically greater than it
6938 are also skipped. If the same id is given twice, for example,
6939 </para>
6940 <literallayout class="monospaced">
6941 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6942 </literallayout>
6943 <para>
6944 just one delivery process is started, for that message. This differs from
6945 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6946 that it counts as a delivery from a queue run. Note that the selection
6947 mechanism does not affect the order in which the messages are scanned. There
6948 are also other ways of selecting specific sets of messages for delivery in a
6949 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6950 </para>
6951 </listitem></varlistentry>
6952 <varlistentry>
6953 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6954 <listitem>
6955 <para>
6956 <indexterm role="concept">
6957 <primary>queue runner</primary>
6958 <secondary>starting periodically</secondary>
6959 </indexterm>
6960 <indexterm role="concept">
6961 <primary>periodic queue running</primary>
6962 </indexterm>
6963 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6964 starting a queue runner process at intervals specified by the given time value
6965 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6966 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6967 single daemon process handles both functions. A common way of starting up a
6968 combined daemon at system boot time is to use a command such as
6969 </para>
6970 <literallayout class="monospaced">
6971 /usr/exim/bin/exim -bd -q30m
6972 </literallayout>
6973 <para>
6974 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6975 process every 30 minutes.
6976 </para>
6977 <para>
6978 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6979 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6980 </para>
6981 </listitem></varlistentry>
6982 <varlistentry>
6983 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6984 <listitem>
6985 <para>
6986 <indexterm role="option">
6987 <primary><option>-qR</option></primary>
6988 </indexterm>
6989 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6990 compatibility.
6991 </para>
6992 </listitem></varlistentry>
6993 <varlistentry>
6994 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6995 <listitem>
6996 <para>
6997 <indexterm role="option">
6998 <primary><option>-qS</option></primary>
6999 </indexterm>
7000 This option is synonymous with <option>-S</option>.
7001 </para>
7002 </listitem></varlistentry>
7003 <varlistentry>
7004 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7005 <listitem>
7006 <para>
7007 <indexterm role="option">
7008 <primary><option>-R</option></primary>
7009 </indexterm>
7010 <indexterm role="concept">
7011 <primary>queue runner</primary>
7012 <secondary>for specific recipients</secondary>
7013 </indexterm>
7014 <indexterm role="concept">
7015 <primary>delivery</primary>
7016 <secondary>to given domain</secondary>
7017 </indexterm>
7018 <indexterm role="concept">
7019 <primary>domain</primary>
7020 <secondary>delivery to</secondary>
7021 </indexterm>
7022 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7023 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7024 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7025 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7026 </para>
7027 <para>
7028 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7029 perform a single queue run, except that, when scanning the messages on the
7030 queue, Exim processes only those that have at least one undelivered recipient
7031 address containing the given string, which is checked in a case-independent
7032 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7033 regular expression; otherwise it is a literal string.
7034 </para>
7035 <para>
7036 If you want to do periodic queue runs for messages with specific recipients,
7037 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7038 </para>
7039 <literallayout class="monospaced">
7040 exim -q25m -R @special.domain.example
7041 </literallayout>
7042 <para>
7043 This example does a queue run for messages with recipients in the given domain
7044 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7045 applied to each queue run.
7046 </para>
7047 <para>
7048 Once a message is selected for delivery by this mechanism, all its addresses
7049 are processed. For the first selected message, Exim overrides any retry
7050 information and forces a delivery attempt for each undelivered address. This
7051 means that if delivery of any address in the first message is successful, any
7052 existing retry information is deleted, and so delivery attempts for that
7053 address in subsequently selected messages (which are processed without forcing)
7054 will run. However, if delivery of any address does not succeed, the retry
7055 information is updated, and in subsequently selected messages, the failing
7056 address will be skipped.
7057 </para>
7058 <para>
7059 <indexterm role="concept">
7060 <primary>frozen messages</primary>
7061 <secondary>forcing delivery</secondary>
7062 </indexterm>
7063 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7064 all selected messages, not just the first; frozen messages are included when
7065 <emphasis>ff</emphasis> is present.
7066 </para>
7067 <para>
7068 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7069 to a given domain after a host has been down for some time. When the SMTP
7070 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7071 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7072 an arbitrary command instead.
7073 </para>
7074 </listitem></varlistentry>
7075 <varlistentry>
7076 <term><option>-r</option></term>
7077 <listitem>
7078 <para>
7079 <indexterm role="option">
7080 <primary><option>-r</option></primary>
7081 </indexterm>
7082 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7083 </para>
7084 </listitem></varlistentry>
7085 <varlistentry>
7086 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7087 <listitem>
7088 <para>
7089 <indexterm role="option">
7090 <primary><option>-S</option></primary>
7091 </indexterm>
7092 <indexterm role="concept">
7093 <primary>delivery</primary>
7094 <secondary>from given sender</secondary>
7095 </indexterm>
7096 <indexterm role="concept">
7097 <primary>queue runner</primary>
7098 <secondary>for specific senders</secondary>
7099 </indexterm>
7100 This option acts like <option>-R</option> except that it checks the string against each
7101 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7102 conditions must be met for a message to be selected. If either of the options
7103 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7104 </para>
7105 </listitem></varlistentry>
7106 <varlistentry>
7107 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7108 <listitem>
7109 <para>
7110 <indexterm role="option">
7111 <primary><option>-Tqt</option></primary>
7112 </indexterm>
7113 This is an option that is exclusively for use by the Exim testing suite. It is not
7114 recognized when Exim is run normally. It allows for the setting up of explicit
7115 <quote>queue times</quote> so that various warning/retry features can be tested.
7116 </para>
7117 </listitem></varlistentry>
7118 <varlistentry>
7119 <term><option>-t</option></term>
7120 <listitem>
7121 <para>
7122 <indexterm role="option">
7123 <primary><option>-t</option></primary>
7124 </indexterm>
7125 <indexterm role="concept">
7126 <primary>recipient</primary>
7127 <secondary>extracting from header lines</secondary>
7128 </indexterm>
7129 <indexterm role="concept">
7130 <primary><emphasis>Bcc:</emphasis> header line</primary>
7131 </indexterm>
7132 <indexterm role="concept">
7133 <primary><emphasis>Cc:</emphasis> header line</primary>
7134 </indexterm>
7135 <indexterm role="concept">
7136 <primary><emphasis>To:</emphasis> header line</primary>
7137 </indexterm>
7138 When Exim is receiving a locally-generated, non-SMTP message on its standard
7139 input, the <option>-t</option> option causes the recipients of the message to be obtained
7140 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7141 from the command arguments. The addresses are extracted before any rewriting
7142 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7143 </para>
7144 <para>
7145 <indexterm role="concept">
7146 <primary>Sendmail compatibility</primary>
7147 <secondary><option>-t</option> option</secondary>
7148 </indexterm>
7149 If the command has any arguments, they specify addresses to which the message
7150 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7151 the recipients list obtained from the headers. This is compatible with Smail 3
7152 and in accordance with the documented behaviour of several versions of
7153 Sendmail, as described in man pages on a number of operating systems (e.g.
7154 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7155 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7156 Sendmail book documents it that way. Exim can be made to add argument addresses
7157 instead of subtracting them by setting the option
7158 <option>extract_addresses_remove_arguments</option> false.
7159 </para>
7160 <para>
7161 <indexterm role="concept">
7162 <primary><option>Resent-</option> header lines</primary>
7163 <secondary>with <option>-t</option></secondary>
7164 </indexterm>
7165 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7166 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7167 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7168 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7169 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7170 </para>
7171 <para>
7172 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7173 message is resent several times). The RFC also specifies that they should be
7174 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7175 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7176 nor indeed exactly what constitutes a <quote>set</quote>.
7177 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7178 are often added at the end of the header, and if a message is resent more than
7179 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7180 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7181 </para>
7182 </listitem></varlistentry>
7183 <varlistentry>
7184 <term><option>-ti</option></term>
7185 <listitem>
7186 <para>
7187 <indexterm role="option">
7188 <primary><option>-ti</option></primary>
7189 </indexterm>
7190 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7191 compatibility with Sendmail.
7192 </para>
7193 </listitem></varlistentry>
7194 <varlistentry>
7195 <term><option>-tls-on-connect</option></term>
7196 <listitem>
7197 <para>
7198 <indexterm role="option">
7199 <primary><option>-tls-on-connect</option></primary>
7200 </indexterm>
7201 <indexterm role="concept">
7202 <primary>TLS</primary>
7203 <secondary>use without STARTTLS</secondary>
7204 </indexterm>
7205 <indexterm role="concept">
7206 <primary>TLS</primary>
7207 <secondary>automatic start</secondary>
7208 </indexterm>
7209 This option is available when Exim is compiled with TLS support. It forces all
7210 incoming SMTP connections to behave as if the incoming port is listed in the
7211 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7212 <xref linkend="CHAPTLS"/> for further details.
7213 </para>
7214 </listitem></varlistentry>
7215 <varlistentry>
7216 <term><option>-U</option></term>
7217 <listitem>
7218 <para>
7219 <indexterm role="option">
7220 <primary><option>-U</option></primary>
7221 </indexterm>
7222 <indexterm role="concept">
7223 <primary>Sendmail compatibility</primary>
7224 <secondary><option>-U</option> option ignored</secondary>
7225 </indexterm>
7226 Sendmail uses this option for <quote>initial message submission</quote>, and its
7227 documentation states that in future releases, it may complain about
7228 syntactically invalid messages rather than fixing them when this flag is not
7229 set. Exim ignores this option.
7230 </para>
7231 </listitem></varlistentry>
7232 <varlistentry>
7233 <term><option>-v</option></term>
7234 <listitem>
7235 <para>
7236 <indexterm role="option">
7237 <primary><option>-v</option></primary>
7238 </indexterm>
7239 This option causes Exim to write information to the standard error stream,
7240 describing what it is doing. In particular, it shows the log lines for
7241 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7242 dialogue is shown. Some of the log lines shown may not actually be written to
7243 the log if the setting of <option>log_selector</option> discards them. Any relevant
7244 selectors are shown with each log line. If none are shown, the logging is
7245 unconditional.
7246 </para>
7247 </listitem></varlistentry>
7248 <varlistentry>
7249 <term><option>-x</option></term>
7250 <listitem>
7251 <para>
7252 <indexterm role="option">
7253 <primary><option>-x</option></primary>
7254 </indexterm>
7255 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7256 National Language Support extended characters in the body of the mail item</quote>).
7257 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7258 this option.
7259 </para>
7260 </listitem></varlistentry>
7261 <varlistentry>
7262 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7263 <listitem>
7264 <para>
7265 <indexterm role="option">
7266 <primary><option>-X</option></primary>
7267 </indexterm>
7268 This option is interpreted by Sendmail to cause debug information to be sent
7269 to the named file.  It is ignored by Exim.
7270 </para>
7271 </listitem></varlistentry>
7272 <varlistentry>
7273 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7274 <listitem>
7275 <para>
7276 <indexterm role="option">
7277 <primary><option>-z</option></primary>
7278 </indexterm>
7279 This option writes its argument to Exim&#x2019;s logfile.
7280 Use is restricted to administrators; the intent is for operational notes.
7281 Quotes should be used to maintain a multi-word item as a single argument,
7282 under most shells.
7283 </para>
7284 </listitem></varlistentry>
7285 </variablelist>
7286 <para>
7287 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7288 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7289 </para>
7290 <!-- === End of command line options === -->
7291 </section>
7292 </chapter>
7293
7294 <chapter id="CHAPconf">
7295 <title>The Exim run time configuration file</title>
7296 <titleabbrev>The runtime configuration file</titleabbrev>
7297 <para>
7298 <indexterm role="concept">
7299 <primary>run time configuration</primary>
7300 </indexterm>
7301 <indexterm role="concept">
7302 <primary>configuration file</primary>
7303 <secondary>general description</secondary>
7304 </indexterm>
7305 <indexterm role="concept">
7306 <primary>CONFIGURE_FILE</primary>
7307 </indexterm>
7308 <indexterm role="concept">
7309 <primary>configuration file</primary>
7310 <secondary>errors in</secondary>
7311 </indexterm>
7312 <indexterm role="concept">
7313 <primary>error</primary>
7314 <secondary>in configuration file</secondary>
7315 </indexterm>
7316 <indexterm role="concept">
7317 <primary>return code</primary>
7318 <secondary>for bad configuration</secondary>
7319 </indexterm>
7320 Exim uses a single run time configuration file that is read whenever an Exim
7321 binary is executed. Note that in normal operation, this happens frequently,
7322 because Exim is designed to operate in a distributed manner, without central
7323 control.
7324 </para>
7325 <para>
7326 If a syntax error is detected while reading the configuration file, Exim
7327 writes a message on the standard error, and exits with a non-zero return code.
7328 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7329 errors can be detected at this time. The values of any expanded options are
7330 not checked until the expansion happens, even when the expansion does not
7331 actually alter the string.
7332 </para>
7333 <para>
7334 The name of the configuration file is compiled into the binary for security
7335 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7336 most configurations, this specifies a single file. However, it is permitted to
7337 give a colon-separated list of file names, in which case Exim uses the first
7338 existing file in the list.
7339 </para>
7340 <para>
7341 <indexterm role="concept">
7342 <primary>EXIM_USER</primary>
7343 </indexterm>
7344 <indexterm role="concept">
7345 <primary>EXIM_GROUP</primary>
7346 </indexterm>
7347 <indexterm role="concept">
7348 <primary>CONFIGURE_OWNER</primary>
7349 </indexterm>
7350 <indexterm role="concept">
7351 <primary>CONFIGURE_GROUP</primary>
7352 </indexterm>
7353 <indexterm role="concept">
7354 <primary>configuration file</primary>
7355 <secondary>ownership</secondary>
7356 </indexterm>
7357 <indexterm role="concept">
7358 <primary>ownership</primary>
7359 <secondary>configuration file</secondary>
7360 </indexterm>
7361 The run time configuration file must be owned by root or by the user that is
7362 specified at compile time by the CONFIGURE_OWNER option (if set). The
7363 configuration file must not be world-writeable, or group-writeable unless its
7364 group is the root group or the one specified at compile time by the
7365 CONFIGURE_GROUP option.
7366 </para>
7367 <para>
7368 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7369 to root, anybody who is able to edit the run time configuration file has an
7370 easy way to run commands as root. If you specify a user or group in the
7371 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7372 who are members of that group will trivially be able to obtain root privileges.
7373 </para>
7374 <para>
7375 Up to Exim version 4.72, the run time configuration file was also permitted to
7376 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7377 since it offered a simple privilege escalation for any attacker who managed to
7378 compromise the Exim user account.
7379 </para>
7380 <para>
7381 A default configuration file, which will work correctly in simple situations,
7382 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7383 defines just one file name, the installation process copies the default
7384 configuration to a new file of that name if it did not previously exist. If
7385 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7386 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7387 configuration.
7388 </para>
7389 <section id="SECID40">
7390 <title>Using a different configuration file</title>
7391 <para>
7392 <indexterm role="concept">
7393 <primary>configuration file</primary>
7394 <secondary>alternate</secondary>
7395 </indexterm>
7396 A one-off alternate configuration can be specified by the <option>-C</option> command line
7397 option, which may specify a single file or a list of files. However, when
7398 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7399 unless the argument for <option>-C</option> is identical to the built-in value from
7400 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7401 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7402 is useful mainly for checking the syntax of configuration files before
7403 installing them. No owner or group checks are done on a configuration file
7404 specified by <option>-C</option>, if root privilege has been dropped.
7405 </para>
7406 <para>
7407 Even the Exim user is not trusted to specify an arbitrary configuration file
7408 with the <option>-C</option> option to be used with root privileges, unless that file is
7409 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7410 testing a configuration using <option>-C</option> right through message reception and
7411 delivery, even if the caller is root. The reception works, but by that time,
7412 Exim is running as the Exim user, so when it re-execs to regain privilege for
7413 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7414 can test reception and delivery using two separate commands (one to put a
7415 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7416 <option>-M</option>).
7417 </para>
7418 <para>
7419 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7420 prefix string with which any file named in a <option>-C</option> command line option must
7421 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7422 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7423 name can be used with <option>-C</option>.
7424 </para>
7425 <para>
7426 One-off changes to a configuration can be specified by the <option>-D</option> command line
7427 option, which defines and overrides values for macros used inside the
7428 configuration file. However, like <option>-C</option>, the use of this option by a
7429 non-privileged user causes Exim to discard its root privilege.
7430 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7431 completely disabled, and its use causes an immediate error exit.
7432 </para>
7433 <para>
7434 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7435 to declare certain macro names trusted, such that root privilege will not
7436 necessarily be discarded.
7437 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7438 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7439 values are acceptable, then Exim will not give up root privilege if the caller
7440 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7441 transition mechanism and is expected to be removed in the future.  Acceptable
7442 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7443 </para>
7444 <para>
7445 Some sites may wish to use the same Exim binary on different machines that
7446 share a file system, but to use different configuration files on each machine.
7447 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7448 looks for a file whose name is the configuration file name followed by a dot
7449 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7450 file does not exist, the standard name is tried. This processing occurs for
7451 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7452 </para>
7453 <para>
7454 In some esoteric situations different versions of Exim may be run under
7455 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7456 help with this. See the comments in <filename>src/EDITME</filename> for details.
7457 </para>
7458 </section>
7459 <section id="SECTconffilfor">
7460 <title>Configuration file format</title>
7461 <para>
7462 <indexterm role="concept">
7463 <primary>configuration file</primary>
7464 <secondary>format of</secondary>
7465 </indexterm>
7466 <indexterm role="concept">
7467 <primary>format</primary>
7468 <secondary>configuration file</secondary>
7469 </indexterm>
7470 Exim&#x2019;s configuration file is divided into a number of different parts. General
7471 option settings must always appear at the start of the file. The other parts
7472 are all optional, and may appear in any order. Each part other than the first
7473 is introduced by the word <quote>begin</quote> followed by at least one literal
7474 space, and the name of the part. The optional parts are:
7475 </para>
7476 <itemizedlist>
7477 <listitem>
7478 <para>
7479 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7480 <xref linkend="CHAPACL"/>).
7481 </para>
7482 </listitem>
7483 <listitem>
7484 <para>
7485 <indexterm role="concept">
7486 <primary>AUTH</primary>
7487 <secondary>configuration</secondary>
7488 </indexterm>
7489 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7490 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7491 </para>
7492 </listitem>
7493 <listitem>
7494 <para>
7495 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7496 addresses and determine how the message is to be delivered (see chapters
7497 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7498 </para>
7499 </listitem>
7500 <listitem>
7501 <para>
7502 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7503 define mechanisms for copying messages to destinations (see chapters
7504 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7505 </para>
7506 </listitem>
7507 <listitem>
7508 <para>
7509 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7510 If there is no retry section, or if it is empty (that is, no retry rules are
7511 defined), Exim will not retry deliveries. In this situation, temporary errors
7512 are treated the same as permanent errors. Retry rules are discussed in chapter
7513 <xref linkend="CHAPretry"/>.
7514 </para>
7515 </listitem>
7516 <listitem>
7517 <para>
7518 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7519 when new addresses are generated during delivery. Rewriting is discussed in
7520 chapter <xref linkend="CHAPrewrite"/>.
7521 </para>
7522 </listitem>
7523 <listitem>
7524 <para>
7525 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7526 want to use this feature, you must set
7527 </para>
7528 <literallayout class="monospaced">
7529 LOCAL_SCAN_HAS_OPTIONS=yes
7530 </literallayout>
7531 <para>
7532 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7533 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7534 </para>
7535 </listitem>
7536 </itemizedlist>
7537 <para>
7538 <indexterm role="concept">
7539 <primary>configuration file</primary>
7540 <secondary>leading white space in</secondary>
7541 </indexterm>
7542 <indexterm role="concept">
7543 <primary>configuration file</primary>
7544 <secondary>trailing white space in</secondary>
7545 </indexterm>
7546 <indexterm role="concept">
7547 <primary>white space</primary>
7548 <secondary>in configuration file</secondary>
7549 </indexterm>
7550 Leading and trailing white space in configuration lines is always ignored.
7551 </para>
7552 <para>
7553 Blank lines in the file, and lines starting with a # character (ignoring
7554 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7555 # character other than at the beginning of a line is not treated specially,
7556 and does not introduce a comment.
7557 </para>
7558 <para>
7559 Any non-comment line can be continued by ending it with a backslash. Note that
7560 the general rule for white space means that trailing white space after the
7561 backslash and leading white space at the start of continuation
7562 lines is ignored. Comment lines beginning with # (but not empty lines) may
7563 appear in the middle of a sequence of continuation lines.
7564 </para>
7565 <para>
7566 A convenient way to create a configuration file is to start from the
7567 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7568 change settings as required.
7569 </para>
7570 <para>
7571 The ACLs, retry rules, and rewriting rules have their own syntax which is
7572 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7573 respectively. The other parts of the configuration file have some syntactic
7574 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7575 onwards. Before that, the inclusion, macro, and conditional facilities are
7576 described.
7577 </para>
7578 </section>
7579 <section id="SECID41">
7580 <title>File inclusions in the configuration file</title>
7581 <para>
7582 <indexterm role="concept">
7583 <primary>inclusions in configuration file</primary>
7584 </indexterm>
7585 <indexterm role="concept">
7586 <primary>configuration file</primary>
7587 <secondary>including other files</secondary>
7588 </indexterm>
7589 <indexterm role="concept">
7590 <primary><literal>.include</literal> in configuration file</primary>
7591 </indexterm>
7592 <indexterm role="concept">
7593 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7594 </indexterm>
7595 You can include other files inside Exim&#x2019;s run time configuration file by
7596 using this syntax:
7597 </para>
7598 <literallayout>
7599 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7600 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7601 </literallayout>
7602 <para>
7603 on a line by itself. Double quotes round the file name are optional. If you use
7604 the first form, a configuration error occurs if the file does not exist; the
7605 second form does nothing for non-existent files.
7606 </para>
7607 <para revisionflag="changed">
7608 The first form allows a relative name. It is resolved relative to
7609 the directory of the including file. For the second form an absolute file
7610 name is required.
7611 </para>
7612 <para>
7613 Includes may be nested to any depth, but remember that Exim reads its
7614 configuration file often, so it is a good idea to keep them to a minimum.
7615 If you change the contents of an included file, you must HUP the daemon,
7616 because an included file is read only when the configuration itself is read.
7617 </para>
7618 <para>
7619 The processing of inclusions happens early, at a physical line level, so, like
7620 comment lines, an inclusion can be used in the middle of an option setting,
7621 for example:
7622 </para>
7623 <literallayout class="monospaced">
7624 hosts_lookup = a.b.c \
7625                .include /some/file
7626 </literallayout>
7627 <para>
7628 Include processing happens after macro processing (see below). Its effect is to
7629 process the lines of the included file as if they occurred inline where the
7630 inclusion appears.
7631 </para>
7632 </section>
7633 <section id="SECTmacrodefs">
7634 <title>Macros in the configuration file</title>
7635 <para>
7636 <indexterm role="concept">
7637 <primary>macro</primary>
7638 <secondary>description of</secondary>
7639 </indexterm>
7640 <indexterm role="concept">
7641 <primary>configuration file</primary>
7642 <secondary>macros</secondary>
7643 </indexterm>
7644 If a line in the main part of the configuration (that is, before the first
7645 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7646 definition, and must be of the form
7647 </para>
7648 <literallayout>
7649 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7650 </literallayout>
7651 <para>
7652 The name must consist of letters, digits, and underscores, and need not all be
7653 in upper case, though that is recommended. The rest of the line, including any
7654 continuations, is the replacement text, and has leading and trailing white
7655 space removed. Quotes are not removed. The replacement text can never end with
7656 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7657 </para>
7658 <para>
7659 Macros may also be defined between router, transport, authenticator, or ACL
7660 definitions. They may not, however, be defined within an individual driver or
7661 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7662 </para>
7663 </section>
7664 <section id="SECID42">
7665 <title>Macro substitution</title>
7666 <para>
7667 Once a macro is defined, all subsequent lines in the file (and any included
7668 files) are scanned for the macro name; if there are several macros, the line is
7669 scanned for each in turn, in the order in which the macros are defined. The
7670 replacement text is not re-scanned for the current macro, though it is scanned
7671 for subsequently defined macros. For this reason, a macro name may not contain
7672 the name of a previously defined macro as a substring. You could, for example,
7673 define
7674 </para>
7675 <literallayout>
7676 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7677 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7678 </literallayout>
7679 <para>
7680 but putting the definitions in the opposite order would provoke a configuration
7681 error. Macro expansion is applied to individual physical lines from the file,
7682 before checking for line continuation or file inclusion (see above). If a line
7683 consists solely of a macro name, and the expansion of the macro is empty, the
7684 line is ignored. A macro at the start of a line may turn the line into a
7685 comment line or a <literal>.include</literal> line.
7686 </para>
7687 </section>
7688 <section id="SECID43">
7689 <title>Redefining macros</title>
7690 <para>
7691 Once defined, the value of a macro can be redefined later in the configuration
7692 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7693 <emphasis>=</emphasis>. For example:
7694 </para>
7695 <literallayout class="monospaced">
7696 MAC =  initial value
7697 ...
7698 MAC == updated value
7699 </literallayout>
7700 <para>
7701 Redefinition does not alter the order in which the macros are applied to the
7702 subsequent lines of the configuration file. It is still the same order in which
7703 the macros were originally defined. All that changes is the macro&#x2019;s value.
7704 Redefinition makes it possible to accumulate values. For example:
7705 </para>
7706 <literallayout class="monospaced">
7707 MAC =  initial value
7708 ...
7709 MAC == MAC and something added
7710 </literallayout>
7711 <para>
7712 This can be helpful in situations where the configuration file is built
7713 from a number of other files.
7714 </para>
7715 </section>
7716 <section id="SECID44">
7717 <title>Overriding macro values</title>
7718 <para>
7719 The values set for macros in the configuration file can be overridden by the
7720 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7721 used, unless called by root or the Exim user. A definition on the command line
7722 using the <option>-D</option> option causes all definitions and redefinitions within the
7723 file to be ignored.
7724 </para>
7725 </section>
7726 <section id="SECID45">
7727 <title>Example of macro usage</title>
7728 <para>
7729 As an example of macro usage, consider a configuration where aliases are looked
7730 up in a MySQL database. It helps to keep the file less cluttered if long
7731 strings such as SQL statements are defined separately as macros, for example:
7732 </para>
7733 <literallayout class="monospaced">
7734 ALIAS_QUERY = select mailbox from user where \
7735               login='${quote_mysql:$local_part}';
7736 </literallayout>
7737 <para>
7738 This can then be used in a <command>redirect</command> router setting like this:
7739 </para>
7740 <literallayout class="monospaced">
7741 data = ${lookup mysql{ALIAS_QUERY}}
7742 </literallayout>
7743 <para>
7744 In earlier versions of Exim macros were sometimes used for domain, host, or
7745 address lists. In Exim 4 these are handled better by named lists &ndash; see
7746 section <xref linkend="SECTnamedlists"/>.
7747 </para>
7748 </section>
7749 <section id="SECTbuiltinmacros">
7750 <title>Builtin macros</title>
7751 <para>
7752 Exim defines some macros depending on facilities available, which may
7753 differ due to build-time definitions and from one release to another.
7754 All of these macros start with an underscore.
7755 They can be used to conditionally include parts of a configuration
7756 (see below).
7757 </para>
7758 <para>
7759 The following classes of macros are defined:
7760 </para>
7761 <literallayout>
7762 <literal> _HAVE_*                    </literal>  build-time defines
7763 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
7764 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
7765 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
7766 <literal> _OPT_MAIN_*                </literal>  main config options
7767 <literal> _OPT_ROUTERS_*             </literal>  generic router options
7768 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
7769 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
7770 <literal> _OPT_ROUTER_*_*            </literal>  private router options
7771 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
7772 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
7773 </literallayout>
7774 <para>
7775 Use an <quote>exim -bP macros</quote> command to get the list of macros.
7776 </para>
7777 </section>
7778 <section id="SECID46">
7779 <title>Conditional skips in the configuration file</title>
7780 <para>
7781 <indexterm role="concept">
7782 <primary>configuration file</primary>
7783 <secondary>conditional skips</secondary>
7784 </indexterm>
7785 <indexterm role="concept">
7786 <primary><literal>.ifdef</literal></primary>
7787 </indexterm>
7788 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7789 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7790 portions of the configuration file. The processing happens whenever the file is
7791 read (that is, when an Exim binary starts to run).
7792 </para>
7793 <para>
7794 The implementation is very simple. Instances of the first four directives must
7795 be followed by text that includes the names of one or macros. The condition
7796 that is tested is whether or not any macro substitution has taken place in the
7797 line. Thus:
7798 </para>
7799 <literallayout class="monospaced">
7800 .ifdef AAA
7801 message_size_limit = 50M
7802 .else
7803 message_size_limit = 100M
7804 .endif
7805 </literallayout>
7806 <para>
7807 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
7808 (or <literal>A</literal> or <literal>AA</literal>), and 100M
7809 otherwise. If there is more than one macro named on the line, the condition
7810 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7811 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7812 </para>
7813 <para>
7814 Although you can use a macro expansion to generate one of these directives,
7815 it is not very useful, because the condition <quote>there was a macro substitution
7816 in this line</quote> will always be true.
7817 </para>
7818 <para>
7819 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7820 to clarify complicated nestings.
7821 </para>
7822 </section>
7823 <section id="SECTcos">
7824 <title>Common option syntax</title>
7825 <para>
7826 <indexterm role="concept">
7827 <primary>common option syntax</primary>
7828 </indexterm>
7829 <indexterm role="concept">
7830 <primary>syntax of common options</primary>
7831 </indexterm>
7832 <indexterm role="concept">
7833 <primary>configuration file</primary>
7834 <secondary>common option syntax</secondary>
7835 </indexterm>
7836 For the main set of options, driver options, and <function>local_scan()</function> options,
7837 each setting is on a line by itself, and starts with a name consisting of
7838 lower-case letters and underscores. Many options require a data value, and in
7839 these cases the name must be followed by an equals sign (with optional white
7840 space) and then the value. For example:
7841 </para>
7842 <literallayout class="monospaced">
7843 qualify_domain = mydomain.example.com
7844 </literallayout>
7845 <para>
7846 <indexterm role="concept">
7847 <primary>hiding configuration option values</primary>
7848 </indexterm>
7849 <indexterm role="concept">
7850 <primary>configuration options</primary>
7851 <secondary>hiding value of</secondary>
7852 </indexterm>
7853 <indexterm role="concept">
7854 <primary>options</primary>
7855 <secondary>hiding value of</secondary>
7856 </indexterm>
7857 Some option settings may contain sensitive data, for example, passwords for
7858 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7859 line option to read these values, you can precede the option settings with the
7860 word <quote>hide</quote>. For example:
7861 </para>
7862 <literallayout class="monospaced">
7863 hide mysql_servers = localhost/users/admin/secret-password
7864 </literallayout>
7865 <para>
7866 For non-admin users, such options are displayed like this:
7867 </para>
7868 <literallayout class="monospaced">
7869 mysql_servers = &lt;value not displayable&gt;
7870 </literallayout>
7871 <para>
7872 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7873 all instances of the same driver.
7874 </para>
7875 <para>
7876 The following sections describe the syntax used for the different data types
7877 that are found in option settings.
7878 </para>
7879 </section>
7880 <section id="SECID47">
7881 <title>Boolean options</title>
7882 <para>
7883 <indexterm role="concept">
7884 <primary>format</primary>
7885 <secondary>boolean</secondary>
7886 </indexterm>
7887 <indexterm role="concept">
7888 <primary>boolean configuration values</primary>
7889 </indexterm>
7890 <indexterm role="option">
7891 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7892 </indexterm>
7893 <indexterm role="option">
7894 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7895 </indexterm>
7896 Options whose type is given as boolean are on/off switches. There are two
7897 different ways of specifying such options: with and without a data value. If
7898 the option name is specified on its own without data, the switch is turned on;
7899 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7900 boolean options may be followed by an equals sign and one of the words
7901 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7902 the following two settings have exactly the same effect:
7903 </para>
7904 <literallayout class="monospaced">
7905 queue_only
7906 queue_only = true
7907 </literallayout>
7908 <para>
7909 The following two lines also have the same (opposite) effect:
7910 </para>
7911 <literallayout class="monospaced">
7912 no_queue_only
7913 queue_only = false
7914 </literallayout>
7915 <para>
7916 You can use whichever syntax you prefer.
7917 </para>
7918 </section>
7919 <section id="SECID48">
7920 <title>Integer values</title>
7921 <para>
7922 <indexterm role="concept">
7923 <primary>integer configuration values</primary>
7924 </indexterm>
7925 <indexterm role="concept">
7926 <primary>format</primary>
7927 <secondary>integer</secondary>
7928 </indexterm>
7929 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
7930 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7931 number is assumed. Otherwise, it is treated as an octal number unless it starts
7932 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7933 hexadecimal number.
7934 </para>
7935 <para>
7936 If an integer value is followed by the letter K, it is multiplied by 1024; if
7937 it is followed by the letter M, it is multiplied by 1024x1024;
7938 if by the letter G, 1024x1024x1024.
7939 When the values
7940 of integer option settings are output, values which are an exact multiple of
7941 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7942 and M. The printing style is independent of the actual input format that was
7943 used.
7944 </para>
7945 </section>
7946 <section id="SECID49">
7947 <title>Octal integer values</title>
7948 <para>
7949 <indexterm role="concept">
7950 <primary>integer format</primary>
7951 </indexterm>
7952 <indexterm role="concept">
7953 <primary>format</primary>
7954 <secondary>octal integer</secondary>
7955 </indexterm>
7956 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
7957 interpreted as an octal number, whether or not it starts with the digit zero.
7958 Such options are always output in octal.
7959 </para>
7960 </section>
7961 <section id="SECID50">
7962 <title>Fixed point numbers</title>
7963 <para>
7964 <indexterm role="concept">
7965 <primary>fixed point configuration values</primary>
7966 </indexterm>
7967 <indexterm role="concept">
7968 <primary>format</primary>
7969 <secondary>fixed point</secondary>
7970 </indexterm>
7971 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
7972 integer, optionally followed by a decimal point and up to three further digits.
7973 </para>
7974 </section>
7975 <section id="SECTtimeformat">
7976 <title>Time intervals</title>
7977 <para>
7978 <indexterm role="concept">
7979 <primary>time interval</primary>
7980 <secondary>specifying in configuration</secondary>
7981 </indexterm>
7982 <indexterm role="concept">
7983 <primary>format</primary>
7984 <secondary>time interval</secondary>
7985 </indexterm>
7986 A time interval is specified as a sequence of numbers, each followed by one of
7987 the following letters, with no intervening white space:
7988 </para>
7989 <informaltable frame="none">
7990 <tgroup cols="2" colsep="0" rowsep="0">
7991 <colspec colwidth="30pt" align="left"/>
7992 <colspec colwidth="254pt" align="left"/>
7993 <tbody>
7994 <row>
7995 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
7996 <entry>seconds</entry>
7997 </row>
7998 <row>
7999 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
8000 <entry>minutes</entry>
8001 </row>
8002 <row>
8003 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8004 <entry>hours</entry>
8005 </row>
8006 <row>
8007 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8008 <entry>days</entry>
8009 </row>
8010 <row>
8011 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8012 <entry>weeks</entry>
8013 </row>
8014 </tbody>
8015 </tgroup>
8016 </informaltable>
8017 <para>
8018 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8019 intervals are output in the same format. Exim does not restrict the values; it
8020 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8021 </para>
8022 </section>
8023 <section id="SECTstrings">
8024 <title>String values</title>
8025 <para>
8026 <indexterm role="concept">
8027 <primary>string</primary>
8028 <secondary>format of configuration values</secondary>
8029 </indexterm>
8030 <indexterm role="concept">
8031 <primary>format</primary>
8032 <secondary>string</secondary>
8033 </indexterm>
8034 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8035 or without double-quotes. If it does not start with a double-quote, the value
8036 consists of the remainder of the line plus any continuation lines, starting at
8037 the first character after any leading white space, with trailing white space
8038 removed, and with no interpretation of the characters in the string. Because
8039 Exim removes comment lines (those beginning with #) at an early stage, they can
8040 appear in the middle of a multi-line string. The following two settings are
8041 therefore equivalent:
8042 </para>
8043 <literallayout class="monospaced">
8044 trusted_users = uucp:mail
8045 trusted_users = uucp:\
8046                 # This comment line is ignored
8047                 mail
8048 </literallayout>
8049 <para>
8050 <indexterm role="concept">
8051 <primary>string</primary>
8052 <secondary>quoted</secondary>
8053 </indexterm>
8054 <indexterm role="concept">
8055 <primary>escape characters in quoted strings</primary>
8056 </indexterm>
8057 If a string does start with a double-quote, it must end with a closing
8058 double-quote, and any backslash characters other than those used for line
8059 continuation are interpreted as escape characters, as follows:
8060 </para>
8061 <informaltable frame="none">
8062 <tgroup cols="2" colsep="0" rowsep="0">
8063 <colspec colwidth="100pt" align="left"/>
8064 <colspec colwidth="254pt" align="left"/>
8065 <tbody>
8066 <row>
8067 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8068 <entry>single backslash</entry>
8069 </row>
8070 <row>
8071 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8072 <entry>newline</entry>
8073 </row>
8074 <row>
8075 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8076 <entry>carriage return</entry>
8077 </row>
8078 <row>
8079 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8080 <entry>tab</entry>
8081 </row>
8082 <row>
8083 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8084 <entry>up to 3 octal digits specify one character</entry>
8085 </row>
8086 <row>
8087 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8088 <entry>up to 2 hexadecimal digits specify one character</entry>
8089 </row>
8090 </tbody>
8091 </tgroup>
8092 </informaltable>
8093 <para>
8094 If a backslash is followed by some other character, including a double-quote
8095 character, that character replaces the pair.
8096 </para>
8097 <para>
8098 Quoting is necessary only if you want to make use of the backslash escapes to
8099 insert special characters, or if you need to specify a value with leading or
8100 trailing spaces. These cases are rare, so quoting is almost never needed in
8101 current versions of Exim. In versions of Exim before 3.14, quoting was required
8102 in order to continue lines, so you may come across older configuration files
8103 and examples that apparently quote unnecessarily.
8104 </para>
8105 </section>
8106 <section id="SECID51">
8107 <title>Expanded strings</title>
8108 <para>
8109 <indexterm role="concept">
8110 <primary>expansion</primary>
8111 <secondary>definition of</secondary>
8112 </indexterm>
8113 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8114 by which means various parts of the string may be changed according to the
8115 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8116 is as just described; in particular, the handling of backslashes in quoted
8117 strings is done as part of the input process, before expansion takes place.
8118 However, backslash is also an escape character for the expander, so any
8119 backslashes that are required for that reason must be doubled if they are
8120 within a quoted configuration string.
8121 </para>
8122 </section>
8123 <section id="SECID52">
8124 <title>User and group names</title>
8125 <para>
8126 <indexterm role="concept">
8127 <primary>user name</primary>
8128 <secondary>format of</secondary>
8129 </indexterm>
8130 <indexterm role="concept">
8131 <primary>format</primary>
8132 <secondary>user name</secondary>
8133 </indexterm>
8134 <indexterm role="concept">
8135 <primary>groups</primary>
8136 <secondary>name format</secondary>
8137 </indexterm>
8138 <indexterm role="concept">
8139 <primary>format</primary>
8140 <secondary>group name</secondary>
8141 </indexterm>
8142 User and group names are specified as strings, using the syntax described
8143 above, but the strings are interpreted specially. A user or group name must
8144 either consist entirely of digits, or be a name that can be looked up using the
8145 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8146 </para>
8147 </section>
8148 <section id="SECTlistconstruct">
8149 <title>List construction</title>
8150 <para>
8151 <indexterm role="concept">
8152 <primary>list</primary>
8153 <secondary>syntax of in configuration</secondary>
8154 </indexterm>
8155 <indexterm role="concept">
8156 <primary>format</primary>
8157 <secondary>list item in configuration</secondary>
8158 </indexterm>
8159 <indexterm role="concept">
8160 <primary>string</primary>
8161 <secondary>list, definition of</secondary>
8162 </indexterm>
8163 The data for some configuration options is a list of items, with colon as the
8164 default separator. Many of these options are shown with type <quote>string list</quote> in
8165 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8166 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8167 are all the same; however, those other than <quote>string list</quote> are subject to
8168 particular kinds of interpretation, as described in chapter
8169 <xref linkend="CHAPdomhosaddlists"/>.
8170 </para>
8171 <para>
8172 In all these cases, the entire list is treated as a single string as far as the
8173 input syntax is concerned. The <option>trusted_users</option> setting in section
8174 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8175 in a list, it must be entered as two colons. Leading and trailing white space
8176 on each item in a list is ignored. This makes it possible to include items that
8177 start with a colon, and in particular, certain forms of IPv6 address. For
8178 example, the list
8179 </para>
8180 <literallayout class="monospaced">
8181 local_interfaces = 127.0.0.1 : ::::1
8182 </literallayout>
8183 <para>
8184 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8185 </para>
8186 <para>
8187 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8188 list items, it is not ignored when parsing the list. The space after the first
8189 colon in the example above is necessary. If it were not there, the list would
8190 be interpreted as the two items 127.0.0.1:: and 1.
8191 </para>
8192 </section>
8193 <section id="SECTlistsepchange">
8194 <title>Changing list separators</title>
8195 <para>
8196 <indexterm role="concept">
8197 <primary>list separator</primary>
8198 <secondary>changing</secondary>
8199 </indexterm>
8200 <indexterm role="concept">
8201 <primary>IPv6</primary>
8202 <secondary>addresses in lists</secondary>
8203 </indexterm>
8204 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8205 introduced to allow the separator character to be changed. If a list begins
8206 with a left angle bracket, followed by any punctuation character, that
8207 character is used instead of colon as the list separator. For example, the list
8208 above can be rewritten to use a semicolon separator like this:
8209 </para>
8210 <literallayout class="monospaced">
8211 local_interfaces = &lt;; 127.0.0.1 ; ::1
8212 </literallayout>
8213 <para>
8214 This facility applies to all lists, with the exception of the list in
8215 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8216 confined to circumstances where they really are needed.
8217 </para>
8218 <para>
8219 <indexterm role="concept">
8220 <primary>list separator</primary>
8221 <secondary>newline as</secondary>
8222 </indexterm>
8223 <indexterm role="concept">
8224 <primary>newline</primary>
8225 <secondary>as list separator</secondary>
8226 </indexterm>
8227 It is also possible to use newline and other control characters (those with
8228 code values less than 32, plus DEL) as separators in lists. Such separators
8229 must be provided literally at the time the list is processed. For options that
8230 are string-expanded, you can write the separator using a normal escape
8231 sequence. This will be processed by the expander before the string is
8232 interpreted as a list. For example, if a newline-separated list of domains is
8233 generated by a lookup, you can process it directly by a line such as this:
8234 </para>
8235 <literallayout class="monospaced">
8236 domains = &lt;\n ${lookup mysql{.....}}
8237 </literallayout>
8238 <para>
8239 This avoids having to change the list separator in such data. You are unlikely
8240 to want to use a control character as a separator in an option that is not
8241 expanded, because the value is literal text. However, it can be done by giving
8242 the value in quotes. For example:
8243 </para>
8244 <literallayout class="monospaced">
8245 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8246 </literallayout>
8247 <para>
8248 Unlike printing character separators, which can be included in list items by
8249 doubling, it is not possible to include a control character as data when it is
8250 set as the separator. Two such characters in succession are interpreted as
8251 enclosing an empty list item.
8252 </para>
8253 </section>
8254 <section id="SECTempitelis">
8255 <title>Empty items in lists</title>
8256 <para>
8257 <indexterm role="concept">
8258 <primary>list</primary>
8259 <secondary>empty item in</secondary>
8260 </indexterm>
8261 An empty item at the end of a list is always ignored. In other words, trailing
8262 separator characters are ignored. Thus, the list in
8263 </para>
8264 <literallayout class="monospaced">
8265 senders = user@domain :
8266 </literallayout>
8267 <para>
8268 contains only a single item. If you want to include an empty string as one item
8269 in a list, it must not be the last item. For example, this list contains three
8270 items, the second of which is empty:
8271 </para>
8272 <literallayout class="monospaced">
8273 senders = user1@domain : : user2@domain
8274 </literallayout>
8275 <para>
8276 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8277 are interpreted as representing a single colon data character (and the list
8278 would then contain just one item). If you want to specify a list that contains
8279 just one, empty item, you can do it as in this example:
8280 </para>
8281 <literallayout class="monospaced">
8282 senders = :
8283 </literallayout>
8284 <para>
8285 In this case, the first item is empty, and the second is discarded because it
8286 is at the end of the list.
8287 </para>
8288 </section>
8289 <section id="SECTfordricon">
8290 <title>Format of driver configurations</title>
8291 <para>
8292 <indexterm role="concept">
8293 <primary>drivers</primary>
8294 <secondary>configuration format</secondary>
8295 </indexterm>
8296 There are separate parts in the configuration for defining routers, transports,
8297 and authenticators. In each part, you are defining a number of driver
8298 instances, each with its own set of options. Each driver instance is defined by
8299 a sequence of lines like this:
8300 </para>
8301 <literallayout>
8302 &lt;<emphasis>instance name</emphasis>&gt;:
8303   &lt;<emphasis>option</emphasis>&gt;
8304   ...
8305   &lt;<emphasis>option</emphasis>&gt;
8306 </literallayout>
8307 <para>
8308 In the following example, the instance name is <command>localuser</command>, and it is
8309 followed by three options settings:
8310 </para>
8311 <literallayout class="monospaced">
8312 localuser:
8313   driver = accept
8314   check_local_user
8315   transport = local_delivery
8316 </literallayout>
8317 <para>
8318 For each driver instance, you specify which Exim code module it uses &ndash; by the
8319 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8320 settings. For example, in the case of transports, if you want a transport to
8321 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8322 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8323 described in detail in its own separate chapter later in this manual.
8324 </para>
8325 <para>
8326 You can have several routers, transports, or authenticators that are based on
8327 the same underlying driver (each must have a different instance name).
8328 </para>
8329 <para>
8330 The order in which routers are defined is important, because addresses are
8331 passed to individual routers one by one, in order. The order in which
8332 transports are defined does not matter at all. The order in which
8333 authenticators are defined is used only when Exim, as a client, is searching
8334 them to find one that matches an authentication mechanism offered by the
8335 server.
8336 </para>
8337 <para>
8338 <indexterm role="concept">
8339 <primary>generic options</primary>
8340 </indexterm>
8341 <indexterm role="concept">
8342 <primary>options</primary>
8343 <secondary>generic &ndash; definition of</secondary>
8344 </indexterm>
8345 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8346 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8347 same type (that is, all routers, all transports or all authenticators). The
8348 <option>driver</option> option is a generic option that must appear in every definition.
8349 <indexterm role="concept">
8350 <primary>private options</primary>
8351 </indexterm>
8352 The private options are special for each driver, and none need appear, because
8353 they all have default values.
8354 </para>
8355 <para>
8356 The options may appear in any order, except that the <option>driver</option> option must
8357 precede any private options, since these depend on the particular driver. For
8358 this reason, it is recommended that <option>driver</option> always be the first option.
8359 </para>
8360 <para>
8361 Driver instance names, which are used for reference in log entries and
8362 elsewhere, can be any sequence of letters, digits, and underscores (starting
8363 with a letter) and must be unique among drivers of the same type. A router and
8364 a transport (for example) can each have the same name, but no two router
8365 instances can have the same name. The name of a driver instance should not be
8366 confused with the name of the underlying driver module. For example, the
8367 configuration lines:
8368 </para>
8369 <literallayout class="monospaced">
8370 remote_smtp:
8371   driver = smtp
8372 </literallayout>
8373 <para>
8374 create an instance of the <command>smtp</command> transport driver whose name is
8375 <command>remote_smtp</command>. The same driver code can be used more than once, with
8376 different instance names and different option settings each time. A second
8377 instance of the <command>smtp</command> transport, with different options, might be defined
8378 thus:
8379 </para>
8380 <literallayout class="monospaced">
8381 special_smtp:
8382   driver = smtp
8383   port = 1234
8384   command_timeout = 10s
8385 </literallayout>
8386 <para>
8387 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8388 these transport instances from routers, and these names would appear in log
8389 lines.
8390 </para>
8391 <para>
8392 Comment lines may be present in the middle of driver specifications. The full
8393 list of option settings for any particular driver instance, including all the
8394 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8395 option.
8396 </para>
8397 </section>
8398 </chapter>
8399
8400 <chapter id="CHAPdefconfil">
8401 <title>The default configuration file</title>
8402 <para>
8403 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8404 <primary>configuration file</primary>
8405 <secondary>default <quote>walk through</quote></secondary>
8406 </indexterm>
8407 <indexterm role="concept">
8408 <primary>default</primary>
8409 <secondary>configuration file <quote>walk through</quote></secondary>
8410 </indexterm>
8411 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8412 is sufficient for a host with simple mail requirements. As an introduction to
8413 the way Exim is configured, this chapter <quote>walks through</quote> the default
8414 configuration, giving brief explanations of the settings. Detailed descriptions
8415 of the options are given in subsequent chapters. The default configuration file
8416 itself contains extensive comments about ways you might want to modify the
8417 initial settings. However, note that there are many options that are not
8418 mentioned at all in the default configuration.
8419 </para>
8420 <section id="SECTdefconfmain">
8421 <title>Main configuration settings</title>
8422 <para>
8423 The main (global) configuration option settings must always come first in the
8424 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
8425 the line
8426 </para>
8427 <literallayout class="monospaced">
8428 # primary_hostname =
8429 </literallayout>
8430 <para>
8431 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8432 to know the official, fully qualified name of your host, and this is where you
8433 can specify it. However, in most cases you do not need to set this option. When
8434 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8435 </para>
8436 <para>
8437 The first three non-comment configuration lines are as follows:
8438 </para>
8439 <literallayout class="monospaced">
8440 domainlist local_domains    = @
8441 domainlist relay_to_domains =
8442 hostlist   relay_from_hosts = 127.0.0.1
8443 </literallayout>
8444 <para>
8445 These are not, in fact, option settings. They are definitions of two named
8446 domain lists and one named host list. Exim allows you to give names to lists of
8447 domains, hosts, and email addresses, in order to make it easier to manage the
8448 configuration file (see section <xref linkend="SECTnamedlists"/>).
8449 </para>
8450 <para>
8451 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8452 later in the configuration to identify domains that are to be delivered
8453 on the local host.
8454 </para>
8455 <para>
8456 <indexterm role="concept">
8457 <primary>@ in a domain list</primary>
8458 </indexterm>
8459 There is just one item in this list, the string <quote>@</quote>. This is a special form
8460 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8461 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8462 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8463 the same configuration file can be used on different hosts.
8464 </para>
8465 <para>
8466 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8467 list itself is empty. Later in the configuration we will come to the part that
8468 controls mail relaying through the local host; it allows relaying to any
8469 domains in this list. By default, therefore, no relaying on the basis of a mail
8470 domain is permitted.
8471 </para>
8472 <para>
8473 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8474 used later in the configuration to permit relaying from any host or IP address
8475 that matches the list. The default contains just the IP address of the IPv4
8476 loopback interface, which means that processes on the local host are able to
8477 submit mail for relaying by sending it over TCP/IP to that interface. No other
8478 hosts are permitted to submit messages for relaying.
8479 </para>
8480 <para>
8481 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8482 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8483 and hosts that will be used in the controls that are specified later.
8484 </para>
8485 <para>
8486 The next two configuration lines are genuine option settings:
8487 </para>
8488 <literallayout class="monospaced">
8489 acl_smtp_rcpt = acl_check_rcpt
8490 acl_smtp_data = acl_check_data
8491 </literallayout>
8492 <para>
8493 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8494 during an incoming SMTP session for every recipient of a message (every RCPT
8495 command), and after the contents of the message have been received,
8496 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8497 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8498 section of the configuration. The RCPT ACL controls which recipients are
8499 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8500 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8501 contents of a message to be checked.
8502 </para>
8503 <para>
8504 Two commented-out option settings are next:
8505 </para>
8506 <literallayout class="monospaced">
8507 # av_scanner = clamd:/tmp/clamd
8508 # spamd_address = 127.0.0.1 783
8509 </literallayout>
8510 <para>
8511 These are example settings that can be used when Exim is compiled with the
8512 content-scanning extension. The first specifies the interface to the virus
8513 scanner, and the second specifies the interface to SpamAssassin. Further
8514 details are given in chapter <xref linkend="CHAPexiscan"/>.
8515 </para>
8516 <para>
8517 Three more commented-out option settings follow:
8518 </para>
8519 <literallayout class="monospaced">
8520 # tls_advertise_hosts = *
8521 # tls_certificate = /etc/ssl/exim.crt
8522 # tls_privatekey = /etc/ssl/exim.pem
8523 </literallayout>
8524 <para>
8525 These are example settings that can be used when Exim is compiled with
8526 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8527 first one specifies the list of clients that are allowed to use TLS when
8528 connecting to this server; in this case the wildcard means all clients. The
8529 other options specify where Exim should find its TLS certificate and private
8530 key, which together prove the server&#x2019;s identity to any clients that connect.
8531 More details are given in chapter <xref linkend="CHAPTLS"/>.
8532 </para>
8533 <para>
8534 Another two commented-out option settings follow:
8535 </para>
8536 <literallayout class="monospaced">
8537 # daemon_smtp_ports = 25 : 465 : 587
8538 # tls_on_connect_ports = 465
8539 </literallayout>
8540 <para>
8541 <indexterm role="concept">
8542 <primary>port</primary>
8543 <secondary>465 and 587</secondary>
8544 </indexterm>
8545 <indexterm role="concept">
8546 <primary>port</primary>
8547 <secondary>for message submission</secondary>
8548 </indexterm>
8549 <indexterm role="concept">
8550 <primary>message</primary>
8551 <secondary>submission, ports for</secondary>
8552 </indexterm>
8553 <indexterm role="concept">
8554 <primary>ssmtp protocol</primary>
8555 </indexterm>
8556 <indexterm role="concept">
8557 <primary>smtps protocol</primary>
8558 </indexterm>
8559 <indexterm role="concept">
8560 <primary>SMTP</primary>
8561 <secondary>ssmtp protocol</secondary>
8562 </indexterm>
8563 <indexterm role="concept">
8564 <primary>SMTP</primary>
8565 <secondary>smtps protocol</secondary>
8566 </indexterm>
8567 These options provide better support for roaming users who wish to use this
8568 server for message submission. They are not much use unless you have turned on
8569 TLS (as described in the previous paragraph) and authentication (about which
8570 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8571 on end-user networks, so RFC 4409 specifies that message submission should use
8572 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8573 configured to use port 587 correctly, so these settings also enable the
8574 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8575 <xref linkend="SECTsupobssmt"/>).
8576 </para>
8577 <para>
8578 Two more commented-out options settings follow:
8579 </para>
8580 <literallayout class="monospaced">
8581 # qualify_domain =
8582 # qualify_recipient =
8583 </literallayout>
8584 <para>
8585 The first of these specifies a domain that Exim uses when it constructs a
8586 complete email address from a local login name. This is often needed when Exim
8587 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8588 the value of <option>primary_hostname</option> is used. If you set both of these options,
8589 you can have different qualification domains for sender and recipient
8590 addresses. If you set only the first one, its value is used in both cases.
8591 </para>
8592 <para>
8593 <indexterm role="concept">
8594 <primary>domain literal</primary>
8595 <secondary>recognizing format</secondary>
8596 </indexterm>
8597 The following line must be uncommented if you want Exim to recognize
8598 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8599 (an IP address within square brackets) instead of a named domain.
8600 </para>
8601 <literallayout class="monospaced">
8602 # allow_domain_literals
8603 </literallayout>
8604 <para>
8605 The RFCs still require this form, but many people think that in the modern
8606 Internet it makes little sense to permit mail to be sent to specific hosts by
8607 quoting their IP addresses. This ancient format has been used by people who
8608 try to abuse hosts by using them for unwanted relaying. However, some
8609 people believe there are circumstances (for example, messages addressed to
8610 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8611 </para>
8612 <para>
8613 The next configuration line is a kind of trigger guard:
8614 </para>
8615 <literallayout class="monospaced">
8616 never_users = root
8617 </literallayout>
8618 <para>
8619 It specifies that no delivery must ever be run as the root user. The normal
8620 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8621 setting is a guard against slips in the configuration.
8622 The list of users specified by <option>never_users</option> is not, however, the complete
8623 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8624 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8625 contents of <option>never_users</option> are added to this list. By default
8626 FIXED_NEVER_USERS also specifies root.
8627 </para>
8628 <para>
8629 When a remote host connects to Exim in order to send mail, the only information
8630 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8631 line,
8632 </para>
8633 <literallayout class="monospaced">
8634 host_lookup = *
8635 </literallayout>
8636 <para>
8637 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8638 in order to get a host name. This improves the quality of the logging
8639 information, but if you feel it is too expensive, you can remove it entirely,
8640 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8641 Note that it is not always possible to find a host name from an IP address,
8642 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8643 unreachable.
8644 </para>
8645 <para>
8646 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8647 1413 (hence their names):
8648 </para>
8649 <literallayout class="monospaced">
8650 rfc1413_hosts = *
8651 rfc1413_query_timeout = 0s
8652 </literallayout>
8653 <para>
8654 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8655 Few hosts offer RFC1413 service these days; calls have to be
8656 terminated by a timeout and this needlessly delays the startup
8657 of an incoming SMTP connection.
8658 If you have hosts for which you trust RFC1413 and need this
8659 information, you can change this.
8660 </para>
8661 <para>
8662 This line enables an efficiency SMTP option.  It is negotiated by clients
8663 and not expected to cause problems but can be disabled if needed.
8664 </para>
8665 <literallayout class="monospaced">
8666 prdr_enable = true
8667 </literallayout>
8668 <para>
8669 When Exim receives messages over SMTP connections, it expects all addresses to
8670 be fully qualified with a domain, as required by the SMTP definition. However,
8671 if you are running a server to which simple clients submit messages, you may
8672 find that they send unqualified addresses. The two commented-out options:
8673 </para>
8674 <literallayout class="monospaced">
8675 # sender_unqualified_hosts =
8676 # recipient_unqualified_hosts =
8677 </literallayout>
8678 <para>
8679 show how you can specify hosts that are permitted to send unqualified sender
8680 and recipient addresses, respectively.
8681 </para>
8682 <para>
8683 The <option>log_selector</option> option is used to increase the detail of logging
8684 over the default:
8685 </para>
8686 <literallayout class="monospaced">
8687 log_selector = +smtp_protocol_error +smtp_syntax_error \
8688                +tls_certificate_verified
8689 </literallayout>
8690 <para>
8691 The <option>percent_hack_domains</option> option is also commented out:
8692 </para>
8693 <literallayout class="monospaced">
8694 # percent_hack_domains =
8695 </literallayout>
8696 <para>
8697 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8698 This is an almost obsolete form of explicit email routing. If you do not know
8699 anything about it, you can safely ignore this topic.
8700 </para>
8701 <para>
8702 The next two settings in the main part of the default configuration are
8703 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8704 message is frozen, Exim no longer continues to try to deliver it. Freezing
8705 occurs when a bounce message encounters a permanent failure because the sender
8706 address of the original message that caused the bounce is invalid, so the
8707 bounce cannot be delivered. This is probably the most common case, but there
8708 are also other conditions that cause freezing, and frozen messages are not
8709 always bounce messages.
8710 </para>
8711 <literallayout class="monospaced">
8712 ignore_bounce_errors_after = 2d
8713 timeout_frozen_after = 7d
8714 </literallayout>
8715 <para>
8716 The first of these options specifies that failing bounce messages are to be
8717 discarded after 2 days on the queue. The second specifies that any frozen
8718 message (whether a bounce message or not) is to be timed out (and discarded)
8719 after a week. In this configuration, the first setting ensures that no failing
8720 bounce message ever lasts a week.
8721 </para>
8722 <para>
8723 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
8724 large queues, you may consider using this option. It splits the spool
8725 directory into subdirectories to avoid file system degradation from
8726 many files in a single directory, resulting in better performance.
8727 Manual manipulation of queued messages becomes more complex (though fortunately
8728 not often needed).
8729 </para>
8730 <literallayout class="monospaced">
8731 # split_spool_directory = true
8732 </literallayout>
8733 <para>
8734 In an ideal world everybody follows the standards. For non-ASCII
8735 messages RFC 2047 is a standard, allowing a maximum line length of 76
8736 characters. Exim adheres that standard and won&#x2019;t process messages which
8737 violate this standard. (Even ${rfc2047:...} expansions will fail.)
8738 In particular, the Exim maintainers have had multiple reports of
8739 problems from Russian administrators of issues until they disable this
8740 check, because of some popular, yet buggy, mail composition software.
8741 </para>
8742 <literallayout class="monospaced">
8743 # check_rfc2047_length = false
8744 </literallayout>
8745 <para>
8746 If you need to be strictly RFC compliant you may wish to disable the
8747 8BITMIME advertisement. Use this, if you exchange mails with systems
8748 that are not 8-bit clean.
8749 </para>
8750 <literallayout class="monospaced">
8751 # accept_8bitmime = false
8752 </literallayout>
8753 <para>
8754 Libraries you use may depend on specific environment settings.  This
8755 imposes a security risk (e.g. PATH). There are two lists:
8756 <option>keep_environment</option> for the variables to import as they are, and
8757 <option>add_environment</option> for variables we want to set to a fixed value.
8758 Note that TZ is handled separately, by the $%timezone%$ runtime
8759 option and by the TIMEZONE_DEFAULT buildtime option.
8760 </para>
8761 <literallayout class="monospaced">
8762 # keep_environment = ^LDAP
8763 # add_environment = PATH=/usr/bin::/bin
8764 </literallayout>
8765 </section>
8766 <section id="SECID54">
8767 <title>ACL configuration</title>
8768 <para>
8769 <indexterm role="concept">
8770 <primary>default</primary>
8771 <secondary>ACLs</secondary>
8772 </indexterm>
8773 <indexterm role="concept">
8774 <primary>access control lists (ACLs)</primary>
8775 <secondary>default configuration</secondary>
8776 </indexterm>
8777 In the default configuration, the ACL section follows the main configuration.
8778 It starts with the line
8779 </para>
8780 <literallayout class="monospaced">
8781 begin acl
8782 </literallayout>
8783 <para>
8784 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8785 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8786 and <option>acl_smtp_data</option> above.
8787 </para>
8788 <para>
8789 <indexterm role="concept">
8790 <primary>RCPT</primary>
8791 <secondary>ACL for</secondary>
8792 </indexterm>
8793 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8794 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8795 are considered in order, until the recipient address is either accepted or
8796 rejected. The RCPT command is then accepted or rejected, according to the
8797 result of the ACL processing.
8798 </para>
8799 <literallayout class="monospaced">
8800 acl_check_rcpt:
8801 </literallayout>
8802 <para>
8803 This line, consisting of a name terminated by a colon, marks the start of the
8804 ACL, and names it.
8805 </para>
8806 <literallayout class="monospaced">
8807 accept  hosts = :
8808 </literallayout>
8809 <para>
8810 This ACL statement accepts the recipient if the sending host matches the list.
8811 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8812 names or IP addresses. The presence of the colon puts an empty item in the
8813 list; Exim matches this only if the incoming message did not come from a remote
8814 host, because in that case, the remote hostname is empty. The colon is
8815 important. Without it, the list itself is empty, and can never match anything.
8816 </para>
8817 <para>
8818 What this statement is doing is to accept unconditionally all recipients in
8819 messages that are submitted by SMTP from local processes using the standard
8820 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8821 manner.
8822 </para>
8823 <literallayout class="monospaced">
8824 deny    message       = Restricted characters in address
8825         domains       = +local_domains
8826         local_parts   = ^[.] : ^.*[@%!/|]
8827
8828 deny    message       = Restricted characters in address
8829         domains       = !+local_domains
8830         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8831 </literallayout>
8832 <para>
8833 These statements are concerned with local parts that contain any of the
8834 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8835 Although these characters are entirely legal in local parts (in the case of
8836 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8837 in Internet mail addresses.
8838 </para>
8839 <para>
8840 The first three have in the past been associated with explicitly routed
8841 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8842 option). Addresses containing these characters are regularly tried by spammers
8843 in an attempt to bypass relaying restrictions, and also by open relay testing
8844 programs. Unless you really need them it is safest to reject these characters
8845 at this early stage. This configuration is heavy-handed in rejecting these
8846 characters for all messages it accepts from remote hosts. This is a deliberate
8847 policy of being as safe as possible.
8848 </para>
8849 <para>
8850 The first rule above is stricter, and is applied to messages that are addressed
8851 to one of the local domains handled by this host. This is implemented by the
8852 first condition, which restricts it to domains that are listed in the
8853 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8854 reference to a named list. In this configuration, there is just one domain in
8855 <emphasis>local_domains</emphasis>, but in general there may be many.
8856 </para>
8857 <para>
8858 The second condition on the first statement uses two regular expressions to
8859 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8860 or <quote>|</quote>. If you have local accounts that include these characters, you will
8861 have to modify this rule.
8862 </para>
8863 <para>
8864 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8865 allows them because they have been encountered in practice. (Consider the
8866 common convention of local parts constructed as
8867 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8868 the author of Exim, who has no second initial.) However, a local part starting
8869 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8870 file name (for example, for a mailing list). This is also true for local parts
8871 that contain slashes. A pipe symbol can also be troublesome if the local part
8872 is incorporated unthinkingly into a shell command line.
8873 </para>
8874 <para>
8875 The second rule above applies to all other domains, and is less strict. This
8876 allows your own users to send outgoing messages to sites that use slashes
8877 and vertical bars in their local parts. It blocks local parts that begin
8878 with a dot, slash, or vertical bar, but allows these characters within the
8879 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8880 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8881 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8882 </para>
8883 <literallayout class="monospaced">
8884 accept  local_parts   = postmaster
8885         domains       = +local_domains
8886 </literallayout>
8887 <para>
8888 This statement, which has two conditions, accepts an incoming address if the
8889 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8890 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8891 reference to a named list. In this configuration, there is just one domain in
8892 <emphasis>local_domains</emphasis>, but in general there may be many.
8893 </para>
8894 <para>
8895 The presence of this statement means that mail to postmaster is never blocked
8896 by any of the subsequent tests. This can be helpful while sorting out problems
8897 in cases where the subsequent tests are incorrectly denying access.
8898 </para>
8899 <literallayout class="monospaced">
8900 require verify        = sender
8901 </literallayout>
8902 <para>
8903 This statement requires the sender address to be verified before any subsequent
8904 ACL statement can be used. If verification fails, the incoming recipient
8905 address is refused. Verification consists of trying to route the address, to
8906 see if a bounce message could be delivered to it. In the case of remote
8907 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8908 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8909 discusses the details of address verification.
8910 </para>
8911 <literallayout class="monospaced">
8912 accept  hosts         = +relay_from_hosts
8913         control       = submission
8914 </literallayout>
8915 <para>
8916 This statement accepts the address if the message is coming from one of the
8917 hosts that are defined as being allowed to relay through this host. Recipient
8918 verification is omitted here, because in many cases the clients are dumb MUAs
8919 that do not cope well with SMTP error responses. For the same reason, the
8920 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8921 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8922 messages that are deficient in some way, for example, because they lack a
8923 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8924 probably add recipient verification here, and disable submission mode.
8925 </para>
8926 <literallayout class="monospaced">
8927 accept  authenticated = *
8928         control       = submission
8929 </literallayout>
8930 <para>
8931 This statement accepts the address if the client host has authenticated itself.
8932 Submission mode is again specified, on the grounds that such messages are most
8933 likely to come from MUAs. The default configuration does not define any
8934 authenticators, though it does include some nearly complete commented-out
8935 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8936 fact authenticate until you complete the authenticator definitions.
8937 </para>
8938 <literallayout class="monospaced">
8939 require message = relay not permitted
8940         domains = +local_domains : +relay_to_domains
8941 </literallayout>
8942 <para>
8943 This statement rejects the address if its domain is neither a local domain nor
8944 one of the domains for which this host is a relay.
8945 </para>
8946 <literallayout class="monospaced">
8947 require verify = recipient
8948 </literallayout>
8949 <para>
8950 This statement requires the recipient address to be verified; if verification
8951 fails, the address is rejected.
8952 </para>
8953 <literallayout class="monospaced">
8954 # deny    message     = rejected because $sender_host_address \
8955 #                       is in a black list at $dnslist_domain\n\
8956 #                       $dnslist_text
8957 #         dnslists    = black.list.example
8958 #
8959 # warn    dnslists    = black.list.example
8960 #         add_header  = X-Warning: $sender_host_address is in \
8961 #                       a black list at $dnslist_domain
8962 #         log_message = found in $dnslist_domain
8963 </literallayout>
8964 <para>
8965 These commented-out lines are examples of how you could configure Exim to check
8966 sending hosts against a DNS black list. The first statement rejects messages
8967 from blacklisted hosts, whereas the second just inserts a warning header
8968 line.
8969 </para>
8970 <literallayout class="monospaced">
8971 # require verify = csa
8972 </literallayout>
8973 <para>
8974 This commented-out line is an example of how you could turn on client SMTP
8975 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8976 records.
8977 </para>
8978 <literallayout class="monospaced">
8979 accept
8980 </literallayout>
8981 <para>
8982 The final statement in the first ACL unconditionally accepts any recipient
8983 address that has successfully passed all the previous tests.
8984 </para>
8985 <literallayout class="monospaced">
8986 acl_check_data:
8987 </literallayout>
8988 <para>
8989 This line marks the start of the second ACL, and names it. Most of the contents
8990 of this ACL are commented out:
8991 </para>
8992 <literallayout class="monospaced">
8993 # deny    malware   = *
8994 #         message   = This message contains a virus \
8995 #                     ($malware_name).
8996 </literallayout>
8997 <para>
8998 These lines are examples of how to arrange for messages to be scanned for
8999 viruses when Exim has been compiled with the content-scanning extension, and a
9000 suitable virus scanner is installed. If the message is found to contain a
9001 virus, it is rejected with the given custom error message.
9002 </para>
9003 <literallayout class="monospaced">
9004 # warn    spam      = nobody
9005 #         message   = X-Spam_score: $spam_score\n\
9006 #                     X-Spam_score_int: $spam_score_int\n\
9007 #                     X-Spam_bar: $spam_bar\n\
9008 #                     X-Spam_report: $spam_report
9009 </literallayout>
9010 <para>
9011 These lines are an example of how to arrange for messages to be scanned by
9012 SpamAssassin when Exim has been compiled with the content-scanning extension,
9013 and SpamAssassin has been installed. The SpamAssassin check is run with
9014 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9015 series of extra header line. In this case, the message is not rejected,
9016 whatever the spam score.
9017 </para>
9018 <literallayout class="monospaced">
9019 accept
9020 </literallayout>
9021 <para>
9022 This final line in the DATA ACL accepts the message unconditionally.
9023 </para>
9024 </section>
9025 <section id="SECID55">
9026 <title>Router configuration</title>
9027 <para>
9028 <indexterm role="concept">
9029 <primary>default</primary>
9030 <secondary>routers</secondary>
9031 </indexterm>
9032 <indexterm role="concept">
9033 <primary>routers</primary>
9034 <secondary>default</secondary>
9035 </indexterm>
9036 The router configuration comes next in the default configuration, introduced
9037 by the line
9038 </para>
9039 <literallayout class="monospaced">
9040 begin routers
9041 </literallayout>
9042 <para>
9043 Routers are the modules in Exim that make decisions about where to send
9044 messages. An address is passed to each router in turn, until it is either
9045 accepted, or failed. This means that the order in which you define the routers
9046 matters. Each router is fully described in its own chapter later in this
9047 manual. Here we give only brief overviews.
9048 </para>
9049 <literallayout class="monospaced">
9050 # domain_literal:
9051 #   driver = ipliteral
9052 #   domains = !+local_domains
9053 #   transport = remote_smtp
9054 </literallayout>
9055 <para>
9056 <indexterm role="concept">
9057 <primary>domain literal</primary>
9058 <secondary>default router</secondary>
9059 </indexterm>
9060 This router is commented out because the majority of sites do not want to
9061 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9062 you uncomment this router, you also need to uncomment the setting of
9063 <option>allow_domain_literals</option> in the main part of the configuration.
9064 </para>
9065 <literallayout class="monospaced">
9066 dnslookup:
9067   driver = dnslookup
9068   domains = ! +local_domains
9069   transport = remote_smtp
9070   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9071   no_more
9072 </literallayout>
9073 <para>
9074 The first uncommented router handles addresses that do not involve any local
9075 domains. This is specified by the line
9076 </para>
9077 <literallayout class="monospaced">
9078 domains = ! +local_domains
9079 </literallayout>
9080 <para>
9081 The <option>domains</option> option lists the domains to which this router applies, but the
9082 exclamation mark is a negation sign, so the router is used only for domains
9083 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9084 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9085 indicates that it is referring to a named list. Addresses in other domains are
9086 passed on to the following routers.
9087 </para>
9088 <para>
9089 The name of the router driver is <command>dnslookup</command>,
9090 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9091 the name of this router instance is the same as the name of the driver. The
9092 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9093 one of the driver modules that is in the Exim binary.
9094 </para>
9095 <para>
9096 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9097 DNS in order to obtain a list of hosts to which the address is routed. If the
9098 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9099 specified by the <option>transport</option> option. If the router does not find the domain
9100 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9101 the address fails and is bounced.
9102 </para>
9103 <para>
9104 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9105 be entirely ignored. This option is present because a number of cases have been
9106 encountered where MX records in the DNS point to host names
9107 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9108 Completely ignoring these IP addresses causes Exim to fail to route the
9109 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9110 continue to try to deliver the message periodically until the address timed
9111 out.
9112 </para>
9113 <literallayout class="monospaced">
9114 system_aliases:
9115   driver = redirect
9116   allow_fail
9117   allow_defer
9118   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9119 # user = exim
9120   file_transport = address_file
9121   pipe_transport = address_pipe
9122 </literallayout>
9123 <para>
9124 Control reaches this and subsequent routers only for addresses in the local
9125 domains. This router checks to see whether the local part is defined as an
9126 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9127 data that it looks up from that file. If no data is found for the local part,
9128 the value of the <option>data</option> option is empty, causing the address to be passed to
9129 the next router.
9130 </para>
9131 <para>
9132 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9133 often used. That is why it is referenced by from the default configuration
9134 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9135 <filename>Local/Makefile</filename> before building Exim.
9136 </para>
9137 <literallayout class="monospaced">
9138 userforward:
9139   driver = redirect
9140   check_local_user
9141 # local_part_suffix = +* : -*
9142 # local_part_suffix_optional
9143   file = $home/.forward
9144 # allow_filter
9145   no_verify
9146   no_expn
9147   check_ancestor
9148   file_transport = address_file
9149   pipe_transport = address_pipe
9150   reply_transport = address_reply
9151 </literallayout>
9152 <para>
9153 This is the most complicated router in the default configuration. It is another
9154 redirection router, but this time it is looking for forwarding data set up by
9155 individual users. The <option>check_local_user</option> setting specifies a check that the
9156 local part of the address is the login name of a local user. If it is not, the
9157 router is skipped. The two commented options that follow <option>check_local_user</option>,
9158 namely:
9159 </para>
9160 <literallayout class="monospaced">
9161 # local_part_suffix = +* : -*
9162 # local_part_suffix_optional
9163 </literallayout>
9164 <para>
9165 <indexterm role="variable">
9166 <primary><varname>$local_part_suffix</varname></primary>
9167 </indexterm>
9168 show how you can specify the recognition of local part suffixes. If the first
9169 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9170 by any sequence of characters, is removed from the local part and placed in the
9171 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9172 presence of a suffix in the local part is optional. When a suffix is present,
9173 the check for a local login uses the local part with the suffix removed.
9174 </para>
9175 <para>
9176 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9177 home directory is consulted. If it does not exist, or is empty, the router
9178 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9179 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9180 </para>
9181 <para>
9182 <indexterm role="concept">
9183 <primary>Sieve filter</primary>
9184 <secondary>enabling in default router</secondary>
9185 </indexterm>
9186 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9187 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9188 is commented out by default), the contents of the file are interpreted as a set
9189 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9190 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9191 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9192 </para>
9193 <para>
9194 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9195 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9196 There are two reasons for doing this:
9197 </para>
9198 <orderedlist numeration="arabic">
9199 <listitem>
9200 <para>
9201 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9202 checking an address for validity; it makes sense not to waste resources doing
9203 unnecessary work.
9204 </para>
9205 </listitem>
9206 <listitem>
9207 <para>
9208 More importantly, when Exim is verifying addresses or handling an EXPN
9209 command during an SMTP session, it is running as the Exim user, not as root.
9210 The group is the Exim group, and no additional groups are set up.
9211 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9212 this time.
9213 </para>
9214 </listitem>
9215 </orderedlist>
9216 <para>
9217 The setting of <option>check_ancestor</option> prevents the router from generating a new
9218 address that is the same as any previous address that was redirected. (This
9219 works round a problem concerning a bad interaction between aliasing and
9220 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9221 </para>
9222 <para>
9223 The final three option settings specify the transports that are to be used when
9224 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9225 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9226 </para>
9227 <literallayout class="monospaced">
9228 a.nother@elsewhere.example, /home/spqr/archive
9229 </literallayout>
9230 <para>
9231 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9232 transport.
9233 </para>
9234 <literallayout class="monospaced">
9235 localuser:
9236   driver = accept
9237   check_local_user
9238 # local_part_suffix = +* : -*
9239 # local_part_suffix_optional
9240   transport = local_delivery
9241 </literallayout>
9242 <para>
9243 The final router sets up delivery into local mailboxes, provided that the local
9244 part is the name of a local login, by accepting the address and assigning it to
9245 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9246 routers, so the address is bounced. The commented suffix settings fulfil the
9247 same purpose as they do for the <command>userforward</command> router.
9248 </para>
9249 </section>
9250 <section id="SECID56">
9251 <title>Transport configuration</title>
9252 <para>
9253 <indexterm role="concept">
9254 <primary>default</primary>
9255 <secondary>transports</secondary>
9256 </indexterm>
9257 <indexterm role="concept">
9258 <primary>transports</primary>
9259 <secondary>default</secondary>
9260 </indexterm>
9261 Transports define mechanisms for actually delivering messages. They operate
9262 only when referenced from routers, so the order in which they are defined does
9263 not matter. The transports section of the configuration starts with
9264 </para>
9265 <literallayout class="monospaced">
9266 begin transports
9267 </literallayout>
9268 <para>
9269 One remote transport and four local transports are defined.
9270 </para>
9271 <literallayout class="monospaced">
9272 remote_smtp:
9273   driver = smtp
9274   hosts_try_prdr = *
9275 </literallayout>
9276 <para>
9277 This transport is used for delivering messages over SMTP connections.
9278 The list of remote hosts comes from the router.
9279 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.
9280 It is negotiated between client and server
9281 and not expected to cause problems but can be disabled if needed.
9282 All other options are defaulted.
9283 </para>
9284 <literallayout class="monospaced">
9285 local_delivery:
9286   driver = appendfile
9287   file = /var/mail/$local_part
9288   delivery_date_add
9289   envelope_to_add
9290   return_path_add
9291 # group = mail
9292 # mode = 0660
9293 </literallayout>
9294 <para>
9295 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9296 traditional BSD mailbox format. By default it runs under the uid and gid of the
9297 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9298 directory. Some systems use the alternative approach of running mail deliveries
9299 under a particular group instead of using the sticky bit. The commented options
9300 show how this can be done.
9301 </para>
9302 <para>
9303 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9304 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9305 similarly-named options above.
9306 </para>
9307 <literallayout class="monospaced">
9308 address_pipe:
9309   driver = pipe
9310   return_output
9311 </literallayout>
9312 <para>
9313 This transport is used for handling deliveries to pipes that are generated by
9314 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9315 option specifies that any output on stdout or stderr generated by the pipe is to
9316 be returned to the sender.
9317 </para>
9318 <literallayout class="monospaced">
9319 address_file:
9320   driver = appendfile
9321   delivery_date_add
9322   envelope_to_add
9323   return_path_add
9324 </literallayout>
9325 <para>
9326 This transport is used for handling deliveries to files that are generated by
9327 redirection. The name of the file is not specified in this instance of
9328 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9329 </para>
9330 <literallayout class="monospaced">
9331 address_reply:
9332   driver = autoreply
9333 </literallayout>
9334 <para>
9335 This transport is used for handling automatic replies generated by users&#x2019;
9336 filter files.
9337 </para>
9338 </section>
9339 <section id="SECID57">
9340 <title>Default retry rule</title>
9341 <para>
9342 <indexterm role="concept">
9343 <primary>retry</primary>
9344 <secondary>default rule</secondary>
9345 </indexterm>
9346 <indexterm role="concept">
9347 <primary>default</primary>
9348 <secondary>retry rule</secondary>
9349 </indexterm>
9350 The retry section of the configuration file contains rules which affect the way
9351 Exim retries deliveries that cannot be completed at the first attempt. It is
9352 introduced by the line
9353 </para>
9354 <literallayout class="monospaced">
9355 begin retry
9356 </literallayout>
9357 <para>
9358 In the default configuration, there is just one rule, which applies to all
9359 errors:
9360 </para>
9361 <literallayout class="monospaced">
9362 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9363 </literallayout>
9364 <para>
9365 This causes any temporarily failing address to be retried every 15 minutes for
9366 2 hours, then at intervals starting at one hour and increasing by a factor of
9367 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9368 is not delivered after 4 days of temporary failure, it is bounced. The time is
9369 measured from first failure, not from the time the message was received.
9370 </para>
9371 <para>
9372 If the retry section is removed from the configuration, or is empty (that is,
9373 if no retry rules are defined), Exim will not retry deliveries. This turns
9374 temporary errors into permanent errors.
9375 </para>
9376 </section>
9377 <section id="SECID58">
9378 <title>Rewriting configuration</title>
9379 <para>
9380 The rewriting section of the configuration, introduced by
9381 </para>
9382 <literallayout class="monospaced">
9383 begin rewrite
9384 </literallayout>
9385 <para>
9386 contains rules for rewriting addresses in messages as they arrive. There are no
9387 rewriting rules in the default configuration file.
9388 </para>
9389 </section>
9390 <section id="SECTdefconfauth">
9391 <title>Authenticators configuration</title>
9392 <para>
9393 <indexterm role="concept">
9394 <primary>AUTH</primary>
9395 <secondary>configuration</secondary>
9396 </indexterm>
9397 The authenticators section of the configuration, introduced by
9398 </para>
9399 <literallayout class="monospaced">
9400 begin authenticators
9401 </literallayout>
9402 <para>
9403 defines mechanisms for the use of the SMTP AUTH command. The default
9404 configuration file contains two commented-out example authenticators
9405 which support plaintext username/password authentication using the
9406 standard PLAIN mechanism and the traditional but non-standard LOGIN
9407 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9408 to support most MUA software.
9409 </para>
9410 <para>
9411 The example PLAIN authenticator looks like this:
9412 </para>
9413 <literallayout class="monospaced">
9414 #PLAIN:
9415 #  driver                  = plaintext
9416 #  server_set_id           = $auth2
9417 #  server_prompts          = :
9418 #  server_condition        = Authentication is not yet configured
9419 #  server_advertise_condition = ${if def:tls_in_cipher }
9420 </literallayout>
9421 <para>
9422 And the example LOGIN authenticator looks like this:
9423 </para>
9424 <literallayout class="monospaced">
9425 #LOGIN:
9426 #  driver                  = plaintext
9427 #  server_set_id           = $auth1
9428 #  server_prompts          = &lt;| Username: | Password:
9429 #  server_condition        = Authentication is not yet configured
9430 #  server_advertise_condition = ${if def:tls_in_cipher }
9431 </literallayout>
9432 <para>
9433 The <option>server_set_id</option> option makes Exim remember the authenticated username
9434 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9435 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9436 that it implements the details of the specific authentication mechanism,
9437 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9438 when Exim offers authentication to clients; in the examples, this is only
9439 when TLS or SSL has been started, so to enable the authenticators you also
9440 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9441 </para>
9442 <para>
9443 The <option>server_condition</option> setting defines how to verify that the username and
9444 password are correct. In the examples it just produces an error message.
9445 To make the authenticators work, you can use a string expansion
9446 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9447 </para>
9448 <para>
9449 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9450 usercode and password are in different positions.
9451 Chapter <xref linkend="CHAPplaintext"/> covers both.
9452 </para>
9453 <para>
9454 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9455 </para>
9456 </section>
9457 </chapter>
9458
9459 <chapter id="CHAPregexp">
9460 <title>Regular expressions</title>
9461 <para>
9462 <indexterm role="concept">
9463 <primary>regular expressions</primary>
9464 <secondary>library</secondary>
9465 </indexterm>
9466 <indexterm role="concept">
9467 <primary>PCRE</primary>
9468 </indexterm>
9469 Exim supports the use of regular expressions in many of its options. It
9470 uses the PCRE regular expression library; this provides regular expression
9471 matching that is compatible with Perl 5. The syntax and semantics of
9472 regular expressions is discussed in
9473 online Perl manpages, in
9474 many Perl reference books, and also in
9475 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9476 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9477 </para>
9478 <para>
9479 The documentation for the syntax and semantics of the regular expressions that
9480 are supported by PCRE is included in the PCRE distribution, and no further
9481 description is included here. The PCRE functions are called from Exim using
9482 the default option settings (that is, with no PCRE options set), except that
9483 the PCRE_CASELESS option is set when the matching is required to be
9484 case-insensitive.
9485 </para>
9486 <para>
9487 In most cases, when a regular expression is required in an Exim configuration,
9488 it has to start with a circumflex, in order to distinguish it from plain text
9489 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9490 second item in the colon-separated list is a regular expression.
9491 </para>
9492 <literallayout class="monospaced">
9493 domains = a.b.c : ^\\d{3} : *.y.z : ...
9494 </literallayout>
9495 <para>
9496 The doubling of the backslash is required because of string expansion that
9497 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9498 of this issue, and a way of avoiding the need for doubling backslashes. The
9499 regular expression that is eventually used in this example contains just one
9500 backslash. The circumflex is included in the regular expression, and has the
9501 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9502 matched.
9503 </para>
9504 <para>
9505 There are, however, two cases where a circumflex is not required for the
9506 recognition of a regular expression: these are the <option>match</option> condition in a
9507 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9508 these cases, the relevant string is always treated as a regular expression; if
9509 it does not start with a circumflex, the expression is not anchored, and can
9510 match anywhere in the subject string.
9511 </para>
9512 <para>
9513 In all cases, if you want a regular expression to match at the end of a string,
9514 you must code the $ metacharacter to indicate this. For example:
9515 </para>
9516 <literallayout class="monospaced">
9517 domains = ^\\d{3}\\.example
9518 </literallayout>
9519 <para>
9520 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9521 You need to use:
9522 </para>
9523 <literallayout class="monospaced">
9524 domains = ^\\d{3}\\.example\$
9525 </literallayout>
9526 <para>
9527 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9528 $ is needed because string expansion also interprets dollar characters.
9529 </para>
9530 </chapter>
9531
9532 <chapter id="CHAPfdlookup">
9533 <title>File and database lookups</title>
9534 <para>
9535 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9536 <primary>file</primary>
9537 <secondary>lookups</secondary>
9538 </indexterm>
9539 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9540 <primary>database</primary>
9541 <secondary>lookups</secondary>
9542 </indexterm>
9543 <indexterm role="concept">
9544 <primary>lookup</primary>
9545 <secondary>description of</secondary>
9546 </indexterm>
9547 Exim can be configured to look up data in files or databases as it processes
9548 messages. Two different kinds of syntax are used:
9549 </para>
9550 <orderedlist numeration="arabic">
9551 <listitem>
9552 <para>
9553 A string that is to be expanded may contain explicit lookup requests. These
9554 cause parts of the string to be replaced by data that is obtained from the
9555 lookup. Lookups of this type are conditional expansion items. Different results
9556 can be defined for the cases of lookup success and failure. See chapter
9557 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9558 The key for the lookup is specified as part of the string expansion.
9559 </para>
9560 </listitem>
9561 <listitem>
9562 <para>
9563 Lists of domains, hosts, and email addresses can contain lookup requests as a
9564 way of avoiding excessively long linear lists. In this case, the data that is
9565 returned by the lookup is often (but not always) discarded; whether the lookup
9566 succeeds or fails is what really counts. These kinds of list are described in
9567 chapter <xref linkend="CHAPdomhosaddlists"/>.
9568 The key for the lookup is given by the context in which the list is expanded.
9569 </para>
9570 </listitem>
9571 </orderedlist>
9572 <para>
9573 String expansions, lists, and lookups interact with each other in such a way
9574 that there is no order in which to describe any one of them that does not
9575 involve references to the others. Each of these three chapters makes more sense
9576 if you have read the other two first. If you are reading this for the first
9577 time, be aware that some of it will make a lot more sense after you have read
9578 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9579 </para>
9580 <section id="SECID60">
9581 <title>Examples of different lookup syntax</title>
9582 <para>
9583 It is easy to confuse the two different kinds of lookup, especially as the
9584 lists that may contain the second kind are always expanded before being
9585 processed as lists. Therefore, they may also contain lookups of the first kind.
9586 Be careful to distinguish between the following two examples:
9587 </para>
9588 <literallayout class="monospaced">
9589 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9590 domains = lsearch;/some/file
9591 </literallayout>
9592 <para>
9593 The first uses a string expansion, the result of which must be a domain list.
9594 No strings have been specified for a successful or a failing lookup; the
9595 defaults in this case are the looked-up data and an empty string, respectively.
9596 The expansion takes place before the string is processed as a list, and the
9597 file that is searched could contain lines like this:
9598 </para>
9599 <literallayout class="monospaced">
9600 192.168.3.4: domain1:domain2:...
9601 192.168.1.9: domain3:domain4:...
9602 </literallayout>
9603 <para>
9604 When the lookup succeeds, the result of the expansion is a list of domains (and
9605 possibly other types of item that are allowed in domain lists).
9606 </para>
9607 <para>
9608 In the second example, the lookup is a single item in a domain list. It causes
9609 Exim to use a lookup to see if the domain that is being processed can be found
9610 in the file. The file could contains lines like this:
9611 </para>
9612 <literallayout class="monospaced">
9613 domain1:
9614 domain2:
9615 </literallayout>
9616 <para>
9617 Any data that follows the keys is not relevant when checking that the domain
9618 matches the list item.
9619 </para>
9620 <para>
9621 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9622 Consider a file containing lines like this:
9623 </para>
9624 <literallayout class="monospaced">
9625 192.168.5.6: lsearch;/another/file
9626 </literallayout>
9627 <para>
9628 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9629 first <option>domains</option> setting above generates the second setting, which therefore
9630 causes a second lookup to occur.
9631 </para>
9632 <para>
9633 The rest of this chapter describes the different lookup types that are
9634 available. Any of them can be used in any part of the configuration where a
9635 lookup is permitted.
9636 </para>
9637 </section>
9638 <section id="SECID61">
9639 <title>Lookup types</title>
9640 <para>
9641 <indexterm role="concept">
9642 <primary>lookup</primary>
9643 <secondary>types of</secondary>
9644 </indexterm>
9645 <indexterm role="concept">
9646 <primary>single-key lookup</primary>
9647 <secondary>definition of</secondary>
9648 </indexterm>
9649 Two different types of data lookup are implemented:
9650 </para>
9651 <itemizedlist>
9652 <listitem>
9653 <para>
9654 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9655 and a single key to search for. The key must be a non-empty string for the
9656 lookup to succeed. The lookup type determines how the file is searched.
9657 </para>
9658 </listitem>
9659 <listitem>
9660 <para>
9661 <indexterm role="concept">
9662 <primary>query-style lookup</primary>
9663 <secondary>definition of</secondary>
9664 </indexterm>
9665 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9666 key value is assumed by Exim for query-style lookups. You can use whichever
9667 Exim variables you need to construct the database query.
9668 </para>
9669 </listitem>
9670 </itemizedlist>
9671 <para>
9672 The code for each lookup type is in a separate source file that is included in
9673 the binary of Exim only if the corresponding compile-time option is set. The
9674 default settings in <filename>src/EDITME</filename> are:
9675 </para>
9676 <literallayout class="monospaced">
9677 LOOKUP_DBM=yes
9678 LOOKUP_LSEARCH=yes
9679 </literallayout>
9680 <para>
9681 which means that only linear searching and DBM lookups are included by default.
9682 For some types of lookup (e.g. SQL databases), you need to install appropriate
9683 libraries and header files before building Exim.
9684 </para>
9685 </section>
9686 <section id="SECTsinglekeylookups">
9687 <title>Single-key lookup types</title>
9688 <para>
9689 <indexterm role="concept">
9690 <primary>lookup</primary>
9691 <secondary>single-key types</secondary>
9692 </indexterm>
9693 <indexterm role="concept">
9694 <primary>single-key lookup</primary>
9695 <secondary>list of types</secondary>
9696 </indexterm>
9697 The following single-key lookup types are implemented:
9698 </para>
9699 <itemizedlist>
9700 <listitem>
9701 <para>
9702 <indexterm role="concept">
9703 <primary>cdb</primary>
9704 <secondary>description of</secondary>
9705 </indexterm>
9706 <indexterm role="concept">
9707 <primary>lookup</primary>
9708 <secondary>cdb</secondary>
9709 </indexterm>
9710 <indexterm role="concept">
9711 <primary>binary zero</primary>
9712 <secondary>in lookup key</secondary>
9713 </indexterm>
9714 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9715 string without a terminating binary zero. The cdb format is designed for
9716 indexed files that are read frequently and never updated, except by total
9717 re-creation. As such, it is particularly suitable for large files containing
9718 aliases or other indexed data referenced by an MTA. Information about cdb can
9719 be found in several places:
9720 </para>
9721 <literallayout>
9722 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9723 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9724 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9725 </literallayout>
9726 <para>
9727 A cdb distribution is not needed in order to build Exim with cdb support,
9728 because the code for reading cdb files is included directly in Exim itself.
9729 However, no means of building or testing cdb files is provided with Exim, so
9730 you need to obtain a cdb distribution in order to do this.
9731 </para>
9732 </listitem>
9733 <listitem>
9734 <para>
9735 <indexterm role="concept">
9736 <primary>DBM</primary>
9737 <secondary>lookup type</secondary>
9738 </indexterm>
9739 <indexterm role="concept">
9740 <primary>lookup</primary>
9741 <secondary>dbm</secondary>
9742 </indexterm>
9743 <indexterm role="concept">
9744 <primary>binary zero</primary>
9745 <secondary>in lookup key</secondary>
9746 </indexterm>
9747 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9748 DBM file by looking up the record with the given key. A terminating binary
9749 zero is included in the key that is passed to the DBM library. See section
9750 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9751 </para>
9752 <para>
9753 <indexterm role="concept">
9754 <primary>Berkeley DB library</primary>
9755 <secondary>file format</secondary>
9756 </indexterm>
9757 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9758 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9759 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9760 the DB_UNKNOWN option. This enables it to handle any of the types of database
9761 that the library supports, and can be useful for accessing DBM files created by
9762 other applications. (For earlier DB versions, DB_HASH is always used.)
9763 </para>
9764 </listitem>
9765 <listitem>
9766 <para>
9767 <indexterm role="concept">
9768 <primary>lookup</primary>
9769 <secondary>dbmjz</secondary>
9770 </indexterm>
9771 <indexterm role="concept">
9772 <primary>lookup</primary>
9773 <secondary>dbm &ndash; embedded NULs</secondary>
9774 </indexterm>
9775 <indexterm role="concept">
9776 <primary>sasldb2</primary>
9777 </indexterm>
9778 <indexterm role="concept">
9779 <primary>dbmjz lookup type</primary>
9780 </indexterm>
9781 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
9782 interpreted as an Exim list; the elements of the list are joined together with
9783 ASCII NUL characters to form the lookup key.  An example usage would be to
9784 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
9785 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
9786 <command>cram_md5</command> authenticator.
9787 </para>
9788 </listitem>
9789 <listitem>
9790 <para>
9791 <indexterm role="concept">
9792 <primary>lookup</primary>
9793 <secondary>dbmnz</secondary>
9794 </indexterm>
9795 <indexterm role="concept">
9796 <primary>lookup</primary>
9797 <secondary>dbm &ndash; terminating zero</secondary>
9798 </indexterm>
9799 <indexterm role="concept">
9800 <primary>binary zero</primary>
9801 <secondary>in lookup key</secondary>
9802 </indexterm>
9803 <indexterm role="concept">
9804 <primary>Courier</primary>
9805 </indexterm>
9806 <indexterm role="concept">
9807 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9808 </indexterm>
9809 <indexterm role="concept">
9810 <primary>dbmnz lookup type</primary>
9811 </indexterm>
9812 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9813 is not included in the key that is passed to the DBM library. You may need this
9814 if you want to look up data in files that are created by or shared with some
9815 other application that does not use terminating zeros. For example, you need to
9816 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9817 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9818 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9819 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9820 </para>
9821 </listitem>
9822 <listitem>
9823 <para>
9824 <indexterm role="concept">
9825 <primary>lookup</primary>
9826 <secondary>dsearch</secondary>
9827 </indexterm>
9828 <indexterm role="concept">
9829 <primary>dsearch lookup type</primary>
9830 </indexterm>
9831 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9832 whose name is the key by calling the <function>lstat()</function> function. The key may not
9833 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9834 the lookup is the name of the entry, which may be a file, directory,
9835 symbolic link, or any other kind of directory entry. An example of how this
9836 lookup can be used to support virtual domains is given in section
9837 <xref linkend="SECTvirtualdomains"/>.
9838 </para>
9839 </listitem>
9840 <listitem>
9841 <para>
9842 <indexterm role="concept">
9843 <primary>lookup</primary>
9844 <secondary>iplsearch</secondary>
9845 </indexterm>
9846 <indexterm role="concept">
9847 <primary>iplsearch lookup type</primary>
9848 </indexterm>
9849 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9850 terminated by a colon or white space or the end of the line. The keys in the
9851 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9852 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9853 being interpreted as a key terminator. For example:
9854 </para>
9855 <literallayout class="monospaced">
9856 1.2.3.4:           data for 1.2.3.4
9857 192.168.0.0/16:    data for 192.168.0.0/16
9858 "abcd::cdab":      data for abcd::cdab
9859 "abcd:abcd::/32"   data for abcd:abcd::/32
9860 </literallayout>
9861 <para>
9862 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9863 file is searched linearly, using the CIDR masks where present, until a matching
9864 key is found. The first key that matches is used; there is no attempt to find a
9865 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9866 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9867 </para>
9868 <para>
9869 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9870 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9871 lookup types support only literal keys.
9872 </para>
9873 <para>
9874 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9875 the implicit key is the host&#x2019;s IP address rather than its name (see section
9876 <xref linkend="SECThoslispatsikey"/>).
9877 </para>
9878 </listitem>
9879 <listitem>
9880 <para>
9881 <indexterm role="concept">
9882 <primary>linear search</primary>
9883 </indexterm>
9884 <indexterm role="concept">
9885 <primary>lookup</primary>
9886 <secondary>lsearch</secondary>
9887 </indexterm>
9888 <indexterm role="concept">
9889 <primary>lsearch lookup type</primary>
9890 </indexterm>
9891 <indexterm role="concept">
9892 <primary>case sensitivity</primary>
9893 <secondary>in lsearch lookup</secondary>
9894 </indexterm>
9895 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9896 line beginning with the search key, terminated by a colon or white space or the
9897 end of the line. The search is case-insensitive; that is, upper and lower case
9898 letters are treated as the same. The first occurrence of the key that is found
9899 in the file is used.
9900 </para>
9901 <para>
9902 White space between the key and the colon is permitted. The remainder of the
9903 line, with leading and trailing white space removed, is the data. This can be
9904 continued onto subsequent lines by starting them with any amount of white
9905 space, but only a single space character is included in the data at such a
9906 junction. If the data begins with a colon, the key must be terminated by a
9907 colon, for example:
9908 </para>
9909 <literallayout class="monospaced">
9910 baduser:  :fail:
9911 </literallayout>
9912 <para>
9913 Empty lines and lines beginning with # are ignored, even if they occur in the
9914 middle of an item. This is the traditional textual format of alias files. Note
9915 that the keys in an <command>lsearch</command> file are literal strings. There is no
9916 wildcarding of any kind.
9917 </para>
9918 <para>
9919 <indexterm role="concept">
9920 <primary>lookup</primary>
9921 <secondary>lsearch &ndash; colons in keys</secondary>
9922 </indexterm>
9923 <indexterm role="concept">
9924 <primary>white space</primary>
9925 <secondary>in lsearch key</secondary>
9926 </indexterm>
9927 In most <command>lsearch</command> files, keys are not required to contain colons or #
9928 characters, or white space. However, if you need this feature, it is available.
9929 If a key begins with a doublequote character, it is terminated only by a
9930 matching quote (or end of line), and the normal escaping rules apply to its
9931 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9932 quoted keys (exactly as for unquoted keys). There is no special handling of
9933 quotes for the data part of an <command>lsearch</command> line.
9934 </para>
9935 </listitem>
9936 <listitem>
9937 <para>
9938 <indexterm role="concept">
9939 <primary>NIS lookup type</primary>
9940 </indexterm>
9941 <indexterm role="concept">
9942 <primary>lookup</primary>
9943 <secondary>NIS</secondary>
9944 </indexterm>
9945 <indexterm role="concept">
9946 <primary>binary zero</primary>
9947 <secondary>in lookup key</secondary>
9948 </indexterm>
9949 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9950 the given key, without a terminating binary zero. There is a variant called
9951 <command>nis0</command> which does include the terminating binary zero in the key. This is
9952 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9953 aliases; the full map names must be used.
9954 </para>
9955 </listitem>
9956 <listitem>
9957 <para>
9958 <indexterm role="concept">
9959 <primary>wildlsearch lookup type</primary>
9960 </indexterm>
9961 <indexterm role="concept">
9962 <primary>lookup</primary>
9963 <secondary>wildlsearch</secondary>
9964 </indexterm>
9965 <indexterm role="concept">
9966 <primary>nwildlsearch lookup type</primary>
9967 </indexterm>
9968 <indexterm role="concept">
9969 <primary>lookup</primary>
9970 <secondary>nwildlsearch</secondary>
9971 </indexterm>
9972 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9973 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9974 the file may be wildcarded. The difference between these two lookup types is
9975 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9976 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9977 </para>
9978 <para>
9979 <indexterm role="concept">
9980 <primary>case sensitivity</primary>
9981 <secondary>in (n)wildlsearch lookup</secondary>
9982 </indexterm>
9983 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9984 file that are regular expressions can be made case-sensitive by the use of
9985 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9986 </para>
9987 <orderedlist numeration="arabic">
9988 <listitem>
9989 <para>
9990 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9991 </para>
9992 <literallayout class="monospaced">
9993     *.a.b.c       data for anything.a.b.c
9994     *fish         data for anythingfish
9995 </literallayout>
9996 </listitem>
9997 <listitem>
9998 <para>
9999 The string may begin with a circumflex to indicate a regular expression. For
10000 example, for <command>wildlsearch</command>:
10001 </para>
10002 <literallayout class="monospaced">
10003     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10004 </literallayout>
10005 <para>
10006 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10007 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10008 string-expanded, the equivalent entry is:
10009 </para>
10010 <literallayout class="monospaced">
10011     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10012 </literallayout>
10013 <para>
10014 The case-insensitive flag is set at the start of compiling the regular
10015 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10016 For example, to make the entire pattern case-sensitive:
10017 </para>
10018 <literallayout class="monospaced">
10019     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10020 </literallayout>
10021 <para>
10022 If the regular expression contains white space or colon characters, you must
10023 either quote it (see <command>lsearch</command> above), or represent these characters in other
10024 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10025 colon. This may be easier than quoting, because if you quote, you have to
10026 escape all the backslashes inside the quotes.
10027 </para>
10028 <para>
10029 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10030 match for later use, because the results of all lookups are cached. If a lookup
10031 is repeated, the result is taken from the cache, and no actual pattern matching
10032 takes place. The values of all the numeric variables are unset after a
10033 <command>(n)wildlsearch</command> match.
10034 </para>
10035 </listitem>
10036 <listitem>
10037 <para>
10038 Although I cannot see it being of much use, the general matching function that
10039 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10040 lookup name terminated by a semicolon, and followed by lookup data. For
10041 example:
10042 </para>
10043 <literallayout class="monospaced">
10044     cdb;/some/file  data for keys that match the file
10045 </literallayout>
10046 <para>
10047 The data that is obtained from the nested lookup is discarded.
10048 </para>
10049 </listitem>
10050 </orderedlist>
10051 <para>
10052 Keys that do not match any of these patterns are interpreted literally. The
10053 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10054 be followed by optional colons.
10055 </para>
10056 <para>
10057 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10058 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10059 lookup types support only literal keys.
10060 </para>
10061 </listitem>
10062 </itemizedlist>
10063 </section>
10064 <section id="SECTquerystylelookups">
10065 <title>Query-style lookup types</title>
10066 <para>
10067 <indexterm role="concept">
10068 <primary>lookup</primary>
10069 <secondary>query-style types</secondary>
10070 </indexterm>
10071 <indexterm role="concept">
10072 <primary>query-style lookup</primary>
10073 <secondary>list of types</secondary>
10074 </indexterm>
10075 The supported query-style lookup types are listed below. Further details about
10076 many of them are given in later sections.
10077 </para>
10078 <itemizedlist>
10079 <listitem>
10080 <para>
10081 <indexterm role="concept">
10082 <primary>DNS</primary>
10083 <secondary>as a lookup type</secondary>
10084 </indexterm>
10085 <indexterm role="concept">
10086 <primary>lookup</primary>
10087 <secondary>DNS</secondary>
10088 </indexterm>
10089 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
10090 are given in the supplied query. The resulting data is the contents of the
10091 records. See section <xref linkend="SECTdnsdb"/>.
10092 </para>
10093 </listitem>
10094 <listitem>
10095 <para>
10096 <indexterm role="concept">
10097 <primary>InterBase lookup type</primary>
10098 </indexterm>
10099 <indexterm role="concept">
10100 <primary>lookup</primary>
10101 <secondary>InterBase</secondary>
10102 </indexterm>
10103 <command>ibase</command>: This does a lookup in an InterBase database.
10104 </para>
10105 </listitem>
10106 <listitem>
10107 <para>
10108 <indexterm role="concept">
10109 <primary>LDAP</primary>
10110 <secondary>lookup type</secondary>
10111 </indexterm>
10112 <indexterm role="concept">
10113 <primary>lookup</primary>
10114 <secondary>LDAP</secondary>
10115 </indexterm>
10116 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10117 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10118 that permits values from multiple entries to be returned. A third variant
10119 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10120 any attribute values. See section <xref linkend="SECTldap"/>.
10121 </para>
10122 </listitem>
10123 <listitem>
10124 <para>
10125 <indexterm role="concept">
10126 <primary>MySQL</primary>
10127 <secondary>lookup type</secondary>
10128 </indexterm>
10129 <indexterm role="concept">
10130 <primary>lookup</primary>
10131 <secondary>MySQL</secondary>
10132 </indexterm>
10133 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10134 MySQL database. See section <xref linkend="SECTsql"/>.
10135 </para>
10136 </listitem>
10137 <listitem>
10138 <para>
10139 <indexterm role="concept">
10140 <primary>NIS+ lookup type</primary>
10141 </indexterm>
10142 <indexterm role="concept">
10143 <primary>lookup</primary>
10144 <secondary>NIS+</secondary>
10145 </indexterm>
10146 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10147 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10148 </para>
10149 </listitem>
10150 <listitem>
10151 <para>
10152 <indexterm role="concept">
10153 <primary>Oracle</primary>
10154 <secondary>lookup type</secondary>
10155 </indexterm>
10156 <indexterm role="concept">
10157 <primary>lookup</primary>
10158 <secondary>Oracle</secondary>
10159 </indexterm>
10160 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10161 Oracle database. See section <xref linkend="SECTsql"/>.
10162 </para>
10163 </listitem>
10164 <listitem>
10165 <para>
10166 <indexterm role="concept">
10167 <primary>lookup</primary>
10168 <secondary>passwd</secondary>
10169 </indexterm>
10170 <indexterm role="concept">
10171 <primary>passwd lookup type</primary>
10172 </indexterm>
10173 <indexterm role="concept">
10174 <primary><filename>/etc/passwd</filename></primary>
10175 </indexterm>
10176 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10177 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10178 success, the result string is the same as you would get from an <command>lsearch</command>
10179 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10180 password value. For example:
10181 </para>
10182 <literallayout class="monospaced">
10183 *:42:42:King Rat:/home/kr:/bin/bash
10184 </literallayout>
10185 </listitem>
10186 <listitem>
10187 <para>
10188 <indexterm role="concept">
10189 <primary>PostgreSQL lookup type</primary>
10190 </indexterm>
10191 <indexterm role="concept">
10192 <primary>lookup</primary>
10193 <secondary>PostgreSQL</secondary>
10194 </indexterm>
10195 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10196 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10197 </para>
10198 </listitem>
10199 <listitem>
10200 <para>
10201 <indexterm role="concept">
10202 <primary>Redis lookup type</primary>
10203 </indexterm>
10204 <indexterm role="concept">
10205 <primary>lookup</primary>
10206 <secondary>Redis</secondary>
10207 </indexterm>
10208 <command>redis</command>: The format of the query is either a simple get or simple set,
10209 passed to a Redis database. See section <xref linkend="SECTsql"/>.
10210 </para>
10211 </listitem>
10212 <listitem>
10213 <para>
10214 <indexterm role="concept">
10215 <primary>sqlite lookup type</primary>
10216 </indexterm>
10217 <indexterm role="concept">
10218 <primary>lookup</primary>
10219 <secondary>sqlite</secondary>
10220 </indexterm>
10221 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
10222 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10223 </para>
10224 </listitem>
10225 <listitem>
10226 <para>
10227 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10228 not likely to be useful in normal operation.
10229 </para>
10230 </listitem>
10231 <listitem>
10232 <para>
10233 <indexterm role="concept">
10234 <primary>whoson lookup type</primary>
10235 </indexterm>
10236 <indexterm role="concept">
10237 <primary>lookup</primary>
10238 <secondary>whoson</secondary>
10239 </indexterm>
10240 <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
10241 allows a server to check whether a particular (dynamically allocated) IP
10242 address is currently allocated to a known (trusted) user and, optionally, to
10243 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10244 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10245 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10246 <quote>POP before SMTP</quote> checking using ACL statements such as
10247 </para>
10248 <literallayout class="monospaced">
10249 require condition = \
10250   ${lookup whoson {$sender_host_address}{yes}{no}}
10251 </literallayout>
10252 <para>
10253 The query consists of a single IP address. The value returned is the name of
10254 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10255 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10256 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10257 </para>
10258 </listitem>
10259 </itemizedlist>
10260 </section>
10261 <section id="SECID63">
10262 <title>Temporary errors in lookups</title>
10263 <para>
10264 <indexterm role="concept">
10265 <primary>lookup</primary>
10266 <secondary>temporary error in</secondary>
10267 </indexterm>
10268 Lookup functions can return temporary error codes if the lookup cannot be
10269 completed. For example, an SQL or LDAP database might be unavailable. For this
10270 reason, it is not advisable to use a lookup that might do this for critical
10271 options such as a list of local domains.
10272 </para>
10273 <para>
10274 When a lookup cannot be completed in a router or transport, delivery
10275 of the message (to the relevant address) is deferred, as for any other
10276 temporary error. In other circumstances Exim may assume the lookup has failed,
10277 or may give up altogether.
10278 </para>
10279 </section>
10280 <section id="SECTdefaultvaluelookups">
10281 <title>Default values in single-key lookups</title>
10282 <para>
10283 <indexterm role="concept">
10284 <primary>wildcard lookups</primary>
10285 </indexterm>
10286 <indexterm role="concept">
10287 <primary>lookup</primary>
10288 <secondary>default values</secondary>
10289 </indexterm>
10290 <indexterm role="concept">
10291 <primary>lookup</primary>
10292 <secondary>wildcard</secondary>
10293 </indexterm>
10294 <indexterm role="concept">
10295 <primary>lookup</primary>
10296 <secondary>* added to type</secondary>
10297 </indexterm>
10298 <indexterm role="concept">
10299 <primary>default</primary>
10300 <secondary>in single-key lookups</secondary>
10301 </indexterm>
10302 In this context, a <quote>default value</quote> is a value specified by the administrator
10303 that is to be used if a lookup fails.
10304 </para>
10305 <para>
10306 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10307 lookups, the facilities of the query language must be used. An attempt to
10308 specify a default for a query-style lookup provokes an error.
10309 </para>
10310 <para>
10311 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10312 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10313 provide a default value. See also the section on partial matching below.
10314 </para>
10315 <para>
10316 <indexterm role="concept">
10317 <primary>*@ with single-key lookup</primary>
10318 </indexterm>
10319 <indexterm role="concept">
10320 <primary>lookup</primary>
10321 <secondary>*@ added to type</secondary>
10322 </indexterm>
10323 <indexterm role="concept">
10324 <primary>alias file</primary>
10325 <secondary>per-domain default</secondary>
10326 </indexterm>
10327 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10328 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10329 character, a second lookup is done with everything before the last @ replaced
10330 by *. This makes it possible to provide per-domain defaults in alias files
10331 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10332 take place because there is no @ in the key), <quote>*</quote> is looked up.
10333 For example, a <command>redirect</command> router might contain:
10334 </para>
10335 <literallayout class="monospaced">
10336 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10337 </literallayout>
10338 <para>
10339 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10340 looks up these keys, in this order:
10341 </para>
10342 <literallayout class="monospaced">
10343 jane@eyre.example
10344 *@eyre.example
10345 *
10346 </literallayout>
10347 <para>
10348 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10349 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10350 complete scan is done for each key, and only if it is not found at all does
10351 Exim move on to try the next key.
10352 </para>
10353 </section>
10354 <section id="SECTpartiallookup">
10355 <title>Partial matching in single-key lookups</title>
10356 <para>
10357 <indexterm role="concept">
10358 <primary>partial matching</primary>
10359 </indexterm>
10360 <indexterm role="concept">
10361 <primary>wildcard lookups</primary>
10362 </indexterm>
10363 <indexterm role="concept">
10364 <primary>lookup</primary>
10365 <secondary>partial matching</secondary>
10366 </indexterm>
10367 <indexterm role="concept">
10368 <primary>lookup</primary>
10369 <secondary>wildcard</secondary>
10370 </indexterm>
10371 <indexterm role="concept">
10372 <primary>asterisk</primary>
10373 <secondary>in search type</secondary>
10374 </indexterm>
10375 The normal operation of a single-key lookup is to search the file for an exact
10376 match with the given key. However, in a number of situations where domains are
10377 being looked up, it is useful to be able to do partial matching. In this case,
10378 information in the file that has a key starting with <quote>*.</quote> is matched by any
10379 domain that ends with the components that follow the full stop. For example, if
10380 a key in a DBM file is
10381 </para>
10382 <literallayout class="monospaced">
10383 *.dates.fict.example
10384 </literallayout>
10385 <para>
10386 then when partial matching is enabled this is matched by (amongst others)
10387 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10388 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10389 file.
10390 </para>
10391 <para>
10392 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10393 also not available for any lookup items in address lists (see section
10394 <xref linkend="SECTaddresslist"/>).
10395 </para>
10396 <para>
10397 Partial matching is implemented by doing a series of separate lookups using
10398 keys constructed by modifying the original subject key. This means that it can
10399 be used with any of the single-key lookup types, provided that
10400 partial matching keys
10401 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10402 Keys in the file that do not begin with the prefix are matched only by
10403 unmodified subject keys when partial matching is in use.
10404 </para>
10405 <para>
10406 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10407 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10408 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10409 is added at the start of the subject key, and it is looked up again. If that
10410 fails, further lookups are tried with dot-separated components removed from the
10411 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10412 remains.
10413 </para>
10414 <para>
10415 A minimum number of two non-* components are required. This can be adjusted
10416 by including a number before the hyphen in the search type. For example,
10417 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10418 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10419 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10420 up when the minimum number of non-* components is two:
10421 </para>
10422 <literallayout class="monospaced">
10423 2250.dates.fict.example
10424 *.2250.dates.fict.example
10425 *.dates.fict.example
10426 *.fict.example
10427 </literallayout>
10428 <para>
10429 As soon as one key in the sequence is successfully looked up, the lookup
10430 finishes.
10431 </para>
10432 <para>
10433 <indexterm role="concept">
10434 <primary>lookup</primary>
10435 <secondary>partial matching &ndash; changing prefix</secondary>
10436 </indexterm>
10437 <indexterm role="concept">
10438 <primary>prefix</primary>
10439 <secondary>for partial matching</secondary>
10440 </indexterm>
10441 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10442 changed. The motivation for this feature is to allow Exim to operate with file
10443 formats that are used by other MTAs. A different prefix can be supplied in
10444 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10445 </para>
10446 <literallayout class="monospaced">
10447 domains = partial(.)lsearch;/some/file
10448 </literallayout>
10449 <para>
10450 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10451 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10452 components is unchanged). The prefix may consist of any punctuation characters
10453 other than a closing parenthesis. It may be empty, for example:
10454 </para>
10455 <literallayout class="monospaced">
10456 domains = partial1()cdb;/some/file
10457 </literallayout>
10458 <para>
10459 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10460 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10461 </para>
10462 <para>
10463 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10464 just one non-wild component has failed, and the original key is shortened right
10465 down to the null string) depends on the prefix:
10466 </para>
10467 <itemizedlist>
10468 <listitem>
10469 <para>
10470 If the prefix has zero length, the whole lookup fails.
10471 </para>
10472 </listitem>
10473 <listitem>
10474 <para>
10475 If the prefix has length 1, a lookup for just the prefix is done. For
10476 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10477 </para>
10478 </listitem>
10479 <listitem>
10480 <para>
10481 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10482 remainder is looked up. With the default prefix, therefore, the final lookup is
10483 for <quote>*</quote> on its own.
10484 </para>
10485 </listitem>
10486 <listitem>
10487 <para>
10488 Otherwise, the whole prefix is looked up.
10489 </para>
10490 </listitem>
10491 </itemizedlist>
10492 <para>
10493 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10494 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10495 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10496 specified, adding <quote>*</quote> to the search type has no effect with the default
10497 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10498 lookups. However, there might be a use for lookup types such as
10499 <quote>partial0(.)lsearch*</quote>.
10500 </para>
10501 <para>
10502 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10503 in domain lists and the like. Partial matching works only in terms of
10504 dot-separated components; a key such as <literal>*fict.example</literal>
10505 in a database file is useless, because the asterisk in a partial matching
10506 subject key is always followed by a dot.
10507 </para>
10508 </section>
10509 <section id="SECID64">
10510 <title>Lookup caching</title>
10511 <para>
10512 <indexterm role="concept">
10513 <primary>lookup</primary>
10514 <secondary>caching</secondary>
10515 </indexterm>
10516 <indexterm role="concept">
10517 <primary>caching</primary>
10518 <secondary>lookup data</secondary>
10519 </indexterm>
10520 Exim caches all lookup results in order to avoid needless repetition of
10521 lookups. However, because (apart from the daemon) Exim operates as a collection
10522 of independent, short-lived processes, this caching applies only within a
10523 single Exim process. There is no inter-process lookup caching facility.
10524 </para>
10525 <para>
10526 For single-key lookups, Exim keeps the relevant files open in case there is
10527 another lookup that needs them. In some types of configuration this can lead to
10528 many files being kept open for messages with many recipients. To avoid hitting
10529 the operating system limit on the number of simultaneously open files, Exim
10530 closes the least recently used file when it needs to open more files than its
10531 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10532 </para>
10533 <para>
10534 The single-key lookup files are closed and the lookup caches are flushed at
10535 strategic points during delivery &ndash; for example, after all routing is
10536 complete.
10537 </para>
10538 </section>
10539 <section id="SECID65">
10540 <title>Quoting lookup data</title>
10541 <para>
10542 <indexterm role="concept">
10543 <primary>lookup</primary>
10544 <secondary>quoting</secondary>
10545 </indexterm>
10546 <indexterm role="concept">
10547 <primary>quoting</primary>
10548 <secondary>in lookups</secondary>
10549 </indexterm>
10550 When data from an incoming message is included in a query-style lookup, there
10551 is the possibility of special characters in the data messing up the syntax of
10552 the query. For example, a NIS+ query that contains
10553 </para>
10554 <literallayout class="monospaced">
10555 [name=$local_part]
10556 </literallayout>
10557 <para>
10558 will be broken if the local part happens to contain a closing square bracket.
10559 For NIS+, data can be enclosed in double quotes like this:
10560 </para>
10561 <literallayout class="monospaced">
10562 [name="$local_part"]
10563 </literallayout>
10564 <para>
10565 but this still leaves the problem of a double quote in the data. The rule for
10566 NIS+ is that double quotes must be doubled. Other lookup types have different
10567 rules, and to cope with the differing requirements, an expansion operator
10568 of the following form is provided:
10569 </para>
10570 <literallayout class="monospaced">
10571 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
10572 </literallayout>
10573 <para>
10574 For example, the safest way to write the NIS+ query is
10575 </para>
10576 <literallayout class="monospaced">
10577 [name="${quote_nisplus:$local_part}"]
10578 </literallayout>
10579 <para>
10580 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10581 operator can be used for all lookup types, but has no effect for single-key
10582 lookups, since no quoting is ever needed in their key strings.
10583 </para>
10584 </section>
10585 <section id="SECTdnsdb">
10586 <title>More about dnsdb</title>
10587 <para>
10588 <indexterm role="concept">
10589 <primary>dnsdb lookup</primary>
10590 </indexterm>
10591 <indexterm role="concept">
10592 <primary>lookup</primary>
10593 <secondary>dnsdb</secondary>
10594 </indexterm>
10595 <indexterm role="concept">
10596 <primary>DNS</primary>
10597 <secondary>as a lookup type</secondary>
10598 </indexterm>
10599 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10600 of a record type and a domain name, separated by an equals sign. For example,
10601 an expansion string could contain:
10602 </para>
10603 <literallayout class="monospaced">
10604 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10605 </literallayout>
10606 <para>
10607 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10608 is used on its own as the result. If the lookup does not succeed, the
10609 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
10610 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10611 </para>
10612 <para>
10613 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
10614 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
10615 If no type is given, TXT is assumed.
10616 </para>
10617 <para>
10618 For any record type, if multiple records are found, the data is returned as a
10619 concatenation, with newline as the default separator. The order, of course,
10620 depends on the DNS resolver. You can specify a different separator character
10621 between multiple records by putting a right angle-bracket followed immediately
10622 by the new separator at the start of the query. For example:
10623 </para>
10624 <literallayout class="monospaced">
10625 ${lookup dnsdb{&gt;: a=host1.example}}
10626 </literallayout>
10627 <para>
10628 It is permitted to specify a space as the separator character. Further
10629 white space is ignored.
10630 For lookup types that return multiple fields per record,
10631 an alternate field separator can be specified using a comma after the main
10632 separator character, followed immediately by the field separator.
10633 </para>
10634 <para>
10635 <indexterm role="concept">
10636 <primary>PTR record</primary>
10637 <secondary>in <command>dnsdb</command> lookup</secondary>
10638 </indexterm>
10639 When the type is PTR,
10640 the data can be an IP address, written as normal; inversion and the addition of
10641 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10642 </para>
10643 <literallayout class="monospaced">
10644 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10645 </literallayout>
10646 <para>
10647 If the data for a PTR record is not a syntactically valid IP address, it is not
10648 altered and nothing is added.
10649 </para>
10650 <para>
10651 <indexterm role="concept">
10652 <primary>MX record</primary>
10653 <secondary>in <command>dnsdb</command> lookup</secondary>
10654 </indexterm>
10655 <indexterm role="concept">
10656 <primary>SRV record</primary>
10657 <secondary>in <command>dnsdb</command> lookup</secondary>
10658 </indexterm>
10659 For an MX lookup, both the preference value and the host name are returned for
10660 each record, separated by a space. For an SRV lookup, the priority, weight,
10661 port, and host name are returned for each record, separated by spaces.
10662 The field separator can be modified as above.
10663 </para>
10664 <para>
10665 <indexterm role="concept">
10666 <primary>TXT record</primary>
10667 <secondary>in <command>dnsdb</command> lookup</secondary>
10668 </indexterm>
10669 <indexterm role="concept">
10670 <primary>SPF record</primary>
10671 <secondary>in <command>dnsdb</command> lookup</secondary>
10672 </indexterm>
10673 For TXT records with multiple items of data, only the first item is returned,
10674 unless a field separator is specified.
10675 To concatenate items without a separator, use a semicolon instead.
10676 For SPF records the
10677 default behaviour is to concatenate multiple items without using a separator.
10678 </para>
10679 <literallayout class="monospaced">
10680 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
10681 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
10682 ${lookup dnsdb{spf=example.org}}
10683 </literallayout>
10684 <para>
10685 It is permitted to specify a space as the separator character. Further
10686 white space is ignored.
10687 </para>
10688 <para>
10689 <indexterm role="concept">
10690 <primary>SOA record</primary>
10691 <secondary>in <command>dnsdb</command> lookup</secondary>
10692 </indexterm>
10693 For an SOA lookup, while no result is obtained the lookup is redone with
10694 successively more leading components dropped from the given domain.
10695 Only the primary-nameserver field is returned unless a field separator is
10696 specified.
10697 </para>
10698 <literallayout class="monospaced">
10699 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
10700 </literallayout>
10701 </section>
10702 <section id="SECTdnsdb_mod">
10703 <title>Dnsdb lookup modifiers</title>
10704 <para>
10705 <indexterm role="concept">
10706 <primary>dnsdb modifiers</primary>
10707 </indexterm>
10708 <indexterm role="concept">
10709 <primary>modifiers</primary>
10710 <secondary>dnsdb</secondary>
10711 </indexterm>
10712 <indexterm role="concept">
10713 <primary>options</primary>
10714 <secondary>dnsdb</secondary>
10715 </indexterm>
10716 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
10717 each followed by a comma,
10718 that may appear before the record type.
10719 </para>
10720 <para>
10721 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10722 temporary DNS error for any of them, the behaviour is controlled by
10723 a defer-option modifier.
10724 The possible keywords are
10725 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
10726 With <quote>strict</quote> behaviour, any temporary DNS error causes the
10727 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10728 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10729 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10730 error causes the whole lookup to defer only if none of the other lookups
10731 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10732 </para>
10733 <literallayout class="monospaced">
10734 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10735 ${lookup dnsdb{a=one.host.com:two.host.com}}
10736 </literallayout>
10737 <para>
10738 Thus, in the default case, as long as at least one of the DNS lookups
10739 yields some data, the lookup succeeds.
10740 </para>
10741 <para>
10742 <indexterm role="concept">
10743 <primary>DNSSEC</primary>
10744 <secondary>dns lookup</secondary>
10745 </indexterm>
10746 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
10747 The possible keywords are
10748 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
10749 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
10750 with the lookup.
10751 With <quote>strict</quote> a response from the DNS resolver that
10752 is not labelled as authenticated data
10753 is treated as equivalent to a temporary DNS error.
10754 The default is <quote>never</quote>.
10755 </para>
10756 <para>
10757 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
10758 </para>
10759 <para>
10760 <indexterm role="concept">
10761 <primary>timeout</primary>
10762 <secondary>dns lookup</secondary>
10763 </indexterm>
10764 <indexterm role="concept">
10765 <primary>DNS</primary>
10766 <secondary>timeout</secondary>
10767 </indexterm>
10768 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
10769 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
10770 (e.g. <quote>5s</quote>).
10771 The default value is set by the main configuration option <option>dns_retrans</option>.
10772 </para>
10773 <para>
10774 Retries for the dnsdb lookup can be controlled by a retry modifier.
10775 The form if <quote>retry_VAL</quote> where VAL is an integer.
10776 The default count is set by the main configuration option <option>dns_retry</option>.
10777 </para>
10778 <para>
10779 <indexterm role="concept">
10780 <primary>caching</primary>
10781 <secondary>of dns lookup</secondary>
10782 </indexterm>
10783 <indexterm role="concept">
10784 <primary>TTL</primary>
10785 <secondary>of dns lookup</secondary>
10786 </indexterm>
10787 <indexterm role="concept">
10788 <primary>DNS</primary>
10789 <secondary>TTL</secondary>
10790 </indexterm>
10791 Dnsdb lookup results are cached within a single process (and its children).
10792 The cache entry lifetime is limited to the smallest time-to-live (TTL)
10793 value of the set of returned DNS records.
10794 </para>
10795 </section>
10796 <section id="SECID66">
10797 <title>Pseudo dnsdb record types</title>
10798 <para>
10799 <indexterm role="concept">
10800 <primary>MX record</primary>
10801 <secondary>in <command>dnsdb</command> lookup</secondary>
10802 </indexterm>
10803 By default, both the preference value and the host name are returned for
10804 each MX record, separated by a space. If you want only host names, you can use
10805 the pseudo-type MXH:
10806 </para>
10807 <literallayout class="monospaced">
10808 ${lookup dnsdb{mxh=a.b.example}}
10809 </literallayout>
10810 <para>
10811 In this case, the preference values are omitted, and just the host names are
10812 returned.
10813 </para>
10814 <para>
10815 <indexterm role="concept">
10816 <primary>name server for enclosing domain</primary>
10817 </indexterm>
10818 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10819 records on the given domain, but if none are found, it removes the first
10820 component of the domain name, and tries again. This process continues until NS
10821 records are found or there are no more components left (or there is a DNS
10822 error). In other words, it may return the name servers for a top-level domain,
10823 but it never returns the root name servers. If there are no NS records for the
10824 top-level domain, the lookup fails. Consider these examples:
10825 </para>
10826 <literallayout class="monospaced">
10827 ${lookup dnsdb{zns=xxx.quercite.com}}
10828 ${lookup dnsdb{zns=xxx.edu}}
10829 </literallayout>
10830 <para>
10831 Assuming that in each case there are no NS records for the full domain name,
10832 the first returns the name servers for <option>quercite.com</option>, and the second returns
10833 the name servers for <option>edu</option>.
10834 </para>
10835 <para>
10836 You should be careful about how you use this lookup because, unless the
10837 top-level domain does not exist, the lookup always returns some host names. The
10838 sort of use to which this might be put is for seeing if the name servers for a
10839 given domain are on a blacklist. You can probably assume that the name servers
10840 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10841 such a list.
10842 </para>
10843 <para>
10844 <indexterm role="concept">
10845 <primary>CSA</primary>
10846 <secondary>in <command>dnsdb</command> lookup</secondary>
10847 </indexterm>
10848 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10849 records according to the CSA rules, which are described in section
10850 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10851 not sufficient because of the extra parent domain search behaviour of CSA. The
10852 result of a successful lookup such as:
10853 </para>
10854 <literallayout class="monospaced">
10855 ${lookup dnsdb {csa=$sender_helo_name}}
10856 </literallayout>
10857 <para>
10858 has two space-separated fields: an authorization code and a target host name.
10859 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10860 authorization required but absent, or <quote>?</quote> for unknown.
10861 </para>
10862 <para>
10863 <indexterm role="concept">
10864 <primary>A+</primary>
10865 <secondary>in <command>dnsdb</command> lookup</secondary>
10866 </indexterm>
10867 The pseudo-type A+ performs an AAAA
10868 and then an A lookup.  All results are returned; defer processing
10869 (see below) is handled separately for each lookup.  Example:
10870 </para>
10871 <literallayout class="monospaced">
10872 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
10873 </literallayout>
10874 </section>
10875 <section id="SECID67">
10876 <title>Multiple dnsdb lookups</title>
10877 <para>
10878 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10879 However, you can specify a list of domains or IP addresses in a single
10880 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10881 the default separator, but with the ability to change this. For example:
10882 </para>
10883 <literallayout class="monospaced">
10884 ${lookup dnsdb{one.domain.com:two.domain.com}}
10885 ${lookup dnsdb{a=one.host.com:two.host.com}}
10886 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10887 </literallayout>
10888 <para>
10889 In order to retain backwards compatibility, there is one special case: if
10890 the lookup type is PTR and no change of separator is specified, Exim looks
10891 to see if the rest of the string is precisely one IPv6 address. In this
10892 case, it does not treat it as a list.
10893 </para>
10894 <para>
10895 The data from each lookup is concatenated, with newline separators by default,
10896 in the same way that multiple DNS records for a single item are handled. A
10897 different separator can be specified, as described above.
10898 </para>
10899 </section>
10900 <section id="SECTldap">
10901 <title>More about LDAP</title>
10902 <para>
10903 <indexterm role="concept">
10904 <primary>LDAP</primary>
10905 <secondary>lookup, more about</secondary>
10906 </indexterm>
10907 <indexterm role="concept">
10908 <primary>lookup</primary>
10909 <secondary>LDAP</secondary>
10910 </indexterm>
10911 <indexterm role="concept">
10912 <primary>Solaris</primary>
10913 <secondary>LDAP</secondary>
10914 </indexterm>
10915 The original LDAP implementation came from the University of Michigan; this has
10916 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10917 implementation comes from Netscape, and Solaris 7 and subsequent releases
10918 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10919 the lookup function level, their error handling is different. For this reason
10920 it is necessary to set a compile-time variable when building Exim with LDAP, to
10921 indicate which LDAP library is in use. One of the following should appear in
10922 your <filename>Local/Makefile</filename>:
10923 </para>
10924 <literallayout class="monospaced">
10925 LDAP_LIB_TYPE=UMICHIGAN
10926 LDAP_LIB_TYPE=OPENLDAP1
10927 LDAP_LIB_TYPE=OPENLDAP2
10928 LDAP_LIB_TYPE=NETSCAPE
10929 LDAP_LIB_TYPE=SOLARIS
10930 </literallayout>
10931 <para>
10932 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10933 same interface as the University of Michigan version.
10934 </para>
10935 <para>
10936 There are three LDAP lookup types in Exim. These behave slightly differently in
10937 the way they handle the results of a query:
10938 </para>
10939 <itemizedlist>
10940 <listitem>
10941 <para>
10942 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10943 gives an error.
10944 </para>
10945 </listitem>
10946 <listitem>
10947 <para>
10948 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10949 Distinguished Name that is returned rather than any attribute values.
10950 </para>
10951 </listitem>
10952 <listitem>
10953 <para>
10954 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10955 from all of them are returned.
10956 </para>
10957 </listitem>
10958 </itemizedlist>
10959 <para>
10960 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10961 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10962 the data returned by a successful lookup is described in the next section.
10963 First we explain how LDAP queries are coded.
10964 </para>
10965 </section>
10966 <section id="SECTforldaque">
10967 <title>Format of LDAP queries</title>
10968 <para>
10969 <indexterm role="concept">
10970 <primary>LDAP</primary>
10971 <secondary>query format</secondary>
10972 </indexterm>
10973 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10974 the configuration of a <command>redirect</command> router one might have this setting:
10975 </para>
10976 <literallayout class="monospaced">
10977 data = ${lookup ldap \
10978   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10979   c=UK?mailbox?base?}}
10980 </literallayout>
10981 <para>
10982 <indexterm role="concept">
10983 <primary>LDAP</primary>
10984 <secondary>with TLS</secondary>
10985 </indexterm>
10986 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10987 secure (encrypted) LDAP connections. The second of these ensures that an
10988 encrypted TLS connection is used.
10989 </para>
10990 <para>
10991 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
10992 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
10993 See the <option>ldap_start_tls</option> option.
10994 </para>
10995 <para>
10996 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
10997 controlled. Every part of the TLS configuration can be configured by settings in
10998 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
10999 your system, some of the initialization may have required setting options in
11000 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11001 certificates. This revealed a nuance where the current UID that exim was
11002 running as could affect which config files it read. With Exim 4.83, these
11003 methods become optional, only taking effect if not specifically set in
11004 <filename>exim.conf</filename>.
11005 </para>
11006 </section>
11007 <section id="SECID68">
11008 <title>LDAP quoting</title>
11009 <para>
11010 <indexterm role="concept">
11011 <primary>LDAP</primary>
11012 <secondary>quoting</secondary>
11013 </indexterm>
11014 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11015 and the second because the LDAP query is represented as a URL. Furthermore,
11016 within an LDAP query, two different kinds of quoting are required. For this
11017 reason, there are two different LDAP-specific quoting operators.
11018 </para>
11019 <para>
11020 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11021 filter specifications. Conceptually, it first does the following conversions on
11022 the string:
11023 </para>
11024 <literallayout class="monospaced">
11025 *   =&gt;   \2A
11026 (   =&gt;   \28
11027 )   =&gt;   \29
11028 \   =&gt;   \5C
11029 </literallayout>
11030 <para>
11031 in accordance with RFC 2254. The resulting string is then quoted according
11032 to the rules for URLs, that is, all non-alphanumeric characters except
11033 </para>
11034 <literallayout class="monospaced">
11035 ! $ ' - . _ ( ) * +
11036 </literallayout>
11037 <para>
11038 are converted to their hex values, preceded by a percent sign. For example:
11039 </para>
11040 <literallayout class="monospaced">
11041 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
11042 </literallayout>
11043 <para>
11044 yields
11045 </para>
11046 <literallayout class="monospaced">
11047 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
11048 </literallayout>
11049 <para>
11050 Removing the URL quoting, this is (with a leading and a trailing space):
11051 </para>
11052 <literallayout class="monospaced">
11053 a\28bc\29\2A, a&lt;yz&gt;;
11054 </literallayout>
11055 <para>
11056 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
11057 base DN specifications in queries. Conceptually, it first converts the string
11058 by inserting a backslash in front of any of the following characters:
11059 </para>
11060 <literallayout class="monospaced">
11061 , + " \ &lt; &gt; ;
11062 </literallayout>
11063 <para>
11064 It also inserts a backslash before any leading spaces or # characters, and
11065 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
11066 is then quoted according to the rules for URLs. For example:
11067 </para>
11068 <literallayout class="monospaced">
11069 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
11070 </literallayout>
11071 <para>
11072 yields
11073 </para>
11074 <literallayout class="monospaced">
11075 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
11076 </literallayout>
11077 <para>
11078 Removing the URL quoting, this is (with a trailing space):
11079 </para>
11080 <literallayout class="monospaced">
11081 \ a(bc)*\, a\&lt;yz\&gt;\;\
11082 </literallayout>
11083 <para>
11084 There are some further comments about quoting in the section on LDAP
11085 authentication below.
11086 </para>
11087 </section>
11088 <section id="SECID69">
11089 <title>LDAP connections</title>
11090 <para>
11091 <indexterm role="concept">
11092 <primary>LDAP</primary>
11093 <secondary>connections</secondary>
11094 </indexterm>
11095 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11096 is in use, via a Unix domain socket. The example given above does not specify
11097 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11098 by starting it with
11099 </para>
11100 <literallayout class="monospaced">
11101 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11102 </literallayout>
11103 <para>
11104 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11105 used. When no server is specified in a query, a list of default servers is
11106 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11107 colon-separated list of servers which are tried in turn until one successfully
11108 handles a query, or there is a serious error. Successful handling either
11109 returns the requested data, or indicates that it does not exist. Serious errors
11110 are syntactical, or multiple values when only a single value is expected.
11111 Errors which cause the next server to be tried are connection failures, bind
11112 failures, and timeouts.
11113 </para>
11114 <para>
11115 For each server name in the list, a port number can be given. The standard way
11116 of specifying a host and port is to use a colon separator (RFC 1738). Because
11117 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11118 doubled. For example
11119 </para>
11120 <literallayout class="monospaced">
11121 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11122 </literallayout>
11123 <para>
11124 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11125 to the LDAP library with no server name, and the library&#x2019;s default (normally
11126 the local host) is used.
11127 </para>
11128 <para>
11129 If you are using the OpenLDAP library, you can connect to an LDAP server using
11130 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11131 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11132 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11133 not available.
11134 </para>
11135 <para>
11136 For this type of connection, instead of a host name for the server, a pathname
11137 for the socket is required, and the port number is not relevant. The pathname
11138 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11139 the query. In the former case, you can have settings such as
11140 </para>
11141 <literallayout class="monospaced">
11142 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11143 </literallayout>
11144 <para>
11145 When the pathname is given in the query, you have to escape the slashes as
11146 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11147 </para>
11148 <literallayout class="monospaced">
11149 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11150 </literallayout>
11151 <para>
11152 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
11153 a pathname, it uses the Unix domain socket code, even if the query actually
11154 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
11155 socket connection. This behaviour means that you can use a setting of
11156 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
11157 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
11158 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
11159 backup host.
11160 </para>
11161 <para>
11162 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
11163 specified, an error is diagnosed. However, if there are more items in
11164 <option>ldap_default_servers</option>, they are tried. In other words:
11165 </para>
11166 <itemizedlist>
11167 <listitem>
11168 <para>
11169 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
11170 interface.
11171 </para>
11172 </listitem>
11173 <listitem>
11174 <para>
11175 Using <literal>ldapi</literal> with a host name causes an error.
11176 </para>
11177 </listitem>
11178 </itemizedlist>
11179 <para>
11180 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11181 <option>ldap_default_servers</option>, does whatever the library does by default.
11182 </para>
11183 </section>
11184 <section id="SECID70">
11185 <title>LDAP authentication and control information</title>
11186 <para>
11187 <indexterm role="concept">
11188 <primary>LDAP</primary>
11189 <secondary>authentication</secondary>
11190 </indexterm>
11191 The LDAP URL syntax provides no way of passing authentication and other control
11192 information to the server. To make this possible, the URL in an LDAP query may
11193 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11194 spaces. If a value contains spaces it must be enclosed in double quotes, and
11195 when double quotes are used, backslash is interpreted in the usual way inside
11196 them. The following names are recognized:
11197 </para>
11198 <literallayout>
11199 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11200 <literal>NETTIME    </literal>  set a timeout for a network operation
11201 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11202 <literal>PASS       </literal>  set the password, likewise
11203 <literal>REFERRALS  </literal>  set the referrals parameter
11204 <literal>SERVERS    </literal>  set alternate server list for this query only
11205 <literal>SIZE       </literal>  set the limit for the number of entries returned
11206 <literal>TIME       </literal>  set the maximum waiting time for a query
11207 </literallayout>
11208 <para>
11209 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11210 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11211 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11212 library from trying to follow referrals issued by the LDAP server.
11213 </para>
11214 <para>
11215 <indexterm role="concept">
11216 <primary>LDAP</primary>
11217 <secondary>timeout</secondary>
11218 </indexterm>
11219 <indexterm role="concept">
11220 <primary>timeout</primary>
11221 <secondary>LDAP lookup</secondary>
11222 </indexterm>
11223 The name CONNECT is an obsolete name for NETTIME, retained for
11224 backwards compatibility. This timeout (specified as a number of seconds) is
11225 enforced from the client end for operations that can be carried out over a
11226 network. Specifically, it applies to network connections and calls to the
11227 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11228 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11229 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11230 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11231 Netscape SDK; for OpenLDAP no action is taken.
11232 </para>
11233 <para>
11234 The TIME parameter (also a number of seconds) is passed to the server to
11235 set a server-side limit on the time taken to complete a search.
11236 </para>
11237 <para>
11238 The SERVERS parameter allows you to specify an alternate list of ldap servers
11239 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
11240 default list of ldap servers, and a single lookup can specify a single ldap
11241 server to use.  But when you need to do a lookup with a list of servers that is
11242 different than the default list (maybe different order, maybe a completely
11243 different set of servers), the SERVERS parameter allows you to specify this
11244 alternate list (colon-separated).
11245 </para>
11246 <para>
11247 Here is an example of an LDAP query in an Exim lookup that uses some of these
11248 values. This is a single line, folded to fit on the page:
11249 </para>
11250 <literallayout class="monospaced">
11251 ${lookup ldap
11252   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11253   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11254   {$value}fail}
11255 </literallayout>
11256 <para>
11257 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11258 any of the auxiliary data. Exim configuration settings that include lookups
11259 which contain password information should be preceded by <quote>hide</quote> to prevent
11260 non-admin users from using the <option>-bP</option> option to see their values.
11261 </para>
11262 <para>
11263 The auxiliary data items may be given in any order. The default is no
11264 connection timeout (the system timeout is used), no user or password, no limit
11265 on the number of entries returned, and no time limit on queries.
11266 </para>
11267 <para>
11268 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11269 removes any URL quoting that it may contain before passing it LDAP. Apparently
11270 some libraries do this for themselves, but some do not. Removing the URL
11271 quoting has two advantages:
11272 </para>
11273 <itemizedlist>
11274 <listitem>
11275 <para>
11276 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11277 DNs as with DNs inside actual queries.
11278 </para>
11279 </listitem>
11280 <listitem>
11281 <para>
11282 It permits spaces inside USER= DNs.
11283 </para>
11284 </listitem>
11285 </itemizedlist>
11286 <para>
11287 For example, a setting such as
11288 </para>
11289 <literallayout class="monospaced">
11290 USER=cn=${quote_ldap_dn:$1}
11291 </literallayout>
11292 <para>
11293 should work even if <varname>$1</varname> contains spaces.
11294 </para>
11295 <para>
11296 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11297 expansion operator, rather than the LDAP quote operators. The only reason this
11298 field needs quoting is to ensure that it conforms to the Exim syntax, which
11299 does not allow unquoted spaces. For example:
11300 </para>
11301 <literallayout class="monospaced">
11302 PASS=${quote:$3}
11303 </literallayout>
11304 <para>
11305 The LDAP authentication mechanism can be used to check passwords as part of
11306 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11307 <xref linkend="CHAPexpand"/>.
11308 </para>
11309 </section>
11310 <section id="SECID71">
11311 <title>Format of data returned by LDAP</title>
11312 <para>
11313 <indexterm role="concept">
11314 <primary>LDAP</primary>
11315 <secondary>returned data formats</secondary>
11316 </indexterm>
11317 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11318 as a sequence of values, for example
11319 </para>
11320 <literallayout class="monospaced">
11321 cn=manager,o=University of Cambridge,c=UK
11322 </literallayout>
11323 <para>
11324 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11325 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11326 the result between the data from different entries. It is possible for multiple
11327 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11328 you know that whatever values are returned all came from a single entry in the
11329 directory.
11330 </para>
11331 <para>
11332 In the common case where you specify a single attribute in your LDAP query, the
11333 result is not quoted, and does not contain the attribute name. If the attribute
11334 has multiple values, they are separated by commas. Any comma that is
11335 part of an attribute&#x2019;s value is doubled.
11336 </para>
11337 <para>
11338 If you specify multiple attributes, the result contains space-separated, quoted
11339 strings, each preceded by the attribute name and an equals sign. Within the
11340 quotes, the quote character, backslash, and newline are escaped with
11341 backslashes, and commas are used to separate multiple values for the attribute.
11342 Any commas in attribute values are doubled
11343 (permitting treatment of the values as a comma-separated list).
11344 Apart from the escaping, the string within quotes takes the same form as the
11345 output when a single attribute is requested. Specifying no attributes is the
11346 same as specifying all of an entry&#x2019;s attributes.
11347 </para>
11348 <para>
11349 Here are some examples of the output format. The first line of each pair is an
11350 LDAP query, and the second is the data that is returned. The attribute called
11351 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11352 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
11353 (they have SUP <option>attr</option> in their schema definitions).
11354 </para>
11355 <literallayout class="monospaced">
11356 ldap:///o=base?attr1?sub?(uid=fred)
11357 value1.1,value1,,2
11358
11359 ldap:///o=base?attr2?sub?(uid=fred)
11360 value two
11361
11362 ldap:///o=base?attr?sub?(uid=fred)
11363 value1.1,value1,,2,value two
11364
11365 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11366 attr1="value1.1,value1,,2" attr2="value two"
11367
11368 ldap:///o=base??sub?(uid=fred)
11369 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11370 </literallayout>
11371 <para>
11372 You can
11373 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11374 results of LDAP lookups.
11375 The <option>extract</option> operator in string expansions can be used to pick out
11376 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11377 The <option>listextract</option> operator should be used to pick out individual values
11378 of attributes, even when only a single value is expected.
11379 The doubling of embedded commas allows you to use the returned data as a
11380 comma separated list (using the "&lt;," syntax for changing the input list separator).
11381 </para>
11382 </section>
11383 <section id="SECTnisplus">
11384 <title>More about NIS+</title>
11385 <para>
11386 <indexterm role="concept">
11387 <primary>NIS+ lookup type</primary>
11388 </indexterm>
11389 <indexterm role="concept">
11390 <primary>lookup</primary>
11391 <secondary>NIS+</secondary>
11392 </indexterm>
11393 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11394 and field name. If this is given, the result of a successful query is the
11395 contents of the named field; otherwise the result consists of a concatenation
11396 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11397 values containing spaces are quoted. For example, the query
11398 </para>
11399 <literallayout class="monospaced">
11400 [name=mg1456],passwd.org_dir
11401 </literallayout>
11402 <para>
11403 might return the string
11404 </para>
11405 <literallayout class="monospaced">
11406 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11407 home=/home/mg1456 shell=/bin/bash shadow=""
11408 </literallayout>
11409 <para>
11410 (split over two lines here to fit on the page), whereas
11411 </para>
11412 <literallayout class="monospaced">
11413 [name=mg1456],passwd.org_dir:gcos
11414 </literallayout>
11415 <para>
11416 would just return
11417 </para>
11418 <literallayout class="monospaced">
11419 Martin Guerre
11420 </literallayout>
11421 <para>
11422 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11423 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11424 operator is to double any quote characters within the text.
11425 </para>
11426 </section>
11427 <section id="SECTsql">
11428 <title>SQL lookups</title>
11429 <para>
11430 <indexterm role="concept">
11431 <primary>SQL lookup types</primary>
11432 </indexterm>
11433 <indexterm role="concept">
11434 <primary>MySQL</primary>
11435 <secondary>lookup type</secondary>
11436 </indexterm>
11437 <indexterm role="concept">
11438 <primary>PostgreSQL lookup type</primary>
11439 </indexterm>
11440 <indexterm role="concept">
11441 <primary>lookup</primary>
11442 <secondary>MySQL</secondary>
11443 </indexterm>
11444 <indexterm role="concept">
11445 <primary>lookup</primary>
11446 <secondary>PostgreSQL</secondary>
11447 </indexterm>
11448 <indexterm role="concept">
11449 <primary>Oracle</primary>
11450 <secondary>lookup type</secondary>
11451 </indexterm>
11452 <indexterm role="concept">
11453 <primary>lookup</primary>
11454 <secondary>Oracle</secondary>
11455 </indexterm>
11456 <indexterm role="concept">
11457 <primary>InterBase lookup type</primary>
11458 </indexterm>
11459 <indexterm role="concept">
11460 <primary>lookup</primary>
11461 <secondary>InterBase</secondary>
11462 </indexterm>
11463 <indexterm role="concept">
11464 <primary>Redis lookup type</primary>
11465 </indexterm>
11466 <indexterm role="concept">
11467 <primary>lookup</primary>
11468 <secondary>Redis</secondary>
11469 </indexterm>
11470 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
11471 and SQLite
11472 databases. Queries for these databases contain SQL statements, so an example
11473 might be
11474 </para>
11475 <literallayout class="monospaced">
11476 ${lookup mysql{select mailbox from users where id='userx'}\
11477   {$value}fail}
11478 </literallayout>
11479 <para>
11480 If the result of the query contains more than one field, the data for each
11481 field in the row is returned, preceded by its name, so the result of
11482 </para>
11483 <literallayout class="monospaced">
11484 ${lookup pgsql{select home,name from users where id='userx'}\
11485   {$value}}
11486 </literallayout>
11487 <para>
11488 might be
11489 </para>
11490 <literallayout class="monospaced">
11491 home=/home/userx name="Mister X"
11492 </literallayout>
11493 <para>
11494 Empty values and values containing spaces are double quoted, with embedded
11495 quotes escaped by a backslash. If the result of the query contains just one
11496 field, the value is passed back verbatim, without a field name, for example:
11497 </para>
11498 <literallayout class="monospaced">
11499 Mister X
11500 </literallayout>
11501 <para>
11502 If the result of the query yields more than one row, it is all concatenated,
11503 with a newline between the data for each row.
11504 </para>
11505 </section>
11506 <section id="SECID72">
11507 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
11508 <para>
11509 <indexterm role="concept">
11510 <primary>MySQL</primary>
11511 <secondary>lookup type</secondary>
11512 </indexterm>
11513 <indexterm role="concept">
11514 <primary>PostgreSQL lookup type</primary>
11515 </indexterm>
11516 <indexterm role="concept">
11517 <primary>lookup</primary>
11518 <secondary>MySQL</secondary>
11519 </indexterm>
11520 <indexterm role="concept">
11521 <primary>lookup</primary>
11522 <secondary>PostgreSQL</secondary>
11523 </indexterm>
11524 <indexterm role="concept">
11525 <primary>Oracle</primary>
11526 <secondary>lookup type</secondary>
11527 </indexterm>
11528 <indexterm role="concept">
11529 <primary>lookup</primary>
11530 <secondary>Oracle</secondary>
11531 </indexterm>
11532 <indexterm role="concept">
11533 <primary>InterBase lookup type</primary>
11534 </indexterm>
11535 <indexterm role="concept">
11536 <primary>lookup</primary>
11537 <secondary>InterBase</secondary>
11538 </indexterm>
11539 <indexterm role="concept">
11540 <primary>Redis lookup type</primary>
11541 </indexterm>
11542 <indexterm role="concept">
11543 <primary>lookup</primary>
11544 <secondary>Redis</secondary>
11545 </indexterm>
11546 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
11547 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
11548 or <option>redis_servers</option>
11549 option (as appropriate) must be set to a colon-separated list of server
11550 information.
11551 (For MySQL and PostgreSQL, the global option need not be set if all
11552 queries contain their own server information &ndash; see section
11553 <xref linkend="SECTspeserque"/>.)
11554 For all but Redis
11555 each item in the list is a slash-separated list of four
11556 items: host name, database name, user name, and password. In the case of
11557 Oracle, the host name field is used for the <quote>service name</quote>, and the database
11558 name field is not used and should be empty. For example:
11559 </para>
11560 <literallayout class="monospaced">
11561 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
11562 </literallayout>
11563 <para>
11564 Because password data is sensitive, you should always precede the setting with
11565 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
11566 option. Here is an example where two MySQL servers are listed:
11567 </para>
11568 <literallayout class="monospaced">
11569 hide mysql_servers = localhost/users/root/secret:\
11570                      otherhost/users/root/othersecret
11571 </literallayout>
11572 <para>
11573 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
11574 because this is a colon-separated list, the colon has to be doubled. For each
11575 query, these parameter groups are tried in order until a connection is made and
11576 a query is successfully processed. The result of a query may be that no data is
11577 found, but that is still a successful query. In other words, the list of
11578 servers provides a backup facility, not a list of different places to look.
11579 </para>
11580 <para>
11581 For Redis the global option need not be specified if all queries contain their
11582 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
11583 If specified, the option must be set to a colon-separated list of server
11584 information.
11585 Each item in the list is a slash-separated list of three items:
11586 host, database number, and password.
11587 </para>
11588 <orderedlist numeration="arabic">
11589 <listitem>
11590 <para>
11591 The host is required and may be either an IPv4 address and optional
11592 port number (separated by a colon, which needs doubling due to the
11593 higher-level list), or a Unix socket pathname enclosed in parentheses
11594 </para>
11595 </listitem>
11596 <listitem>
11597 <para>
11598 The database number is optional; if present that number is selected in the backend
11599 </para>
11600 </listitem>
11601 <listitem>
11602 <para>
11603 The password is optional; if present it is used to authenticate to the backend
11604 </para>
11605 </listitem>
11606 </orderedlist>
11607 <para>
11608 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
11609 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
11610 respectively, and the characters single-quote, double-quote, and backslash
11611 itself are escaped with backslashes.
11612 </para>
11613 <para>
11614 The <option>quote_redis</option> expansion operator
11615 escapes whitespace and backslash characters with a backslash.
11616 </para>
11617 </section>
11618 <section id="SECTspeserque">
11619 <title>Specifying the server in the query</title>
11620 <para>
11621 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
11622 it is possible to specify a list of servers with an individual query. This is
11623 done by starting the query with
11624 </para>
11625 <literallayout>
11626 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
11627 </literallayout>
11628 <para>
11629 Each item in the list may take one of two forms:
11630 </para>
11631 <orderedlist numeration="arabic">
11632 <listitem>
11633 <para>
11634 If it contains no slashes it is assumed to be just a host name. The appropriate
11635 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
11636 of the same name, and the remaining parameters (database, user, password) are
11637 taken from there.
11638 </para>
11639 </listitem>
11640 <listitem>
11641 <para>
11642 If it contains any slashes, it is taken as a complete parameter set.
11643 </para>
11644 </listitem>
11645 </orderedlist>
11646 <para>
11647 The list of servers is used in exactly the same way as the global list.
11648 Once a connection to a server has happened and a query has been
11649 successfully executed, processing of the lookup ceases.
11650 </para>
11651 <para>
11652 This feature is intended for use in master/slave situations where updates
11653 are occurring and you want to update the master rather than a slave. If the
11654 master is in the list as a backup for reading, you might have a global setting
11655 like this:
11656 </para>
11657 <literallayout class="monospaced">
11658 mysql_servers = slave1/db/name/pw:\
11659                 slave2/db/name/pw:\
11660                 master/db/name/pw
11661 </literallayout>
11662 <para>
11663 In an updating lookup, you could then write:
11664 </para>
11665 <literallayout class="monospaced">
11666 ${lookup mysql{servers=master; UPDATE ...} }
11667 </literallayout>
11668 <para>
11669 That query would then be sent only to the master server. If, on the other hand,
11670 the master is not to be used for reading, and so is not present in the global
11671 option, you can still update it by a query of this form:
11672 </para>
11673 <literallayout class="monospaced">
11674 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
11675 </literallayout>
11676 </section>
11677 <section id="SECID73">
11678 <title>Special MySQL features</title>
11679 <para>
11680 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
11681 causes a connection to the server on the local host by means of a Unix domain
11682 socket. An alternate socket can be specified in parentheses.
11683 An option group name for MySQL option files can be specified in square brackets;
11684 the default value is <quote>exim</quote>.
11685 The full syntax of each item in <option>mysql_servers</option> is:
11686 </para>
11687 <literallayout>
11688 &lt;<emphasis>hostname</emphasis>&gt;::&lt;<emphasis>port</emphasis>&gt;(&lt;<emphasis>socket name</emphasis>&gt;)[&lt;<emphasis>option group</emphasis>&gt;]/&lt;<emphasis>database</emphasis>&gt;/&lt;<emphasis>user</emphasis>&gt;/&lt;<emphasis>password</emphasis>&gt;
11689 </literallayout>
11690 <para>
11691 Any of the four sub-parts of the first field can be omitted. For normal use on
11692 the local host it can be left blank or set to just <quote>localhost</quote>.
11693 </para>
11694 <para>
11695 No database need be supplied &ndash; but if it is absent here, it must be given in
11696 the queries.
11697 </para>
11698 <para>
11699 If a MySQL query is issued that does not request any data (an insert, update,
11700 or delete command), the result of the lookup is the number of rows affected.
11701 </para>
11702 <para>
11703 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
11704 anything (for example, setting a field to the value it already has), the result
11705 is zero because no rows are affected.
11706 </para>
11707 </section>
11708 <section id="SECID74">
11709 <title>Special PostgreSQL features</title>
11710 <para>
11711 PostgreSQL lookups can also use Unix domain socket connections to the database.
11712 This is usually faster and costs less CPU time than a TCP/IP connection.
11713 However it can be used only if the mail server runs on the same machine as the
11714 database server. A configuration line for PostgreSQL via Unix domain sockets
11715 looks like this:
11716 </para>
11717 <literallayout class="monospaced">
11718 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11719 </literallayout>
11720 <para>
11721 In other words, instead of supplying a host name, a path to the socket is
11722 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
11723 visually confused with the delimiters for the other server parameters.
11724 </para>
11725 <para>
11726 If a PostgreSQL query is issued that does not request any data (an insert,
11727 update, or delete command), the result of the lookup is the number of rows
11728 affected.
11729 </para>
11730 </section>
11731 <section id="SECTsqlite">
11732 <title>More about SQLite</title>
11733 <para>
11734 <indexterm role="concept">
11735 <primary>lookup</primary>
11736 <secondary>SQLite</secondary>
11737 </indexterm>
11738 <indexterm role="concept">
11739 <primary>sqlite lookup type</primary>
11740 </indexterm>
11741 SQLite is different to the other SQL lookups because a file name is required in
11742 addition to the SQL query. An SQLite database is a single file, and there is no
11743 daemon as in the other SQL databases. The interface to Exim requires the name
11744 of the file, as an absolute path, to be given at the start of the query. It is
11745 separated from the query by white space. This means that the path name cannot
11746 contain white space. Here is a lookup expansion example:
11747 </para>
11748 <literallayout class="monospaced">
11749 ${lookup sqlite {/some/thing/sqlitedb \
11750   select name from aliases where id='userx';}}
11751 </literallayout>
11752 <para>
11753 In a list, the syntax is similar. For example:
11754 </para>
11755 <literallayout class="monospaced">
11756 domainlist relay_to_domains = sqlite;/some/thing/sqlitedb \
11757    select * from relays where ip='$sender_host_address';
11758 </literallayout>
11759 <para>
11760 The only character affected by the <option>quote_sqlite</option> operator is a single
11761 quote, which it doubles.
11762 </para>
11763 <para>
11764 <indexterm role="concept">
11765 <primary>timeout</primary>
11766 <secondary>SQLite</secondary>
11767 </indexterm>
11768 <indexterm role="concept">
11769 <primary>sqlite</primary>
11770 <secondary>lookup timeout</secondary>
11771 </indexterm>
11772 The SQLite library handles multiple simultaneous accesses to the database
11773 internally. Multiple readers are permitted, but only one process can
11774 update at once. Attempts to access the database while it is being updated
11775 are rejected after a timeout period, during which the SQLite library
11776 waits for the lock to be released. In Exim, the default timeout is set
11777 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11778 option.
11779 </para>
11780 </section>
11781 <section id="SECTredis" revisionflag="changed">
11782 <title>More about Redis</title>
11783 <para revisionflag="changed">
11784 <indexterm role="concept">
11785 <primary>lookup</primary>
11786 <secondary>Redis</secondary>
11787 </indexterm>
11788 <indexterm role="concept">
11789 <primary>redis lookup type</primary>
11790 </indexterm>
11791 Redis is a non-SQL database. Commands are simple get and set.
11792 Examples:
11793 </para>
11794 <literallayout class="monospaced" revisionflag="changed">
11795 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
11796 ${lookup redis{get keyname}}
11797 </literallayout>
11798 <para>
11799 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11800 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11801 </para>
11802 </section>
11803 </chapter>
11804
11805 <chapter id="CHAPdomhosaddlists">
11806 <title>Domain, host, address, and local part lists</title>
11807 <titleabbrev>Domain, host, and address lists</titleabbrev>
11808 <para>
11809 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11810 <primary>lists of domains; hosts; etc.</primary>
11811 </indexterm>
11812 A number of Exim configuration options contain lists of domains, hosts,
11813 email addresses, or local parts. For example, the <option>hold_domains</option> option
11814 contains a list of domains whose delivery is currently suspended. These lists
11815 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11816 arguments to expansion conditions such as <option>match_domain</option>.
11817 </para>
11818 <para>
11819 Each item in one of these lists is a pattern to be matched against a domain,
11820 host, email address, or local part, respectively. In the sections below, the
11821 different types of pattern for each case are described, but first we cover some
11822 general facilities that apply to all four kinds of list.
11823 </para>
11824 <para>
11825 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
11826 support all the complexity available in
11827 domain, host, address and local part lists.
11828 </para>
11829 <section id="SECTlistexpand">
11830 <title>Expansion of lists</title>
11831 <para>
11832 <indexterm role="concept">
11833 <primary>expansion</primary>
11834 <secondary>of lists</secondary>
11835 </indexterm>
11836 Each list is expanded as a single string before it is used.
11837 </para>
11838 <para>
11839 <emphasis>Exception: the router headers_remove option, where list-item
11840 splitting is done before string-expansion.</emphasis>
11841 </para>
11842 <para>
11843 The result of
11844 expansion must be a list, possibly containing empty items, which is split up
11845 into separate items for matching. By default, colon is the separator character,
11846 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11847 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11848 discusses the way to specify empty list items.
11849 </para>
11850 <para>
11851 If the string expansion is forced to fail, Exim behaves as if the item it is
11852 testing (domain, host, address, or local part) is not in the list. Other
11853 expansion failures cause temporary errors.
11854 </para>
11855 <para>
11856 If an item in a list is a regular expression, backslashes, dollars and possibly
11857 other special characters in the expression must be protected against
11858 misinterpretation by the string expander. The easiest way to do this is to use
11859 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11860 expression should not be expanded. For example, in an ACL you might have:
11861 </para>
11862 <literallayout class="monospaced">
11863 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11864                ${lookup{$domain}lsearch{/badsenders/bydomain}}
11865 </literallayout>
11866 <para>
11867 The first item is a regular expression that is protected from expansion by
11868 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11869 senders based on the receiving domain.
11870 </para>
11871 </section>
11872 <section id="SECID76">
11873 <title>Negated items in lists</title>
11874 <para>
11875 <indexterm role="concept">
11876 <primary>list</primary>
11877 <secondary>negation</secondary>
11878 </indexterm>
11879 <indexterm role="concept">
11880 <primary>negation</primary>
11881 <secondary>in lists</secondary>
11882 </indexterm>
11883 Items in a list may be positive or negative. Negative items are indicated by a
11884 leading exclamation mark, which may be followed by optional white space. A list
11885 defines a set of items (domains, etc). When Exim processes one of these lists,
11886 it is trying to find out whether a domain, host, address, or local part
11887 (respectively) is in the set that is defined by the list. It works like this:
11888 </para>
11889 <para>
11890 The list is scanned from left to right. If a positive item is matched, the
11891 subject that is being checked is in the set; if a negative item is matched, the
11892 subject is not in the set. If the end of the list is reached without the
11893 subject having matched any of the patterns, it is in the set if the last item
11894 was a negative one, but not if it was a positive one. For example, the list in
11895 </para>
11896 <literallayout class="monospaced">
11897 domainlist relay_to_domains = !a.b.c : *.b.c
11898 </literallayout>
11899 <para>
11900 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11901 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11902 list is positive. However, if the setting were
11903 </para>
11904 <literallayout class="monospaced">
11905 domainlist relay_to_domains = !a.b.c
11906 </literallayout>
11907 <para>
11908 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11909 list is negative. In other words, a list that ends with a negative item behaves
11910 as if it had an extra item <literal>:*</literal> on the end.
11911 </para>
11912 <para>
11913 Another way of thinking about positive and negative items in lists is to read
11914 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11915 item.
11916 </para>
11917 </section>
11918 <section id="SECTfilnamlis">
11919 <title>File names in lists</title>
11920 <para>
11921 <indexterm role="concept">
11922 <primary>list</primary>
11923 <secondary>file name in</secondary>
11924 </indexterm>
11925 If an item in a domain, host, address, or local part list is an absolute file
11926 name (beginning with a slash character), each line of the file is read and
11927 processed as if it were an independent item in the list, except that further
11928 file names are not allowed,
11929 and no expansion of the data from the file takes place.
11930 Empty lines in the file are ignored, and the file may also contain comment
11931 lines:
11932 </para>
11933 <itemizedlist>
11934 <listitem>
11935 <para>
11936 For domain and host lists, if a # character appears anywhere in a line of the
11937 file, it and all following characters are ignored.
11938 </para>
11939 </listitem>
11940 <listitem>
11941 <para>
11942 Because local parts may legitimately contain # characters, a comment in an
11943 address list or local part list file is recognized only if # is preceded by
11944 white space or the start of the line. For example:
11945 </para>
11946 <literallayout class="monospaced">
11947 not#comment@x.y.z   # but this is a comment
11948 </literallayout>
11949 </listitem>
11950 </itemizedlist>
11951 <para>
11952 Putting a file name in a list has the same effect as inserting each line of the
11953 file as an item in the list (blank lines and comments excepted). However, there
11954 is one important difference: the file is read each time the list is processed,
11955 so if its contents vary over time, Exim&#x2019;s behaviour changes.
11956 </para>
11957 <para>
11958 If a file name is preceded by an exclamation mark, the sense of any match
11959 within the file is inverted. For example, if
11960 </para>
11961 <literallayout class="monospaced">
11962 hold_domains = !/etc/nohold-domains
11963 </literallayout>
11964 <para>
11965 and the file contains the lines
11966 </para>
11967 <literallayout class="monospaced">
11968 !a.b.c
11969 *.b.c
11970 </literallayout>
11971 <para>
11972 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11973 any domain matching <literal>*.b.c</literal> is not.
11974 </para>
11975 </section>
11976 <section id="SECID77">
11977 <title>An lsearch file is not an out-of-line list</title>
11978 <para>
11979 As will be described in the sections that follow, lookups can be used in lists
11980 to provide indexed methods of checking list membership. There has been some
11981 confusion about the way <command>lsearch</command> lookups work in lists. Because
11982 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11983 sometimes thought that it is allowed to contain wild cards and other kinds of
11984 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11985 always fixed strings, just as for any other single-key lookup type.
11986 </para>
11987 <para>
11988 If you want to use a file to contain wild-card patterns that form part of a
11989 list, just give the file name on its own, without a search type, as described
11990 in the previous section. You could also use the <command>wildlsearch</command> or
11991 <command>nwildlsearch</command>, but there is no advantage in doing this.
11992 </para>
11993 </section>
11994 <section id="SECTnamedlists">
11995 <title>Named lists</title>
11996 <para>
11997 <indexterm role="concept">
11998 <primary>named lists</primary>
11999 </indexterm>
12000 <indexterm role="concept">
12001 <primary>list</primary>
12002 <secondary>named</secondary>
12003 </indexterm>
12004 A list of domains, hosts, email addresses, or local parts can be given a name
12005 which is then used to refer to the list elsewhere in the configuration. This is
12006 particularly convenient if the same list is required in several different
12007 places. It also allows lists to be given meaningful names, which can improve
12008 the readability of the configuration. For example, it is conventional to define
12009 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
12010 locally on a host, using a configuration line such as
12011 </para>
12012 <literallayout class="monospaced">
12013 domainlist local_domains = localhost:my.dom.example
12014 </literallayout>
12015 <para>
12016 Named lists are referenced by giving their name preceded by a plus sign, so,
12017 for example, a router that is intended to handle local domains would be
12018 configured with the line
12019 </para>
12020 <literallayout class="monospaced">
12021 domains = +local_domains
12022 </literallayout>
12023 <para>
12024 The first router in a configuration is often one that handles all domains
12025 except the local ones, using a configuration with a negated item like this:
12026 </para>
12027 <literallayout class="monospaced">
12028 dnslookup:
12029   driver = dnslookup
12030   domains = ! +local_domains
12031   transport = remote_smtp
12032   no_more
12033 </literallayout>
12034 <para>
12035 The four kinds of named list are created by configuration lines starting with
12036 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
12037 respectively. Then there follows the name that you are defining, followed by an
12038 equals sign and the list itself. For example:
12039 </para>
12040 <literallayout class="monospaced">
12041 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
12042 addresslist bad_senders = cdb;/etc/badsenders
12043 </literallayout>
12044 <para>
12045 A named list may refer to other named lists:
12046 </para>
12047 <literallayout class="monospaced">
12048 domainlist  dom1 = first.example : second.example
12049 domainlist  dom2 = +dom1 : third.example
12050 domainlist  dom3 = fourth.example : +dom2 : fifth.example
12051 </literallayout>
12052 <para>
12053 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
12054 effect may not be what you intended, because the negation does not propagate
12055 out to the higher level. For example, consider:
12056 </para>
12057 <literallayout class="monospaced">
12058 domainlist  dom1 = !a.b
12059 domainlist  dom2 = +dom1 : *.b
12060 </literallayout>
12061 <para>
12062 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
12063 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
12064 means it matches the second list as well. The effect is not the same as
12065 </para>
12066 <literallayout class="monospaced">
12067 domainlist  dom2 = !a.b : *.b
12068 </literallayout>
12069 <para>
12070 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
12071 referenced lists if you can.
12072 </para>
12073 <para>
12074 Named lists may have a performance advantage. When Exim is routing an
12075 address or checking an incoming message, it caches the result of tests on named
12076 lists. So, if you have a setting such as
12077 </para>
12078 <literallayout class="monospaced">
12079 domains = +local_domains
12080 </literallayout>
12081 <para>
12082 on several of your routers
12083 or in several ACL statements,
12084 the actual test is done only for the first one. However, the caching works only
12085 if there are no expansions within the list itself or any sublists that it
12086 references. In other words, caching happens only for lists that are known to be
12087 the same each time they are referenced.
12088 </para>
12089 <para>
12090 By default, there may be up to 16 named lists of each type. This limit can be
12091 extended by changing a compile-time variable. The use of domain and host lists
12092 is recommended for concepts such as local domains, relay domains, and relay
12093 hosts. The default configuration is set up like this.
12094 </para>
12095 </section>
12096 <section id="SECID78">
12097 <title>Named lists compared with macros</title>
12098 <para>
12099 <indexterm role="concept">
12100 <primary>list</primary>
12101 <secondary>named compared with macro</secondary>
12102 </indexterm>
12103 <indexterm role="concept">
12104 <primary>macro</primary>
12105 <secondary>compared with named list</secondary>
12106 </indexterm>
12107 At first sight, named lists might seem to be no different from macros in the
12108 configuration file. However, macros are just textual substitutions. If you
12109 write
12110 </para>
12111 <literallayout class="monospaced">
12112 ALIST = host1 : host2
12113 auth_advertise_hosts = !ALIST
12114 </literallayout>
12115 <para>
12116 it probably won&#x2019;t do what you want, because that is exactly the same as
12117 </para>
12118 <literallayout class="monospaced">
12119 auth_advertise_hosts = !host1 : host2
12120 </literallayout>
12121 <para>
12122 Notice that the second host name is not negated. However, if you use a host
12123 list, and write
12124 </para>
12125 <literallayout class="monospaced">
12126 hostlist alist = host1 : host2
12127 auth_advertise_hosts = ! +alist
12128 </literallayout>
12129 <para>
12130 the negation applies to the whole list, and so that is equivalent to
12131 </para>
12132 <literallayout class="monospaced">
12133 auth_advertise_hosts = !host1 : !host2
12134 </literallayout>
12135 </section>
12136 <section id="SECID79">
12137 <title>Named list caching</title>
12138 <para>
12139 <indexterm role="concept">
12140 <primary>list</primary>
12141 <secondary>caching of named</secondary>
12142 </indexterm>
12143 <indexterm role="concept">
12144 <primary>caching</primary>
12145 <secondary>named lists</secondary>
12146 </indexterm>
12147 While processing a message, Exim caches the result of checking a named list if
12148 it is sure that the list is the same each time. In practice, this means that
12149 the cache operates only if the list contains no $ characters, which guarantees
12150 that it will not change when it is expanded. Sometimes, however, you may have
12151 an expanded list that you know will be the same each time within a given
12152 message. For example:
12153 </para>
12154 <literallayout class="monospaced">
12155 domainlist special_domains = \
12156            ${lookup{$sender_host_address}cdb{/some/file}}
12157 </literallayout>
12158 <para>
12159 This provides a list of domains that depends only on the sending host&#x2019;s IP
12160 address. If this domain list is referenced a number of times (for example,
12161 in several ACL lines, or in several routers) the result of the check is not
12162 cached by default, because Exim does not know that it is going to be the
12163 same list each time.
12164 </para>
12165 <para>
12166 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
12167 cache the result anyway. For example:
12168 </para>
12169 <literallayout class="monospaced">
12170 domainlist_cache special_domains = ${lookup{...
12171 </literallayout>
12172 <para>
12173 If you do this, you should be absolutely sure that caching is going to do
12174 the right thing in all cases. When in doubt, leave it out.
12175 </para>
12176 </section>
12177 <section id="SECTdomainlist">
12178 <title>Domain lists</title>
12179 <para>
12180 <indexterm role="concept">
12181 <primary>domain list</primary>
12182 <secondary>patterns for</secondary>
12183 </indexterm>
12184 <indexterm role="concept">
12185 <primary>list</primary>
12186 <secondary>domain list</secondary>
12187 </indexterm>
12188 Domain lists contain patterns that are to be matched against a mail domain.
12189 The following types of item may appear in domain lists:
12190 </para>
12191 <itemizedlist>
12192 <listitem>
12193 <para>
12194 <indexterm role="concept">
12195 <primary>primary host name</primary>
12196 </indexterm>
12197 <indexterm role="concept">
12198 <primary>host name</primary>
12199 <secondary>matched in domain list</secondary>
12200 </indexterm>
12201 <indexterm role="option">
12202 <primary><option>primary_hostname</option></primary>
12203 </indexterm>
12204 <indexterm role="concept">
12205 <primary>domain list</primary>
12206 <secondary>matching primary host name</secondary>
12207 </indexterm>
12208 <indexterm role="concept">
12209 <primary>@ in a domain list</primary>
12210 </indexterm>
12211 If a pattern consists of a single @ character, it matches the local host name,
12212 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
12213 possible to use the same configuration file on several different hosts that
12214 differ only in their names.
12215 </para>
12216 </listitem>
12217 <listitem>
12218 <para>
12219 <indexterm role="concept">
12220 <primary>@[] in a domain list</primary>
12221 </indexterm>
12222 <indexterm role="concept">
12223 <primary>domain list</primary>
12224 <secondary>matching local IP interfaces</secondary>
12225 </indexterm>
12226 <indexterm role="concept">
12227 <primary>domain literal</primary>
12228 </indexterm>
12229 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
12230 in square brackets (as in an email address that contains a domain literal), but
12231 only if that IP address is recognized as local for email routing purposes. The
12232 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
12233 control which of a host&#x2019;s several IP addresses are treated as local.
12234 In today&#x2019;s Internet, the use of domain literals is controversial.
12235 </para>
12236 </listitem>
12237 <listitem>
12238 <para>
12239 <indexterm role="concept">
12240 <primary>@mx_any</primary>
12241 </indexterm>
12242 <indexterm role="concept">
12243 <primary>@mx_primary</primary>
12244 </indexterm>
12245 <indexterm role="concept">
12246 <primary>@mx_secondary</primary>
12247 </indexterm>
12248 <indexterm role="concept">
12249 <primary>domain list</primary>
12250 <secondary>matching MX pointers to local host</secondary>
12251 </indexterm>
12252 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
12253 has an MX record pointing to the local host or to any host that is listed in
12254 <indexterm role="option">
12255 <primary><option>hosts_treat_as_local</option></primary>
12256 </indexterm>
12257 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
12258 are similar, except that the first matches only when a primary MX target is the
12259 local host, and the second only when no primary MX target is the local host,
12260 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
12261 preference value &ndash; there may of course be more than one of them.
12262 </para>
12263 <para>
12264 The MX lookup that takes place when matching a pattern of this type is
12265 performed with the resolver options for widening names turned off. Thus, for
12266 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
12267 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
12268 options of the <command>dnslookup</command> router for a discussion of domain widening.
12269 </para>
12270 <para>
12271 Sometimes you may want to ignore certain IP addresses when using one of these
12272 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12273 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12274 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12275 on a router). For example:
12276 </para>
12277 <literallayout class="monospaced">
12278 domains = @mx_any/ignore=127.0.0.1
12279 </literallayout>
12280 <para>
12281 This example matches any domain that has an MX record pointing to one of
12282 the local host&#x2019;s IP addresses other than 127.0.0.1.
12283 </para>
12284 <para>
12285 The list of IP addresses is in fact processed by the same code that processes
12286 host lists, so it may contain CIDR-coded network specifications and it may also
12287 contain negative items.
12288 </para>
12289 <para>
12290 Because the list of IP addresses is a sublist within a domain list, you have to
12291 be careful about delimiters if there is more than one address. Like any other
12292 list, the default delimiter can be changed. Thus, you might have:
12293 </para>
12294 <literallayout class="monospaced">
12295 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12296           an.other.domain : ...
12297 </literallayout>
12298 <para>
12299 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12300 involved, it is easiest to change the delimiter for the main list as well:
12301 </para>
12302 <literallayout class="monospaced">
12303 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12304           an.other.domain ? ...
12305 </literallayout>
12306 </listitem>
12307 <listitem>
12308 <para>
12309 <indexterm role="concept">
12310 <primary>asterisk</primary>
12311 <secondary>in domain list</secondary>
12312 </indexterm>
12313 <indexterm role="concept">
12314 <primary>domain list</primary>
12315 <secondary>asterisk in</secondary>
12316 </indexterm>
12317 <indexterm role="concept">
12318 <primary>domain list</primary>
12319 <secondary>matching <quote>ends with</quote></secondary>
12320 </indexterm>
12321 If a pattern starts with an asterisk, the remaining characters of the pattern
12322 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12323 domain lists differs from its use in partial matching lookups. In a domain
12324 list, the character following the asterisk need not be a dot, whereas partial
12325 matching works only in terms of dot-separated components. For example, a domain
12326 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12327 <emphasis>cipher.key.ex</emphasis>.
12328 </para>
12329 </listitem>
12330 <listitem>
12331 <para>
12332 <indexterm role="concept">
12333 <primary>regular expressions</primary>
12334 <secondary>in domain list</secondary>
12335 </indexterm>
12336 <indexterm role="concept">
12337 <primary>domain list</primary>
12338 <secondary>matching regular expression</secondary>
12339 </indexterm>
12340 If a pattern starts with a circumflex character, it is treated as a regular
12341 expression, and matched against the domain using a regular expression matching
12342 function. The circumflex is treated as part of the regular expression.
12343 Email domains are case-independent, so this regular expression match is by
12344 default case-independent, but you can make it case-dependent by starting it
12345 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12346 are given in chapter <xref linkend="CHAPregexp"/>.
12347 </para>
12348 <para>
12349 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12350 must escape any backslash and dollar characters in the regular expression, or
12351 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
12352 it is not to be expanded (unless you really do want to build a regular
12353 expression by expansion, of course).
12354 </para>
12355 </listitem>
12356 <listitem>
12357 <para>
12358 <indexterm role="concept">
12359 <primary>lookup</primary>
12360 <secondary>in domain list</secondary>
12361 </indexterm>
12362 <indexterm role="concept">
12363 <primary>domain list</primary>
12364 <secondary>matching by lookup</secondary>
12365 </indexterm>
12366 If a pattern starts with the name of a single-key lookup type followed by a
12367 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
12368 must be a file name in a suitable format for the lookup type. For example, for
12369 <quote>cdb;</quote> it must be an absolute path:
12370 </para>
12371 <literallayout class="monospaced">
12372 domains = cdb;/etc/mail/local_domains.cdb
12373 </literallayout>
12374 <para>
12375 The appropriate type of lookup is done on the file using the domain name as the
12376 key. In most cases, the data that is looked up is not used; Exim is interested
12377 only in whether or not the key is present in the file. However, when a lookup
12378 is used for the <option>domains</option> option on a router
12379 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
12380 <varname>$domain_data</varname> variable and can be referred to in other router options or
12381 other statements in the same ACL.
12382 </para>
12383 </listitem>
12384 <listitem>
12385 <para>
12386 Any of the single-key lookup type names may be preceded by
12387 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
12388 </para>
12389 <literallayout class="monospaced">
12390 domains = partial-dbm;/partial/domains
12391 </literallayout>
12392 <para>
12393 This causes partial matching logic to be invoked; a description of how this
12394 works is given in section <xref linkend="SECTpartiallookup"/>.
12395 </para>
12396 </listitem>
12397 <listitem>
12398 <para>
12399 <indexterm role="concept">
12400 <primary>asterisk</primary>
12401 <secondary>in lookup type</secondary>
12402 </indexterm>
12403 Any of the single-key lookup types may be followed by an asterisk. This causes
12404 a default lookup for a key consisting of a single asterisk to be done if the
12405 original lookup fails. This is not a useful feature when using a domain list to
12406 select particular domains (because any domain would match), but it might have
12407 value if the result of the lookup is being used via the <varname>$domain_data</varname>
12408 expansion variable.
12409 </para>
12410 </listitem>
12411 <listitem>
12412 <para>
12413 If the pattern starts with the name of a query-style lookup type followed by a
12414 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
12415 pattern must be an appropriate query for the lookup type, as described in
12416 chapter <xref linkend="CHAPfdlookup"/>. For example:
12417 </para>
12418 <literallayout class="monospaced">
12419 hold_domains = mysql;select domain from holdlist \
12420   where domain = '${quote_mysql:$domain}';
12421 </literallayout>
12422 <para>
12423 In most cases, the data that is looked up is not used (so for an SQL query, for
12424 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
12425 whether or not the query succeeds. However, when a lookup is used for the
12426 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
12427 variable and can be referred to in other options.
12428 </para>
12429 </listitem>
12430 <listitem>
12431 <para>
12432 <indexterm role="concept">
12433 <primary>domain list</primary>
12434 <secondary>matching literal domain name</secondary>
12435 </indexterm>
12436 If none of the above cases apply, a caseless textual comparison is made
12437 between the pattern and the domain.
12438 </para>
12439 </listitem>
12440 </itemizedlist>
12441 <para>
12442 Here is an example that uses several different kinds of pattern:
12443 </para>
12444 <literallayout class="monospaced">
12445 domainlist funny_domains = \
12446   @ : \
12447   lib.unseen.edu : \
12448   *.foundation.fict.example : \
12449   \N^[1-2]\d{3}\.fict\.example$\N : \
12450   partial-dbm;/opt/data/penguin/book : \
12451   nis;domains.byname : \
12452   nisplus;[name=$domain,status=local],domains.org_dir
12453 </literallayout>
12454 <para>
12455 There are obvious processing trade-offs among the various matching modes. Using
12456 an asterisk is faster than a regular expression, and listing a few names
12457 explicitly probably is too. The use of a file or database lookup is expensive,
12458 but may be the only option if hundreds of names are required. Because the
12459 patterns are tested in order, it makes sense to put the most commonly matched
12460 patterns earlier.
12461 </para>
12462 </section>
12463 <section id="SECThostlist">
12464 <title>Host lists</title>
12465 <para>
12466 <indexterm role="concept">
12467 <primary>host list</primary>
12468 <secondary>patterns in</secondary>
12469 </indexterm>
12470 <indexterm role="concept">
12471 <primary>list</primary>
12472 <secondary>host list</secondary>
12473 </indexterm>
12474 Host lists are used to control what remote hosts are allowed to do. For
12475 example, some hosts may be allowed to use the local host as a relay, and some
12476 may be permitted to use the SMTP ETRN command. Hosts can be identified in
12477 two different ways, by name or by IP address. In a host list, some types of
12478 pattern are matched to a host name, and some are matched to an IP address.
12479 You need to be particularly careful with this when single-key lookups are
12480 involved, to ensure that the right value is being used as the key.
12481 </para>
12482 </section>
12483 <section id="SECID80">
12484 <title>Special host list patterns</title>
12485 <para>
12486 <indexterm role="concept">
12487 <primary>empty item in hosts list</primary>
12488 </indexterm>
12489 <indexterm role="concept">
12490 <primary>host list</primary>
12491 <secondary>empty string in</secondary>
12492 </indexterm>
12493 If a host list item is the empty string, it matches only when no remote host is
12494 involved. This is the case when a message is being received from a local
12495 process using SMTP on the standard input, that is, when a TCP/IP connection is
12496 not used.
12497 </para>
12498 <para>
12499 <indexterm role="concept">
12500 <primary>asterisk</primary>
12501 <secondary>in host list</secondary>
12502 </indexterm>
12503 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
12504 the IP address nor the name is actually inspected.
12505 </para>
12506 </section>
12507 <section id="SECThoslispatip">
12508 <title>Host list patterns that match by IP address</title>
12509 <para>
12510 <indexterm role="concept">
12511 <primary>host list</primary>
12512 <secondary>matching IP addresses</secondary>
12513 </indexterm>
12514 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
12515 the incoming address actually appears in the IPv6 host as
12516 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
12517 list, it is converted into a traditional IPv4 address first. (Not all operating
12518 systems accept IPv4 calls on IPv6 sockets, as there have been some security
12519 concerns.)
12520 </para>
12521 <para>
12522 The following types of pattern in a host list check the remote host by
12523 inspecting its IP address:
12524 </para>
12525 <itemizedlist>
12526 <listitem>
12527 <para>
12528 If the pattern is a plain domain name (not a regular expression, not starting
12529 with *, not a lookup of any kind), Exim calls the operating system function
12530 to find the associated IP address(es). Exim uses the newer
12531 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
12532 This typically causes a forward DNS lookup of the name. The result is compared
12533 with the IP address of the subject host.
12534 </para>
12535 <para>
12536 If there is a temporary problem (such as a DNS timeout) with the host name
12537 lookup, a temporary error occurs. For example, if the list is being used in an
12538 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
12539 temporary SMTP error code. If no IP address can be found for the host name,
12540 what happens is described in section <xref linkend="SECTbehipnot"/> below.
12541 </para>
12542 </listitem>
12543 <listitem>
12544 <para>
12545 <indexterm role="concept">
12546 <primary>@ in a host list</primary>
12547 </indexterm>
12548 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
12549 domain name, as just described.
12550 </para>
12551 </listitem>
12552 <listitem>
12553 <para>
12554 If the pattern is an IP address, it is matched against the IP address of the
12555 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
12556 IPv6 addresses can be given in colon-separated format, but the colons have to
12557 be doubled so as not to be taken as item separators when the default list
12558 separator is used. IPv6 addresses are recognized even when Exim is compiled
12559 without IPv6 support. This means that if they appear in a host list on an
12560 IPv4-only host, Exim will not treat them as host names. They are just addresses
12561 that can never match a client host.
12562 </para>
12563 </listitem>
12564 <listitem>
12565 <para>
12566 <indexterm role="concept">
12567 <primary>@[] in a host list</primary>
12568 </indexterm>
12569 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
12570 the local host. For example, if the local host is an IPv4 host with one
12571 interface address 10.45.23.56, these two ACL statements have the same effect:
12572 </para>
12573 <literallayout class="monospaced">
12574 accept hosts = 127.0.0.1 : 10.45.23.56
12575 accept hosts = @[]
12576 </literallayout>
12577 </listitem>
12578 <listitem>
12579 <para>
12580 <indexterm role="concept">
12581 <primary>CIDR notation</primary>
12582 </indexterm>
12583 If the pattern is an IP address followed by a slash and a mask length (for
12584 example 10.11.42.0/24), it is matched against the IP address of the subject
12585 host under the given mask. This allows, an entire network of hosts to be
12586 included (or excluded) by a single item. The mask uses CIDR notation; it
12587 specifies the number of address bits that must match, starting from the most
12588 significant end of the address.
12589 </para>
12590 <para>
12591 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
12592 of a range of addresses. It is the number of bits in the network portion of the
12593 address. The above example specifies a 24-bit netmask, so it matches all 256
12594 addresses in the 10.11.42.0 network. An item such as
12595 </para>
12596 <literallayout class="monospaced">
12597 192.168.23.236/31
12598 </literallayout>
12599 <para>
12600 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
12601 32 for an IPv4 address is the same as no mask at all; just a single address
12602 matches.
12603 </para>
12604 <para>
12605 Here is another example which shows an IPv4 and an IPv6 network:
12606 </para>
12607 <literallayout class="monospaced">
12608 recipient_unqualified_hosts = 192.168.0.0/16: \
12609                               3ffe::ffff::836f::::/48
12610 </literallayout>
12611 <para>
12612 The doubling of list separator characters applies only when these items
12613 appear inline in a host list. It is not required when indirecting via a file.
12614 For example:
12615 </para>
12616 <literallayout class="monospaced">
12617 recipient_unqualified_hosts = /opt/exim/unqualnets
12618 </literallayout>
12619 <para>
12620 could make use of a file containing
12621 </para>
12622 <literallayout class="monospaced">
12623 172.16.0.0/12
12624 3ffe:ffff:836f::/48
12625 </literallayout>
12626 <para>
12627 to have exactly the same effect as the previous example. When listing IPv6
12628 addresses inline, it is usually more convenient to use the facility for
12629 changing separator characters. This list contains the same two networks:
12630 </para>
12631 <literallayout class="monospaced">
12632 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
12633                                  3ffe:ffff:836f::/48
12634 </literallayout>
12635 <para>
12636 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
12637 list.
12638 </para>
12639 </listitem>
12640 </itemizedlist>
12641 </section>
12642 <section id="SECThoslispatsikey">
12643 <title>Host list patterns for single-key lookups by host address</title>
12644 <para>
12645 <indexterm role="concept">
12646 <primary>host list</primary>
12647 <secondary>lookup of IP address</secondary>
12648 </indexterm>
12649 When a host is to be identified by a single-key lookup of its complete IP
12650 address, the pattern takes this form:
12651 </para>
12652 <literallayout>
12653 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
12654 </literallayout>
12655 <para>
12656 For example:
12657 </para>
12658 <literallayout class="monospaced">
12659 hosts_lookup = net-cdb;/hosts-by-ip.db
12660 </literallayout>
12661 <para>
12662 The text form of the IP address of the subject host is used as the lookup key.
12663 IPv6 addresses are converted to an unabbreviated form, using lower case
12664 letters, with dots as separators because colon is the key terminator in
12665 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
12666 quoting the keys, but this is a facility that was added later.] The data
12667 returned by the lookup is not used.
12668 </para>
12669 <para>
12670 <indexterm role="concept">
12671 <primary>IP address</primary>
12672 <secondary>masking</secondary>
12673 </indexterm>
12674 <indexterm role="concept">
12675 <primary>host list</primary>
12676 <secondary>masked IP address</secondary>
12677 </indexterm>
12678 Single-key lookups can also be performed using masked IP addresses, using
12679 patterns of this form:
12680 </para>
12681 <literallayout>
12682 <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>
12683 </literallayout>
12684 <para>
12685 For example:
12686 </para>
12687 <literallayout class="monospaced">
12688 net24-dbm;/networks.db
12689 </literallayout>
12690 <para>
12691 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
12692 length. A textual string is constructed from the masked value, followed by the
12693 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
12694 is 192.168.34.6, the key that is looked up for the above example is
12695 <quote>192.168.34.0/24</quote>.
12696 </para>
12697 <para>
12698 When an IPv6 address is converted to a string, dots are normally used instead
12699 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
12700 terminate <command>lsearch</command> keys). This was implemented some time before the ability
12701 to quote keys was made available in <command>lsearch</command> files. However, the more
12702 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
12703 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
12704 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
12705 converted using colons and not dots. In all cases, full, unabbreviated IPv6
12706 addresses are always used.
12707 </para>
12708 <para>
12709 Ideally, it would be nice to tidy up this anomalous situation by changing to
12710 colons in all cases, given that quoting is now available for <command>lsearch</command>.
12711 However, this would be an incompatible change that might break some existing
12712 configurations.
12713 </para>
12714 <para>
12715 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
12716 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
12717 the former case the key strings include the mask value, whereas in the latter
12718 case the IP address is used on its own.
12719 </para>
12720 </section>
12721 <section id="SECThoslispatnam">
12722 <title>Host list patterns that match by host name</title>
12723 <para>
12724 <indexterm role="concept">
12725 <primary>host</primary>
12726 <secondary>lookup failures</secondary>
12727 </indexterm>
12728 <indexterm role="concept">
12729 <primary>unknown host name</primary>
12730 </indexterm>
12731 <indexterm role="concept">
12732 <primary>host list</primary>
12733 <secondary>matching host name</secondary>
12734 </indexterm>
12735 There are several types of pattern that require Exim to know the name of the
12736 remote host. These are either wildcard patterns or lookups by name. (If a
12737 complete hostname is given without any wildcarding, it is used to find an IP
12738 address to match against, as described in section <xref linkend="SECThoslispatip"/>
12739 above.)
12740 </para>
12741 <para>
12742 If the remote host name is not already known when Exim encounters one of these
12743 patterns, it has to be found from the IP address.
12744 Although many sites on the Internet are conscientious about maintaining reverse
12745 DNS data for their hosts, there are also many that do not do this.
12746 Consequently, a name cannot always be found, and this may lead to unwanted
12747 effects. Take care when configuring host lists with wildcarded name patterns.
12748 Consider what will happen if a name cannot be found.
12749 </para>
12750 <para>
12751 Because of the problems of determining host names from IP addresses, matching
12752 against host names is not as common as matching against IP addresses.
12753 </para>
12754 <para>
12755 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12756 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12757 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12758 are done can be changed by setting the <option>host_lookup_order</option> option. For
12759 security, once Exim has found one or more names, it looks up the IP addresses
12760 for these names and compares them with the IP address that it started with.
12761 Only those names whose IP addresses match are accepted. Any other names are
12762 discarded. If no names are left, Exim behaves as if the host name cannot be
12763 found. In the most common case there is only one name and one IP address.
12764 </para>
12765 <para>
12766 There are some options that control what happens if a host name cannot be
12767 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12768 </para>
12769 <para>
12770 <indexterm role="concept">
12771 <primary>host</primary>
12772 <secondary>alias for</secondary>
12773 </indexterm>
12774 <indexterm role="concept">
12775 <primary>alias for host</primary>
12776 </indexterm>
12777 As a result of aliasing, hosts may have more than one name. When processing any
12778 of the following types of pattern, all the host&#x2019;s names are checked:
12779 </para>
12780 <itemizedlist>
12781 <listitem>
12782 <para>
12783 <indexterm role="concept">
12784 <primary>asterisk</primary>
12785 <secondary>in host list</secondary>
12786 </indexterm>
12787 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12788 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12789 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12790 requirement. Other kinds of wildcarding require the use of a regular
12791 expression.
12792 </para>
12793 </listitem>
12794 <listitem>
12795 <para>
12796 <indexterm role="concept">
12797 <primary>regular expressions</primary>
12798 <secondary>in host list</secondary>
12799 </indexterm>
12800 <indexterm role="concept">
12801 <primary>host list</primary>
12802 <secondary>regular expression in</secondary>
12803 </indexterm>
12804 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12805 matched against the host name. Host names are case-independent, so this regular
12806 expression match is by default case-independent, but you can make it
12807 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12808 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12809 example,
12810 </para>
12811 <literallayout class="monospaced">
12812 ^(a|b)\.c\.d$
12813 </literallayout>
12814 <para>
12815 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12816 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12817 that backslash and dollar characters are not misinterpreted as part of the
12818 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12819 part of the string as non-expandable. For example:
12820 </para>
12821 <literallayout class="monospaced">
12822 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12823 </literallayout>
12824 <para>
12825 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12826 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12827 example. Without it, a match at the start of the host name is all that is
12828 required.
12829 </para>
12830 </listitem>
12831 </itemizedlist>
12832 </section>
12833 <section id="SECTbehipnot">
12834 <title>Behaviour when an IP address or name cannot be found</title>
12835 <para>
12836 <indexterm role="concept">
12837 <primary>host</primary>
12838 <secondary>lookup failures, permanent</secondary>
12839 </indexterm>
12840 While processing a host list, Exim may need to look up an IP address from a
12841 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12842 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12843 behaviour when it fails to find the information it is seeking is the same.
12844 </para>
12845 <para>
12846 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12847 apply to temporary DNS errors, whose handling is described in the next section.
12848 </para>
12849 <para>
12850 <indexterm role="concept">
12851 <primary><literal>+include_unknown</literal></primary>
12852 </indexterm>
12853 <indexterm role="concept">
12854 <primary><literal>+ignore_unknown</literal></primary>
12855 </indexterm>
12856 Exim parses a host list from left to right. If it encounters a permanent
12857 lookup failure in any item in the host list before it has found a match,
12858 Exim treats it as a failure and the default behavior is as if the host
12859 does not match the list. This may not always be what you want to happen.
12860 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
12861 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
12862 not recognized in an indirected file).
12863 </para>
12864 <itemizedlist>
12865 <listitem>
12866 <para>
12867 If any item that follows <literal>+include_unknown</literal> requires information that
12868 cannot found, Exim behaves as if the host does match the list. For example,
12869 </para>
12870 <literallayout class="monospaced">
12871 host_reject_connection = +include_unknown:*.enemy.ex
12872 </literallayout>
12873 <para>
12874 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12875 any hosts whose name it cannot find.
12876 </para>
12877 </listitem>
12878 <listitem>
12879 <para>
12880 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12881 be found, Exim ignores that item and proceeds to the rest of the list. For
12882 example:
12883 </para>
12884 <literallayout class="monospaced">
12885 accept hosts = +ignore_unknown : friend.example : \
12886                192.168.4.5
12887 </literallayout>
12888 <para>
12889 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12890 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12891 name can be found for 192.168.4.5, it is rejected.
12892 </para>
12893 </listitem>
12894 </itemizedlist>
12895 <para>
12896 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12897 list. The effect of each one lasts until the next, or until the end of the
12898 list.
12899 </para>
12900 </section>
12901 <section id="SECTmixwilhos">
12902 <title>Mixing wildcarded host names and addresses in host lists</title>
12903 <para>
12904 <indexterm role="concept">
12905 <primary>host list</primary>
12906 <secondary>mixing names and addresses in</secondary>
12907 </indexterm>
12908 </para>
12909 <para>
12910 This section explains the host/ip processing logic with the same concepts
12911 as the previous section, but specifically addresses what happens when a
12912 wildcarded hostname is one of the items in the hostlist.
12913 </para>
12914 <itemizedlist>
12915 <listitem>
12916 <para>
12917 If you have name lookups or wildcarded host names and
12918 IP addresses in the same host list, you should normally put the IP
12919 addresses first. For example, in an ACL you could have:
12920 </para>
12921 <literallayout class="monospaced">
12922 accept hosts = 10.9.8.7 : *.friend.example
12923 </literallayout>
12924 <para>
12925 The reason you normally would order it this way lies in the
12926 left-to-right way that Exim processes lists.  It can test IP addresses
12927 without doing any DNS lookups, but when it reaches an item that requires
12928 a host name, it fails if it cannot find a host name to compare with the
12929 pattern. If the above list is given in the opposite order, the
12930 <option>accept</option> statement fails for a host whose name cannot be found, even
12931 if its IP address is 10.9.8.7.
12932 </para>
12933 </listitem>
12934 <listitem>
12935 <para>
12936 If you really do want to do the name check first, and still recognize the IP
12937 address, you can rewrite the ACL like this:
12938 </para>
12939 <literallayout class="monospaced">
12940 accept hosts = *.friend.example
12941 accept hosts = 10.9.8.7
12942 </literallayout>
12943 <para>
12944 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12945 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
12946 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
12947 this section.
12948 </para>
12949 </listitem>
12950 </itemizedlist>
12951 </section>
12952 <section id="SECTtemdnserr">
12953 <title>Temporary DNS errors when looking up host information</title>
12954 <para>
12955 <indexterm role="concept">
12956 <primary>host</primary>
12957 <secondary>lookup failures, temporary</secondary>
12958 </indexterm>
12959 <indexterm role="concept">
12960 <primary><literal>+include_defer</literal></primary>
12961 </indexterm>
12962 <indexterm role="concept">
12963 <primary><literal>+ignore_defer</literal></primary>
12964 </indexterm>
12965 A temporary DNS lookup failure normally causes a defer action (except when
12966 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12967 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
12968 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12969 section. These options should be used with care, probably only in non-critical
12970 host lists such as whitelists.
12971 </para>
12972 </section>
12973 <section id="SECThoslispatnamsk">
12974 <title>Host list patterns for single-key lookups by host name</title>
12975 <para>
12976 <indexterm role="concept">
12977 <primary>unknown host name</primary>
12978 </indexterm>
12979 <indexterm role="concept">
12980 <primary>host list</primary>
12981 <secondary>matching host name</secondary>
12982 </indexterm>
12983 If a pattern is of the form
12984 </para>
12985 <literallayout>
12986 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
12987 </literallayout>
12988 <para>
12989 for example
12990 </para>
12991 <literallayout class="monospaced">
12992 dbm;/host/accept/list
12993 </literallayout>
12994 <para>
12995 a single-key lookup is performed, using the host name as its key. If the
12996 lookup succeeds, the host matches the item. The actual data that is looked up
12997 is not used.
12998 </para>
12999 <para>
13000 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
13001 keys in the file, not IP addresses. If you want to do lookups based on IP
13002 addresses, you must precede the search type with <quote>net-</quote> (see section
13003 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
13004 two items in the same list, one doing an address lookup and one doing a name
13005 lookup, both using the same file.
13006 </para>
13007 </section>
13008 <section id="SECID81">
13009 <title>Host list patterns for query-style lookups</title>
13010 <para>
13011 If a pattern is of the form
13012 </para>
13013 <literallayout>
13014 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
13015 </literallayout>
13016 <para>
13017 the query is obeyed, and if it succeeds, the host matches the item. The actual
13018 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
13019 <varname>$sender_host_name</varname> can be used in the query. For example:
13020 </para>
13021 <literallayout class="monospaced">
13022 hosts_lookup = pgsql;\
13023   select ip from hostlist where ip='$sender_host_address'
13024 </literallayout>
13025 <para>
13026 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
13027 can use the <option>sg</option> expansion item to change this if you need to. If you want to
13028 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
13029 operator.
13030 </para>
13031 <para>
13032 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
13033 looks up the host name if it has not already done so. (See section
13034 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
13035 </para>
13036 <para>
13037 Historical note: prior to release 4.30, Exim would always attempt to find a
13038 host name before running the query, unless the search type was preceded by
13039 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
13040 still recognized for query-style lookups, but its presence or absence has no
13041 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
13042 See section <xref linkend="SECThoslispatsikey"/>.)
13043 </para>
13044 </section>
13045 <section id="SECTaddresslist">
13046 <title>Address lists</title>
13047 <para>
13048 <indexterm role="concept">
13049 <primary>list</primary>
13050 <secondary>address list</secondary>
13051 </indexterm>
13052 <indexterm role="concept">
13053 <primary>address list</primary>
13054 <secondary>empty item</secondary>
13055 </indexterm>
13056 <indexterm role="concept">
13057 <primary>address list</primary>
13058 <secondary>patterns</secondary>
13059 </indexterm>
13060 Address lists contain patterns that are matched against mail addresses. There
13061 is one special case to be considered: the sender address of a bounce message is
13062 always empty. You can test for this by providing an empty item in an address
13063 list. For example, you can set up a router to process bounce messages by
13064 using this option setting:
13065 </para>
13066 <literallayout class="monospaced">
13067 senders = :
13068 </literallayout>
13069 <para>
13070 The presence of the colon creates an empty item. If you do not provide any
13071 data, the list is empty and matches nothing. The empty sender can also be
13072 detected by a regular expression that matches an empty string,
13073 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
13074 </para>
13075 <para>
13076 Non-empty items in an address list can be straightforward email addresses. For
13077 example:
13078 </para>
13079 <literallayout class="monospaced">
13080 senders = jbc@askone.example : hs@anacreon.example
13081 </literallayout>
13082 <para>
13083 A certain amount of wildcarding is permitted. If a pattern contains an @
13084 character, but is not a regular expression and does not begin with a
13085 semicolon-terminated lookup type (described below), the local part of the
13086 subject address is compared with the local part of the pattern, which may start
13087 with an asterisk. If the local parts match, the domain is checked in exactly
13088 the same way as for a pattern in a domain list. For example, the domain can be
13089 wildcarded, refer to a named list, or be a lookup:
13090 </para>
13091 <literallayout class="monospaced">
13092 deny senders = *@*.spamming.site:\
13093                *@+hostile_domains:\
13094                bozo@partial-lsearch;/list/of/dodgy/sites:\
13095                *@dbm;/bad/domains.db
13096 </literallayout>
13097 <para>
13098 <indexterm role="concept">
13099 <primary>local part</primary>
13100 <secondary>starting with !</secondary>
13101 </indexterm>
13102 <indexterm role="concept">
13103 <primary>address list</primary>
13104 <secondary>local part starting with !</secondary>
13105 </indexterm>
13106 If a local part that begins with an exclamation mark is required, it has to be
13107 specified using a regular expression, because otherwise the exclamation mark is
13108 treated as a sign of negation, as is standard in lists.
13109 </para>
13110 <para>
13111 If a non-empty pattern that is not a regular expression or a lookup does not
13112 contain an @ character, it is matched against the domain part of the subject
13113 address. The only two formats that are recognized this way are a literal
13114 domain, or a domain pattern that starts with *. In both these cases, the effect
13115 is the same as if <literal>*@</literal> preceded the pattern. For example:
13116 </para>
13117 <literallayout class="monospaced">
13118 deny senders = enemy.domain : *.enemy.domain
13119 </literallayout>
13120 <para>
13121 The following kinds of more complicated address list pattern can match any
13122 address, including the empty address that is characteristic of bounce message
13123 senders:
13124 </para>
13125 <itemizedlist>
13126 <listitem>
13127 <para>
13128 <indexterm role="concept">
13129 <primary>regular expressions</primary>
13130 <secondary>in address list</secondary>
13131 </indexterm>
13132 <indexterm role="concept">
13133 <primary>address list</primary>
13134 <secondary>regular expression in</secondary>
13135 </indexterm>
13136 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
13137 done against the complete address, with the pattern as the regular expression.
13138 You must take care that backslash and dollar characters are not misinterpreted
13139 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
13140 to mark that part of the string as non-expandable. For example:
13141 </para>
13142 <literallayout class="monospaced">
13143 deny senders = \N^.*this.*@example\.com$\N : \
13144                \N^\d{8}.+@spamhaus.example$\N : ...
13145 </literallayout>
13146 <para>
13147 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
13148 start with <quote>^</quote> by the time they are being interpreted as address patterns.
13149 </para>
13150 </listitem>
13151 <listitem>
13152 <para>
13153 <indexterm role="concept">
13154 <primary>address list</primary>
13155 <secondary>lookup for complete address</secondary>
13156 </indexterm>
13157 Complete addresses can be looked up by using a pattern that starts with a
13158 lookup type terminated by a semicolon, followed by the data for the lookup. For
13159 example:
13160 </para>
13161 <literallayout class="monospaced">
13162 deny senders = cdb;/etc/blocked.senders : \
13163   mysql;select address from blocked where \
13164   address='${quote_mysql:$sender_address}'
13165 </literallayout>
13166 <para>
13167 Both query-style and single-key lookup types can be used. For a single-key
13168 lookup type, Exim uses the complete address as the key. However, empty keys are
13169 not supported for single-key lookups, so a match against the empty address
13170 always fails. This restriction does not apply to query-style lookups.
13171 </para>
13172 <para>
13173 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
13174 cannot be used, and is ignored if specified, with an entry being written to the
13175 panic log.
13176 <indexterm role="concept">
13177 <primary>*@ with single-key lookup</primary>
13178 </indexterm>
13179 However, you can configure lookup defaults, as described in section
13180 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
13181 default. For example, with this lookup:
13182 </para>
13183 <literallayout class="monospaced">
13184 accept senders = lsearch*@;/some/file
13185 </literallayout>
13186 <para>
13187 the file could contains lines like this:
13188 </para>
13189 <literallayout class="monospaced">
13190 user1@domain1.example
13191 *@domain2.example
13192 </literallayout>
13193 <para>
13194 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
13195 that are tried is:
13196 </para>
13197 <literallayout class="monospaced">
13198 nimrod@jaeger.example
13199 *@jaeger.example
13200 *
13201 </literallayout>
13202 <para>
13203 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
13204 would mean that every address matches, thus rendering the test useless.
13205 </para>
13206 <para>
13207 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
13208 </para>
13209 <literallayout class="monospaced">
13210 deny recipients = dbm*@;/some/file
13211 deny recipients = *@dbm;/some/file
13212 </literallayout>
13213 <para>
13214 The first does a whole address lookup, with defaulting, as just described,
13215 because it starts with a lookup type. The second matches the local part and
13216 domain independently, as described in a bullet point below.
13217 </para>
13218 </listitem>
13219 </itemizedlist>
13220 <para>
13221 The following kinds of address list pattern can match only non-empty addresses.
13222 If the subject address is empty, a match against any of these pattern types
13223 always fails.
13224 </para>
13225 <itemizedlist>
13226 <listitem>
13227 <para>
13228 <indexterm role="concept">
13229 <primary>@@ with single-key lookup</primary>
13230 </indexterm>
13231 <indexterm role="concept">
13232 <primary>address list</primary>
13233 <secondary>@@ lookup type</secondary>
13234 </indexterm>
13235 <indexterm role="concept">
13236 <primary>address list</primary>
13237 <secondary>split local part and domain</secondary>
13238 </indexterm>
13239 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
13240 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
13241 split into a local part and a domain. The domain is looked up in the file. If
13242 it is not found, there is no match. If it is found, the data that is looked up
13243 from the file is treated as a colon-separated list of local part patterns, each
13244 of which is matched against the subject local part in turn.
13245 </para>
13246 <para>
13247 <indexterm role="concept">
13248 <primary>asterisk</primary>
13249 <secondary>in address list</secondary>
13250 </indexterm>
13251 The lookup may be a partial one, and/or one involving a search for a default
13252 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
13253 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
13254 even be further lookups. They may also be independently negated. For example,
13255 with
13256 </para>
13257 <literallayout class="monospaced">
13258 deny senders = @@dbm;/etc/reject-by-domain
13259 </literallayout>
13260 <para>
13261 the data from which the DBM file is built could contain lines like
13262 </para>
13263 <literallayout class="monospaced">
13264 baddomain.com:  !postmaster : *
13265 </literallayout>
13266 <para>
13267 to reject all senders except <option>postmaster</option> from that domain.
13268 </para>
13269 <para>
13270 <indexterm role="concept">
13271 <primary>local part</primary>
13272 <secondary>starting with !</secondary>
13273 </indexterm>
13274 If a local part that actually begins with an exclamation mark is required, it
13275 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13276 may be split over several lines by indenting the second and subsequent lines,
13277 but the separating colon must still be included at line breaks. White space
13278 surrounding the colons is ignored. For example:
13279 </para>
13280 <literallayout class="monospaced">
13281 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13282   spammer3 : spammer4
13283 </literallayout>
13284 <para>
13285 As in all colon-separated lists in Exim, a colon can be included in an item by
13286 doubling.
13287 </para>
13288 <para>
13289 If the last item in the list starts with a right angle-bracket, the remainder
13290 of the item is taken as a new key to look up in order to obtain a continuation
13291 list of local parts. The new key can be any sequence of characters. Thus one
13292 might have entries like
13293 </para>
13294 <literallayout class="monospaced">
13295 aol.com: spammer1 : spammer 2 : &gt;*
13296 xyz.com: spammer3 : &gt;*
13297 *:       ^\d{8}$
13298 </literallayout>
13299 <para>
13300 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13301 local parts for all domains, in addition to the specific local parts listed for
13302 each domain. Of course, using this feature costs another lookup each time a
13303 chain is followed, but the effort needed to maintain the data is reduced.
13304 </para>
13305 <para>
13306 <indexterm role="concept">
13307 <primary>loop</primary>
13308 <secondary>in lookups</secondary>
13309 </indexterm>
13310 It is possible to construct loops using this facility, and in order to catch
13311 them, the chains may be no more than fifty items long.
13312 </para>
13313 </listitem>
13314 <listitem>
13315 <para>
13316 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
13317 lookup, but in this case, the chaining facility is not available. The lookup
13318 can only return a single list of local parts.
13319 </para>
13320 </listitem>
13321 </itemizedlist>
13322 <para>
13323 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
13324 in these two examples:
13325 </para>
13326 <literallayout class="monospaced">
13327 senders = +my_list
13328 senders = *@+my_list
13329 </literallayout>
13330 <para>
13331 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
13332 example it is a named domain list.
13333 </para>
13334 </section>
13335 <section id="SECTcasletadd">
13336 <title>Case of letters in address lists</title>
13337 <para>
13338 <indexterm role="concept">
13339 <primary>case of local parts</primary>
13340 </indexterm>
13341 <indexterm role="concept">
13342 <primary>address list</primary>
13343 <secondary>case forcing</secondary>
13344 </indexterm>
13345 <indexterm role="concept">
13346 <primary>case forcing in address lists</primary>
13347 </indexterm>
13348 Domains in email addresses are always handled caselessly, but for local parts
13349 case may be significant on some systems (see <option>caseful_local_part</option> for how
13350 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
13351 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
13352 blocking lists should be done in a case-independent manner. Since most address
13353 lists in Exim are used for this kind of control, Exim attempts to do this by
13354 default.
13355 </para>
13356 <para>
13357 The domain portion of an address is always lowercased before matching it to an
13358 address list. The local part is lowercased by default, and any string
13359 comparisons that take place are done caselessly. This means that the data in
13360 the address list itself, in files included as plain file names, and in any file
13361 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
13362 keys in files that are looked up by a search type other than <command>lsearch</command> (which
13363 works caselessly) must be in lower case, because these lookups are not
13364 case-independent.
13365 </para>
13366 <para>
13367 <indexterm role="concept">
13368 <primary><literal>+caseful</literal></primary>
13369 </indexterm>
13370 To allow for the possibility of caseful address list matching, if an item in
13371 an address list is the string <quote>+caseful</quote>, the original case of the local
13372 part is restored for any comparisons that follow, and string comparisons are no
13373 longer case-independent. This does not affect the domain, which remains in
13374 lower case. However, although independent matches on the domain alone are still
13375 performed caselessly, regular expressions that match against an entire address
13376 become case-sensitive after <quote>+caseful</quote> has been seen.
13377 </para>
13378 </section>
13379 <section id="SECTlocparlis">
13380 <title>Local part lists</title>
13381 <para>
13382 <indexterm role="concept">
13383 <primary>list</primary>
13384 <secondary>local part list</secondary>
13385 </indexterm>
13386 <indexterm role="concept">
13387 <primary>local part</primary>
13388 <secondary>list</secondary>
13389 </indexterm>
13390 Case-sensitivity in local part lists is handled in the same way as for address
13391 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
13392 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
13393 set false, the subject is lowercased and the matching is initially
13394 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
13395 matching in the local part list, but not elsewhere in the router. If
13396 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
13397 option is case-sensitive from the start.
13398 </para>
13399 <para>
13400 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
13401 comments are handled in the same way as address lists &ndash; they are recognized
13402 only if the # is preceded by white space or the start of the line.
13403 Otherwise, local part lists are matched in the same way as domain lists, except
13404 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
13405 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
13406 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
13407 types.
13408 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
13409 </para>
13410 </section>
13411 </chapter>
13412
13413 <chapter id="CHAPexpand">
13414 <title>String expansions</title>
13415 <para>
13416 <indexterm role="concept" id="IIDstrexp" class="startofrange">
13417 <primary>expansion</primary>
13418 <secondary>of strings</secondary>
13419 </indexterm>
13420 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
13421 them are expanded every time they are used; others are expanded only once.
13422 </para>
13423 <para>
13424 When a string is being expanded it is copied verbatim from left to right except
13425 when a dollar or backslash character is encountered. A dollar specifies the
13426 start of a portion of the string that is interpreted and replaced as described
13427 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
13428 escape character, as described in the following section.
13429 </para>
13430 <para>
13431 Whether a string is expanded depends upon the context.  Usually this is solely
13432 dependent upon the option for which a value is sought; in this documentation,
13433 options for which string expansion is performed are marked with &dagger; after
13434 the data type.  ACL rules always expand strings.  A couple of expansion
13435 conditions do not expand some of the brace-delimited branches, for security
13436 reasons.
13437 </para>
13438 <section id="SECTlittext">
13439 <title>Literal text in expanded strings</title>
13440 <para>
13441 <indexterm role="concept">
13442 <primary>expansion</primary>
13443 <secondary>including literal text</secondary>
13444 </indexterm>
13445 An uninterpreted dollar can be included in an expanded string by putting a
13446 backslash in front of it. A backslash can be used to prevent any special
13447 character being treated specially in an expansion, including backslash itself.
13448 If the string appears in quotes in the configuration file, two backslashes are
13449 required because the quotes themselves cause interpretation of backslashes when
13450 the string is read in (see section <xref linkend="SECTstrings"/>).
13451 </para>
13452 <para>
13453 <indexterm role="concept">
13454 <primary>expansion</primary>
13455 <secondary>non-expandable substrings</secondary>
13456 </indexterm>
13457 A portion of the string can specified as non-expandable by placing it between
13458 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
13459 expressions, which often contain backslashes and dollar signs. For example:
13460 </para>
13461 <literallayout class="monospaced">
13462 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
13463 </literallayout>
13464 <para>
13465 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
13466 without interpretation until it reaches the next <literal>\N</literal> or the end of the
13467 string.
13468 </para>
13469 </section>
13470 <section id="SECID82">
13471 <title>Character escape sequences in expanded strings</title>
13472 <para>
13473 <indexterm role="concept">
13474 <primary>expansion</primary>
13475 <secondary>escape sequences</secondary>
13476 </indexterm>
13477 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
13478 expanded string is recognized as an escape sequence for the character newline,
13479 carriage return, or tab, respectively. A backslash followed by up to three
13480 octal digits is recognized as an octal encoding for a single character, and a
13481 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
13482 encoding.
13483 </para>
13484 <para>
13485 These escape sequences are also recognized in quoted strings when they are read
13486 in. Their interpretation in expansions as well is useful for unquoted strings,
13487 and for other cases such as looked-up strings that are then expanded.
13488 </para>
13489 </section>
13490 <section id="SECID83">
13491 <title>Testing string expansions</title>
13492 <para>
13493 <indexterm role="concept">
13494 <primary>expansion</primary>
13495 <secondary>testing</secondary>
13496 </indexterm>
13497 <indexterm role="concept">
13498 <primary>testing</primary>
13499 <secondary>string expansion</secondary>
13500 </indexterm>
13501 <indexterm role="option">
13502 <primary><option>-be</option></primary>
13503 </indexterm>
13504 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
13505 takes the command arguments, or lines from the standard input if there are no
13506 arguments, runs them through the string expansion code, and writes the results
13507 to the standard output. Variables based on configuration values are set up, but
13508 since no message is being processed, variables such as <varname>$local_part</varname> have no
13509 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
13510 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
13511 and <option>nhash</option>.
13512 </para>
13513 <para>
13514 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
13515 instead runs under the uid and gid it was called with, to prevent users from
13516 using <option>-be</option> for reading files to which they do not have access.
13517 </para>
13518 <para>
13519 <indexterm role="option">
13520 <primary><option>-bem</option></primary>
13521 </indexterm>
13522 If you want to test expansions that include variables whose values are taken
13523 from a message, there are two other options that can be used. The <option>-bem</option>
13524 option is like <option>-be</option> except that it is followed by a file name. The file is
13525 read as a message before doing the test expansions. For example:
13526 </para>
13527 <literallayout class="monospaced">
13528 exim -bem /tmp/test.message '$h_subject:'
13529 </literallayout>
13530 <para>
13531 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
13532 Exim message identifier. For example:
13533 </para>
13534 <literallayout class="monospaced">
13535 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
13536 </literallayout>
13537 <para>
13538 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
13539 is therefore restricted to admin users.
13540 </para>
13541 </section>
13542 <section id="SECTforexpfai">
13543 <title>Forced expansion failure</title>
13544 <para>
13545 <indexterm role="concept">
13546 <primary>expansion</primary>
13547 <secondary>forced failure</secondary>
13548 </indexterm>
13549 A number of expansions that are described in the following section have
13550 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
13551 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
13552 used depends on some condition that is evaluated as part of the expansion. If,
13553 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
13554 the entire string expansion fails in a way that can be detected by the code
13555 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
13556 its consequences depend on the circumstances. In some cases it is no different
13557 from any other expansion failure, but in others a different action may be
13558 taken. Such variations are mentioned in the documentation of the option that is
13559 being expanded.
13560 </para>
13561 </section>
13562 <section id="SECTexpansionitems">
13563 <title>Expansion items</title>
13564 <para>
13565 The following items are recognized in expanded strings. White space may be used
13566 between sub-items that are keywords or substrings enclosed in braces inside an
13567 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
13568 white space is significant.
13569 </para>
13570 <variablelist>
13571 <varlistentry>
13572 <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>
13573 <listitem>
13574 <para>
13575 <indexterm role="concept">
13576 <primary>expansion</primary>
13577 <secondary>variables</secondary>
13578 </indexterm>
13579 Substitute the contents of the named variable, for example:
13580 </para>
13581 <literallayout class="monospaced">
13582 $local_part
13583 ${domain}
13584 </literallayout>
13585 <para>
13586 The second form can be used to separate the name from subsequent alphanumeric
13587 characters. This form (using braces) is available only for variables; it does
13588 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
13589 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
13590 given, the expansion fails.
13591 </para>
13592 </listitem></varlistentry>
13593 <varlistentry>
13594 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13595 <listitem>
13596 <para>
13597 <indexterm role="concept">
13598 <primary>expansion</primary>
13599 <secondary>operators</secondary>
13600 </indexterm>
13601 The string is first itself expanded, and then the operation specified by
13602 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
13603 </para>
13604 <literallayout class="monospaced">
13605 ${lc:$local_part}
13606 </literallayout>
13607 <para>
13608 The string starts with the first character after the colon, which may be
13609 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
13610 below. The operator notation is used for simple expansion items that have just
13611 one argument, because it reduces the number of braces and therefore makes the
13612 string easier to understand.
13613 </para>
13614 </listitem></varlistentry>
13615 <varlistentry>
13616 <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>
13617 <listitem>
13618 <para>
13619 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
13620 expansion item below.
13621 </para>
13622 </listitem></varlistentry>
13623 <varlistentry>
13624 <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>
13625 <listitem>
13626 <para>
13627 <indexterm role="concept">
13628 <primary>expansion</primary>
13629 <secondary>calling an acl</secondary>
13630 </indexterm>
13631 <indexterm role="concept">
13632 <primary><option>acl</option></primary>
13633 <secondary>call from expansion</secondary>
13634 </indexterm>
13635 The name and zero to nine argument strings are first expanded separately.  The expanded
13636 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
13637 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
13638 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
13639 and may use the variables; if another acl expansion is used the values
13640 are restored after it returns.  If the ACL sets
13641 a value using a "message =" modifier and returns accept or deny, the value becomes
13642 the result of the expansion.
13643 If no message is set and the ACL returns accept or deny
13644 the expansion result is an empty string.
13645 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
13646 </para>
13647 </listitem></varlistentry>
13648 <varlistentry>
13649 <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>
13650 <listitem>
13651 <para>
13652 <indexterm role="concept">
13653 <primary>expansion</primary>
13654 <secondary>extracting certificate fields</secondary>
13655 </indexterm>
13656 <indexterm role="concept">
13657 <primary><option>certextract</option></primary>
13658 <secondary>certificate fields</secondary>
13659 </indexterm>
13660 <indexterm role="concept">
13661 <primary>certificate</primary>
13662 <secondary>extracting fields</secondary>
13663 </indexterm>
13664 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
13665 The field name is expanded and used to retrieve the relevant field from
13666 the certificate.  Supported fields are:
13667 </para>
13668 <literallayout>
13669 <literal>version        </literal>
13670 <literal>serial_number  </literal>
13671 <literal>subject        </literal> RFC4514 DN
13672 <literal>issuer         </literal> RFC4514 DN
13673 <literal>notbefore      </literal> time
13674 <literal>notafter       </literal> time
13675 <literal>sig_algorithm  </literal>
13676 <literal>signature      </literal>
13677 <literal>subj_altname   </literal> tagged list
13678 <literal>ocsp_uri       </literal> list
13679 <literal>crl_uri        </literal> list
13680 </literallayout>
13681 <para>
13682 If the field is found,
13683 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13684 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13685 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13686 is restored to any previous value it might have had.
13687 </para>
13688 <para>
13689 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13690 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13691 extracted is used.
13692 </para>
13693 <para>
13694 Some field names take optional modifiers, appended and separated by commas.
13695 </para>
13696 <para>
13697 The field selectors marked as "RFC4514" above
13698 output a Distinguished Name string which is
13699 not quite
13700 parseable by Exim as a comma-separated tagged list
13701 (the exceptions being elements containing commas).
13702 RDN elements of a single type may be selected by
13703 a modifier of the type label; if so the expansion
13704 result is a list (newline-separated by default).
13705 The separator may be changed by another modifier of
13706 a right angle-bracket followed immediately by the new separator.
13707 Recognised RDN type labels include "CN", "O", "OU" and "DC".
13708 </para>
13709 <para>
13710 The field selectors marked as "time" above
13711 take an optional modifier of "int"
13712 for which the result is the number of seconds since epoch.
13713 Otherwise the result is a human-readable string
13714 in the timezone selected by the main "timezone" option.
13715 </para>
13716 <para>
13717 The field selectors marked as "list" above return a list,
13718 newline-separated by default,
13719 (embedded separator characters in elements are doubled).
13720 The separator may be changed by a modifier of
13721 a right angle-bracket followed immediately by the new separator.
13722 </para>
13723 <para>
13724 The field selectors marked as "tagged" above
13725 prefix each list element with a type string and an equals sign.
13726 Elements of only one type may be selected by a modifier
13727 which is one of "dns", "uri" or "mail";
13728 if so the element tags are omitted.
13729 </para>
13730 <para>
13731 If not otherwise noted field values are presented in human-readable form.
13732 </para>
13733 </listitem></varlistentry>
13734 <varlistentry>
13735 <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>
13736 <listitem>
13737 <para>
13738 <indexterm role="concept">
13739 <primary><option>dlfunc</option></primary>
13740 </indexterm>
13741 This expansion dynamically loads and then calls a locally-written C function.
13742 This functionality is available only if Exim is compiled with
13743 </para>
13744 <literallayout class="monospaced">
13745 EXPAND_DLFUNC=yes
13746 </literallayout>
13747 <para>
13748 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
13749 object so that it doesn&#x2019;t reload the same object file in the same Exim process
13750 (but of course Exim does start new processes frequently).
13751 </para>
13752 <para>
13753 There may be from zero to eight arguments to the function. When compiling
13754 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
13755 included. The Exim variables and functions that are defined by that API
13756 are also available for dynamically loaded functions. The function itself
13757 must have the following type:
13758 </para>
13759 <literallayout class="monospaced">
13760 int dlfunction(uschar **yield, int argc, uschar *argv[])
13761 </literallayout>
13762 <para>
13763 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
13764 function should return one of the following values:
13765 </para>
13766 <para>
13767 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
13768 into the expanded string that is being built.
13769 </para>
13770 <para>
13771 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
13772 from <emphasis>yield</emphasis>, if it is set.
13773 </para>
13774 <para>
13775 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
13776 taken from <emphasis>yield</emphasis> if it is set.
13777 </para>
13778 <para>
13779 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
13780 </para>
13781 <para>
13782 When compiling a function that is to be used in this way with gcc,
13783 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
13784 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
13785 </para>
13786 </listitem></varlistentry>
13787 <varlistentry>
13788 <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>
13789 <listitem>
13790 <para>
13791 <indexterm role="concept">
13792 <primary>expansion</primary>
13793 <secondary>extracting value from environment</secondary>
13794 </indexterm>
13795 <indexterm role="concept">
13796 <primary>environment</primary>
13797 <secondary>values from</secondary>
13798 </indexterm>
13799 The key is first expanded separately, and leading and trailing white space
13800 removed.
13801 This is then searched for as a name in the environment.
13802 If a variable is found then its value is placed in <varname>$value</varname>
13803 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
13804 </para>
13805 <para>
13806 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13807 appear, for example:
13808 </para>
13809 <literallayout class="monospaced">
13810 ${env{USER}{$value} fail }
13811 </literallayout>
13812 <para>
13813 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13814 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13815 </para>
13816 <para>
13817 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
13818 search failure.
13819 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
13820 search success.
13821 </para>
13822 <para>
13823 The environment is adjusted by the <option>keep_environment</option> and
13824 <option>add_environment</option> main section options.
13825 </para>
13826 </listitem></varlistentry>
13827 <varlistentry>
13828 <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>
13829 <listitem>
13830 <para>
13831 <indexterm role="concept">
13832 <primary>expansion</primary>
13833 <secondary>extracting substrings by key</secondary>
13834 </indexterm>
13835 <indexterm role="concept">
13836 <primary><option>extract</option></primary>
13837 <secondary>substrings by key</secondary>
13838 </indexterm>
13839 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
13840 white space is removed from the key (but not from any of the strings). The key
13841 must not be empty and must not consist entirely of digits.
13842 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
13843 </para>
13844 <literallayout>
13845 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
13846 </literallayout>
13847 <para>
13848 <indexterm role="variable">
13849 <primary><varname>$value</varname></primary>
13850 </indexterm>
13851 where the equals signs and spaces (but not both) are optional. If any of the
13852 values contain white space, they must be enclosed in double quotes, and any
13853 values that are enclosed in double quotes are subject to escape processing as
13854 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
13855 for the value that corresponds to the key. The search is case-insensitive. If
13856 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
13857 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
13858 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
13859 is restored to any previous value it might have had.
13860 </para>
13861 <para>
13862 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
13863 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
13864 extracted is used. Thus, for example, these two expansions are identical, and
13865 yield <quote>2001</quote>:
13866 </para>
13867 <literallayout class="monospaced">
13868 ${extract{gid}{uid=1984 gid=2001}}
13869 ${extract{gid}{uid=1984 gid=2001}{$value}}
13870 </literallayout>
13871 <para>
13872 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
13873 appear, for example:
13874 </para>
13875 <literallayout class="monospaced">
13876 ${extract{Z}{A=... B=...}{$value} fail }
13877 </literallayout>
13878 <para>
13879 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
13880 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
13881 </para>
13882 </listitem></varlistentry>
13883 <varlistentry>
13884 <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>
13885 <listitem>
13886 <para>
13887 <indexterm role="concept">
13888 <primary>expansion</primary>
13889 <secondary>extracting substrings by number</secondary>
13890 </indexterm>
13891 <indexterm role="concept">
13892 <primary><option>extract</option></primary>
13893 <secondary>substrings by number</secondary>
13894 </indexterm>
13895 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
13896 apart from leading and trailing white space, which is ignored.
13897 This is what distinguishes this form of <option>extract</option> from the previous kind. It
13898 behaves in the same way, except that, instead of extracting a named field, it
13899 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
13900 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
13901 &lt;<emphasis>string3</emphasis>&gt; as before.
13902 </para>
13903 <para>
13904 The fields in the string are separated by any one of the characters in the
13905 separator string. These may include space or tab characters.
13906 The first field is numbered one. If the number is negative, the fields are
13907 counted from the end of the string, with the rightmost one numbered -1. If the
13908 number given is zero, the entire string is returned. If the modulus of the
13909 number is greater than the number of fields in the string, the result is the
13910 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
13911 provided. For example:
13912 </para>
13913 <literallayout class="monospaced">
13914 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13915 </literallayout>
13916 <para>
13917 yields <quote>42</quote>, and
13918 </para>
13919 <literallayout class="monospaced">
13920 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
13921 </literallayout>
13922 <para>
13923 yields <quote>99</quote>. Two successive separators mean that the field between them is
13924 empty (for example, the fifth field above).
13925 </para>
13926 </listitem></varlistentry>
13927 <varlistentry>
13928 <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>
13929 <listitem>
13930 <para>
13931 <indexterm role="concept">
13932 <primary>list</primary>
13933 <secondary>selecting by condition</secondary>
13934 </indexterm>
13935 <indexterm role="concept">
13936 <primary>expansion</primary>
13937 <secondary>selecting from list by condition</secondary>
13938 </indexterm>
13939 <indexterm role="variable">
13940 <primary><varname>$item</varname></primary>
13941 </indexterm>
13942 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
13943 default, but the separator can be changed in the usual way. For each item
13944 in this list, its value is place in <varname>$item</varname>, and then the condition is
13945 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13946 item in a new list; if the condition is false, the item is discarded. The
13947 separator used for the output list is the same as the one used for the
13948 input, but a separator setting is not included in the output. For example:
13949 </para>
13950 <literallayout class="monospaced">
13951 ${filter{a:b:c}{!eq{$item}{b}}
13952 </literallayout>
13953 <para>
13954 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13955 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13956 </para>
13957 </listitem></varlistentry>
13958 <varlistentry>
13959 <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>
13960 <listitem>
13961 <para>
13962 <indexterm role="concept">
13963 <primary>hash function</primary>
13964 <secondary>textual</secondary>
13965 </indexterm>
13966 <indexterm role="concept">
13967 <primary>expansion</primary>
13968 <secondary>textual hash</secondary>
13969 </indexterm>
13970 This is a textual hashing function, and was the first to be implemented in
13971 early versions of Exim. In current releases, there are other hashing functions
13972 (numeric, MD5, and SHA-1), which are described below.
13973 </para>
13974 <para>
13975 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
13976 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
13977 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
13978 use the simpler operator notation that avoids some of the braces:
13979 </para>
13980 <literallayout class="monospaced">
13981 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13982 </literallayout>
13983 <para>
13984 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
13985 or equal to the length of the string, the expansion item returns the string.
13986 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
13987 function to the string. The new string consists of characters taken from the
13988 first &lt;<emphasis>m</emphasis>&gt; characters of the string
13989 </para>
13990 <literallayout class="monospaced">
13991 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13992 </literallayout>
13993 <para>
13994 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
13995 letters appear. For example:
13996 </para>
13997 <literallayout>
13998 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
13999 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
14000 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
14001 </literallayout>
14002 </listitem></varlistentry>
14003 <varlistentry>
14004 <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>
14005 <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>
14006 <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>
14007 <listitem>
14008 <para>
14009 <indexterm role="concept">
14010 <primary>expansion</primary>
14011 <secondary>header insertion</secondary>
14012 </indexterm>
14013 <indexterm role="variable">
14014 <primary><varname>$header_</varname></primary>
14015 </indexterm>
14016 <indexterm role="variable">
14017 <primary><varname>$bheader_</varname></primary>
14018 </indexterm>
14019 <indexterm role="variable">
14020 <primary><varname>$rheader_</varname></primary>
14021 </indexterm>
14022 <indexterm role="concept">
14023 <primary>header lines</primary>
14024 <secondary>in expansion strings</secondary>
14025 </indexterm>
14026 <indexterm role="concept">
14027 <primary>header lines</primary>
14028 <secondary>character sets</secondary>
14029 </indexterm>
14030 <indexterm role="concept">
14031 <primary>header lines</primary>
14032 <secondary>decoding</secondary>
14033 </indexterm>
14034 Substitute the contents of the named message header line, for example
14035 </para>
14036 <literallayout class="monospaced">
14037 $header_reply-to:
14038 </literallayout>
14039 <para>
14040 The newline that terminates a header line is not included in the expansion, but
14041 internal newlines (caused by splitting the header line over several physical
14042 lines) may be present.
14043 </para>
14044 <para>
14045 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
14046 the data in the header line is interpreted.
14047 </para>
14048 <itemizedlist>
14049 <listitem>
14050 <para>
14051 <indexterm role="concept">
14052 <primary>white space</primary>
14053 <secondary>in header lines</secondary>
14054 </indexterm>
14055 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
14056 processing at all, and without the removal of leading and trailing white space.
14057 </para>
14058 </listitem>
14059 <listitem>
14060 <para>
14061 <indexterm role="concept">
14062 <primary>base64 encoding</primary>
14063 <secondary>in header lines</secondary>
14064 </indexterm>
14065 <option>bheader</option> removes leading and trailing white space, and then decodes base64
14066 or quoted-printable MIME <quote>words</quote> within the header text, but does no
14067 character set translation. If decoding of what looks superficially like a MIME
14068 <quote>word</quote> fails, the raw string is returned. If decoding
14069 <indexterm role="concept">
14070 <primary>binary zero</primary>
14071 <secondary>in header line</secondary>
14072 </indexterm>
14073 produces a binary zero character, it is replaced by a question mark &ndash; this is
14074 what Exim does for binary zeros that are actually received in header lines.
14075 </para>
14076 </listitem>
14077 <listitem>
14078 <para>
14079 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
14080 standard character set. This is an attempt to produce the same string as would
14081 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
14082 returned. Translation is attempted only on operating systems that support the
14083 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
14084 a system Makefile or in <filename>Local/Makefile</filename>.
14085 </para>
14086 </listitem>
14087 </itemizedlist>
14088 <para>
14089 In a filter file, the target character set for <option>header</option> can be specified by a
14090 command of the following form:
14091 </para>
14092 <literallayout class="monospaced">
14093 headers charset "UTF-8"
14094 </literallayout>
14095 <para>
14096 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
14097 subsequently obeyed filter commands. In the absence of this command, the target
14098 character set in a filter is taken from the setting of the <option>headers_charset</option>
14099 option in the runtime configuration. The value of this option defaults to the
14100 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
14101 ISO-8859-1.
14102 </para>
14103 <para>
14104 Header names follow the syntax of RFC 2822, which states that they may contain
14105 any printing characters except space and colon. Consequently, curly brackets
14106 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
14107 if they were variables. Attempting to do so causes a syntax error.
14108 </para>
14109 <para>
14110 Only header lines that are common to all copies of a message are visible to
14111 this mechanism. These are the original header lines that are received with the
14112 message, and any that are added by an ACL statement or by a system
14113 filter. Header lines that are added to a particular copy of a message by a
14114 router or transport are not accessible.
14115 </para>
14116 <para>
14117 For incoming SMTP messages, no header lines are visible in
14118 </para>
14119 <para revisionflag="changed">
14120 ACLs that are obeyed before the data phase completes,
14121 </para>
14122 <para>
14123 because the header structure is not set up until the message is received.
14124 They are visible in DKIM, PRDR and DATA ACLs.
14125 Header lines that are added in a RCPT ACL (for example)
14126 are saved until the message&#x2019;s incoming header lines are available, at which
14127 point they are added.
14128 </para>
14129 <para revisionflag="changed">
14130 When any of the above ACLs ar
14131 </para>
14132 <para>
14133 running, however, header lines added by earlier ACLs are visible.
14134 </para>
14135 <para>
14136 Upper case and lower case letters are synonymous in header names. If the
14137 following character is white space, the terminating colon may be omitted, but
14138 this is not recommended, because you may then forget it when it is needed. When
14139 white space terminates the header name, this white space is included in the
14140 expanded string.  If the message does not contain the given header, the
14141 expansion item is replaced by an empty string. (See the <option>def</option> condition in
14142 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
14143 header.)
14144 </para>
14145 <para>
14146 If there is more than one header with the same name, they are all concatenated
14147 to form the substitution string, up to a maximum length of 64K. Unless
14148 <option>rheader</option> is being used, leading and trailing white space is removed from
14149 each header before concatenation, and a completely empty header is ignored. A
14150 newline character is then inserted between non-empty headers, but there is no
14151 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
14152 those headers that contain lists of addresses, a comma is also inserted at the
14153 junctions between headers. This does not happen for the <option>rheader</option> expansion.
14154 </para>
14155 </listitem></varlistentry>
14156 <varlistentry>
14157 <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>
14158 <listitem>
14159 <para>
14160 <indexterm role="concept">
14161 <primary>expansion</primary>
14162 <secondary>hmac hashing</secondary>
14163 </indexterm>
14164 <indexterm role="concept">
14165 <primary><option>hmac</option></primary>
14166 </indexterm>
14167 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
14168 shared secret and some text into a message authentication code, as specified in
14169 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
14170 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
14171 cryptographic hash, allowing for authentication that is not possible with MD5
14172 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
14173 present. For example:
14174 </para>
14175 <literallayout class="monospaced">
14176 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
14177 </literallayout>
14178 <para>
14179 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
14180 produces:
14181 </para>
14182 <literallayout class="monospaced">
14183 dd97e3ba5d1a61b5006108f8c8252953
14184 </literallayout>
14185 <para>
14186 As an example of how this might be used, you might put in the main part of
14187 an Exim configuration:
14188 </para>
14189 <literallayout class="monospaced">
14190 SPAMSCAN_SECRET=cohgheeLei2thahw
14191 </literallayout>
14192 <para>
14193 In a router or a transport you could then have:
14194 </para>
14195 <literallayout class="monospaced">
14196 headers_add = \
14197   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
14198   ${hmac{md5}{SPAMSCAN_SECRET}\
14199   {${primary_hostname},${message_exim_id},$h_message-id:}}
14200 </literallayout>
14201 <para>
14202 Then given a message, you can check where it was scanned by looking at the
14203 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
14204 this header line is authentic by recomputing the authentication code from the
14205 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
14206 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
14207 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
14208 </para>
14209 </listitem></varlistentry>
14210 <varlistentry>
14211 <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>
14212 <listitem>
14213 <para>
14214 <indexterm role="concept">
14215 <primary>expansion</primary>
14216 <secondary>conditional</secondary>
14217 </indexterm>
14218 <indexterm role="concept">
14219 <primary><option>if</option>, expansion item</primary>
14220 </indexterm>
14221 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
14222 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
14223 in section <xref linkend="SECTexpcond"/> below. For example:
14224 </para>
14225 <literallayout class="monospaced">
14226 ${if eq {$local_part}{postmaster} {yes}{no} }
14227 </literallayout>
14228 <para>
14229 The second string need not be present; if it is not and the condition is not
14230 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
14231 be present instead of the second string (without any curly brackets). In this
14232 case, the expansion is forced to fail if the condition is not true (see section
14233 <xref linkend="SECTforexpfai"/>).
14234 </para>
14235 <para>
14236 If both strings are omitted, the result is the string <literal>true</literal> if the condition
14237 is true, and the empty string if the condition is false. This makes it less
14238 cumbersome to write custom ACL and router conditions. For example, instead of
14239 </para>
14240 <literallayout class="monospaced">
14241 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
14242 </literallayout>
14243 <para>
14244 you can use
14245 </para>
14246 <literallayout class="monospaced">
14247 condition = ${if &gt;{$acl_m4}{3}}
14248 </literallayout>
14249 </listitem></varlistentry>
14250 <varlistentry>
14251 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14252 <listitem>
14253 <para>
14254 <indexterm role="concept">
14255 <primary>expansion</primary>
14256 <secondary>imap folder</secondary>
14257 </indexterm>
14258 <indexterm role="concept">
14259 <primary><option>imapfolder</option> expansion item</primary>
14260 </indexterm>
14261 This item converts a (possibly multilevel, or with non-ASCII characters)
14262 folder specification to a Maildir name for filesystem use.
14263 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
14264 </para>
14265 </listitem></varlistentry>
14266 <varlistentry>
14267 <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>
14268 <listitem>
14269 <para>
14270 <indexterm role="concept">
14271 <primary>expansion</primary>
14272 <secondary>string truncation</secondary>
14273 </indexterm>
14274 <indexterm role="concept">
14275 <primary><option>length</option> expansion item</primary>
14276 </indexterm>
14277 The <option>length</option> item is used to extract the initial portion of a string. Both
14278 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
14279 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
14280 change when expanded, you can use the simpler operator notation that avoids
14281 some of the braces:
14282 </para>
14283 <literallayout class="monospaced">
14284 ${length_&lt;n&gt;:&lt;string&gt;}
14285 </literallayout>
14286 <para>
14287 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
14288 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
14289 <option>strlen</option>, which gives the length of a string.
14290 </para>
14291 </listitem></varlistentry>
14292 <varlistentry>
14293 <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>
14294 <listitem>
14295 <para>
14296 <indexterm role="concept">
14297 <primary>expansion</primary>
14298 <secondary>extracting list elements by number</secondary>
14299 </indexterm>
14300 <indexterm role="concept">
14301 <primary><option>listextract</option></primary>
14302 <secondary>extract list elements by number</secondary>
14303 </indexterm>
14304 <indexterm role="concept">
14305 <primary>list</primary>
14306 <secondary>extracting elements by number</secondary>
14307 </indexterm>
14308 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14309 apart from an optional leading minus,
14310 and leading and trailing white space (which is ignored).
14311 </para>
14312 <para>
14313 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14314 default, but the separator can be changed in the usual way.
14315 </para>
14316 <para>
14317 The first field of the list is numbered one.
14318 If the number is negative, the fields are
14319 counted from the end of the list, with the rightmost one numbered -1.
14320 The numbered element of the list is extracted and placed in <varname>$value</varname>,
14321 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
14322 </para>
14323 <para>
14324 If the modulus of the
14325 number is zero or greater than the number of fields in the string,
14326 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
14327 </para>
14328 <para>
14329 For example:
14330 </para>
14331 <literallayout class="monospaced">
14332 ${listextract{2}{x:42:99}}
14333 </literallayout>
14334 <para>
14335 yields <quote>42</quote>, and
14336 </para>
14337 <literallayout class="monospaced">
14338 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
14339 </literallayout>
14340 <para>
14341 yields <quote>result: 42</quote>.
14342 </para>
14343 <para>
14344 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
14345 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14346 extracted is used.
14347 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
14348 </para>
14349 </listitem></varlistentry>
14350 <varlistentry>
14351 <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>
14352 <listitem>
14353 <para>
14354 This is the first of one of two different types of lookup item, which are both
14355 described in the next item.
14356 </para>
14357 </listitem></varlistentry>
14358 <varlistentry>
14359 <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>
14360 <listitem>
14361 <para>
14362 <indexterm role="concept">
14363 <primary>expansion</primary>
14364 <secondary>lookup in</secondary>
14365 </indexterm>
14366 <indexterm role="concept">
14367 <primary>file</primary>
14368 <secondary>lookups</secondary>
14369 </indexterm>
14370 <indexterm role="concept">
14371 <primary>lookup</primary>
14372 <secondary>in expanded string</secondary>
14373 </indexterm>
14374 The two forms of lookup item specify data lookups in files and databases, as
14375 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
14376 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
14377 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
14378 </para>
14379 <para>
14380 If there is any white space in a lookup item which is part of a filter command,
14381 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
14382 other place where white space is significant, the lookup item must be enclosed
14383 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
14384 out by the system administrator.
14385 </para>
14386 <para>
14387 <indexterm role="variable">
14388 <primary><varname>$value</varname></primary>
14389 </indexterm>
14390 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
14391 During its expansion, the variable <varname>$value</varname> contains the data returned by the
14392 lookup. Afterwards it reverts to the value it had previously (at the outer
14393 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
14394 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
14395 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
14396 lookup, thus providing a mechanism for looking up a default value when the
14397 original lookup fails.
14398 </para>
14399 <para>
14400 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
14401 data for the outer lookup while the parameters of the second lookup are
14402 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
14403 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
14404 appear, and in this case, if the lookup fails, the entire expansion is forced
14405 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
14406 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
14407 successful lookup, and nothing in the case of failure.
14408 </para>
14409 <para>
14410 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
14411 search type in order to do partial matching, and * or *@ may follow a search
14412 type to request default lookups if the key does not match (see sections
14413 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
14414 </para>
14415 <para>
14416 <indexterm role="concept">
14417 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14418 <secondary>in lookup expansion</secondary>
14419 </indexterm>
14420 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
14421 and non-wild parts of the key during the expansion of the replacement text.
14422 They return to their previous values at the end of the lookup item.
14423 </para>
14424 <para>
14425 This example looks up the postmaster alias in the conventional alias file:
14426 </para>
14427 <literallayout class="monospaced">
14428 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
14429 </literallayout>
14430 <para>
14431 This example uses NIS+ to look up the full name of the user corresponding to
14432 the local part of an address, forcing the expansion to fail if it is not found:
14433 </para>
14434 <literallayout class="monospaced">
14435 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
14436   {$value}fail}
14437 </literallayout>
14438 </listitem></varlistentry>
14439 <varlistentry>
14440 <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>
14441 <listitem>
14442 <para>
14443 <indexterm role="concept">
14444 <primary>expansion</primary>
14445 <secondary>list creation</secondary>
14446 </indexterm>
14447 <indexterm role="variable">
14448 <primary><varname>$item</varname></primary>
14449 </indexterm>
14450 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
14451 default, but the separator can be changed in the usual way. For each item
14452 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
14453 expanded and added to the output as an item in a new list. The separator used
14454 for the output list is the same as the one used for the input, but a separator
14455 setting is not included in the output. For example:
14456 </para>
14457 <literallayout class="monospaced">
14458 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
14459 </literallayout>
14460 <para>
14461 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
14462 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
14463 and <emphasis role="bold">reduce</emphasis> expansion items.
14464 </para>
14465 </listitem></varlistentry>
14466 <varlistentry>
14467 <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>
14468 <listitem>
14469 <para>
14470 <indexterm role="concept">
14471 <primary>expansion</primary>
14472 <secondary>numeric hash</secondary>
14473 </indexterm>
14474 <indexterm role="concept">
14475 <primary>hash function</primary>
14476 <secondary>numeric</secondary>
14477 </indexterm>
14478 The three strings are expanded; the first two must yield numbers. Call them
14479 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14480 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14481 can use the simpler operator notation that avoids some of the braces:
14482 </para>
14483 <literallayout class="monospaced">
14484 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14485 </literallayout>
14486 <para>
14487 The second number is optional (in both notations). If there is only one number,
14488 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
14489 processed by a div/mod hash function that returns two numbers, separated by a
14490 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
14491 example,
14492 </para>
14493 <literallayout class="monospaced">
14494 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
14495 </literallayout>
14496 <para>
14497 returns the string <quote>6/33</quote>.
14498 </para>
14499 </listitem></varlistentry>
14500 <varlistentry>
14501 <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>
14502 <listitem>
14503 <para>
14504 <indexterm role="concept">
14505 <primary>Perl</primary>
14506 <secondary>use in expanded string</secondary>
14507 </indexterm>
14508 <indexterm role="concept">
14509 <primary>expansion</primary>
14510 <secondary>calling Perl from</secondary>
14511 </indexterm>
14512 This item is available only if Exim has been built to include an embedded Perl
14513 interpreter. The subroutine name and the arguments are first separately
14514 expanded, and then the Perl subroutine is called with those arguments. No
14515 additional arguments need be given; the maximum number permitted, including the
14516 name of the subroutine, is nine.
14517 </para>
14518 <para>
14519 The return value of the subroutine is inserted into the expanded string, unless
14520 the return value is <option>undef</option>. In that case, the expansion fails in the same
14521 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
14522 Whatever you return is evaluated in a scalar context. For example, if you
14523 return the name of a Perl vector, the return value is the size of the vector,
14524 not its contents.
14525 </para>
14526 <para>
14527 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
14528 with the error message that was passed to <option>die</option>. More details of the embedded
14529 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
14530 </para>
14531 <para>
14532 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
14533 out the use of this expansion item in filter files.
14534 </para>
14535 </listitem></varlistentry>
14536 <varlistentry>
14537 <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>
14538 <listitem>
14539 <para>
14540 <indexterm role="concept">
14541 <primary><option>prvs</option> expansion item</primary>
14542 </indexterm>
14543 The first argument is a complete email address and the second is secret
14544 keystring. The third argument, specifying a key number, is optional. If absent,
14545 it defaults to 0. The result of the expansion is a prvs-signed email address,
14546 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
14547 as part of a bounce address tag validation (BATV) scheme. For more discussion
14548 and an example, see section <xref linkend="SECTverifyPRVS"/>.
14549 </para>
14550 </listitem></varlistentry>
14551 <varlistentry>
14552 <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>
14553 <listitem>
14554 <para>
14555 <indexterm role="concept">
14556 <primary><option>prvscheck</option> expansion item</primary>
14557 </indexterm>
14558 This expansion item is the complement of the <option>prvs</option> item. It is used for
14559 checking prvs-signed addresses. If the expansion of the first argument does not
14560 yield a syntactically valid prvs-signed address, the whole item expands to the
14561 empty string. When the first argument does expand to a syntactically valid
14562 prvs-signed address, the second argument is expanded, with the prvs-decoded
14563 version of the address and the key number extracted from the address in the
14564 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
14565 </para>
14566 <para>
14567 These two variables can be used in the expansion of the second argument to
14568 retrieve the secret. The validity of the prvs-signed address is then checked
14569 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
14570 which is empty for failure or <quote>1</quote> for success.
14571 </para>
14572 <para>
14573 The third argument is optional; if it is missing, it defaults to an empty
14574 string. This argument is now expanded. If the result is an empty string, the
14575 result of the expansion is the decoded version of the address. This is the case
14576 whether or not the signature was valid. Otherwise, the result of the expansion
14577 is the expansion of the third argument.
14578 </para>
14579 <para>
14580 All three variables can be used in the expansion of the third argument.
14581 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
14582 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
14583 </para>
14584 </listitem></varlistentry>
14585 <varlistentry>
14586 <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>
14587 <listitem>
14588 <para>
14589 <indexterm role="concept">
14590 <primary>expansion</primary>
14591 <secondary>inserting an entire file</secondary>
14592 </indexterm>
14593 <indexterm role="concept">
14594 <primary>file</primary>
14595 <secondary>inserting into expansion</secondary>
14596 </indexterm>
14597 <indexterm role="concept">
14598 <primary><option>readfile</option> expansion item</primary>
14599 </indexterm>
14600 The file name and end-of-line string are first expanded separately. The file is
14601 then read, and its contents replace the entire item. All newline characters in
14602 the file are replaced by the end-of-line string if it is present. Otherwise,
14603 newlines are left in the string.
14604 String expansion is not applied to the contents of the file. If you want this,
14605 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
14606 the string expansion fails.
14607 </para>
14608 <para>
14609 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
14610 locks out the use of this expansion item in filter files.
14611 </para>
14612 </listitem></varlistentry>
14613 <varlistentry>
14614 <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>
14615 <listitem>
14616 <para>
14617 <indexterm role="concept">
14618 <primary>expansion</primary>
14619 <secondary>inserting from a socket</secondary>
14620 </indexterm>
14621 <indexterm role="concept">
14622 <primary>socket, use of in expansion</primary>
14623 </indexterm>
14624 <indexterm role="concept">
14625 <primary><option>readsocket</option> expansion item</primary>
14626 </indexterm>
14627 This item inserts data from a Unix domain or TCP socket into the expanded
14628 string. The minimal way of using it uses just two arguments, as in these
14629 examples:
14630 </para>
14631 <literallayout class="monospaced">
14632 ${readsocket{/socket/name}{request string}}
14633 ${readsocket{inet:some.host:1234}{request string}}
14634 </literallayout>
14635 <para>
14636 For a Unix domain socket, the first substring must be the path to the socket.
14637 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
14638 a host name or IP address, followed by a colon and a port, which can be a
14639 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
14640 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
14641 example:
14642 </para>
14643 <literallayout class="monospaced">
14644 ${readsocket{inet:[::1]:1234}{request string}}
14645 </literallayout>
14646 <para>
14647 Only a single host name may be given, but if looking it up yields more than
14648 one IP address, they are each tried in turn until a connection is made. For
14649 both kinds of socket, Exim makes a connection, writes the request string
14650 unless it is an empty string; and no terminating NUL is ever sent)
14651 and reads from the socket until an end-of-file
14652 is read. A timeout of 5 seconds is applied. Additional, optional arguments
14653 extend what can be done. Firstly, you can vary the timeout. For example:
14654 </para>
14655 <literallayout class="monospaced">
14656 ${readsocket{/socket/name}{request string}{3s}}
14657 </literallayout>
14658 <para>
14659 A fourth argument allows you to change any newlines that are in the data
14660 that is read, in the same way as for <option>readfile</option> (see above). This example
14661 turns them into spaces:
14662 </para>
14663 <literallayout class="monospaced">
14664 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
14665 </literallayout>
14666 <para>
14667 As with all expansions, the substrings are expanded before the processing
14668 happens. Errors in these sub-expansions cause the expansion to fail. In
14669 addition, the following errors can occur:
14670 </para>
14671 <itemizedlist>
14672 <listitem>
14673 <para>
14674 Failure to create a socket file descriptor;
14675 </para>
14676 </listitem>
14677 <listitem>
14678 <para>
14679 Failure to connect the socket;
14680 </para>
14681 </listitem>
14682 <listitem>
14683 <para>
14684 Failure to write the request string;
14685 </para>
14686 </listitem>
14687 <listitem>
14688 <para>
14689 Timeout on reading from the socket.
14690 </para>
14691 </listitem>
14692 </itemizedlist>
14693 <para>
14694 By default, any of these errors causes the expansion to fail. However, if
14695 you supply a fifth substring, it is expanded and used when any of the above
14696 errors occurs. For example:
14697 </para>
14698 <literallayout class="monospaced">
14699 ${readsocket{/socket/name}{request string}{3s}{\n}\
14700   {socket failure}}
14701 </literallayout>
14702 <para>
14703 You can test for the existence of a Unix domain socket by wrapping this
14704 expansion in <literal>${if exists</literal>, but there is a race condition between that test
14705 and the actual opening of the socket, so it is safer to use the fifth argument
14706 if you want to be absolutely sure of avoiding an expansion error for a
14707 non-existent Unix domain socket, or a failure to connect to an Internet socket.
14708 </para>
14709 <para>
14710 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
14711 locks out the use of this expansion item in filter files.
14712 </para>
14713 </listitem></varlistentry>
14714 <varlistentry>
14715 <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>
14716 <listitem>
14717 <para>
14718 <indexterm role="concept">
14719 <primary>expansion</primary>
14720 <secondary>reducing a list to a scalar</secondary>
14721 </indexterm>
14722 <indexterm role="concept">
14723 <primary>list</primary>
14724 <secondary>reducing to a scalar</secondary>
14725 </indexterm>
14726 <indexterm role="variable">
14727 <primary><varname>$value</varname></primary>
14728 </indexterm>
14729 <indexterm role="variable">
14730 <primary><varname>$item</varname></primary>
14731 </indexterm>
14732 This operation reduces a list to a single, scalar string. After expansion,
14733 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
14734 separator can be changed in the usual way. Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
14735 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
14736 list is assigned to <varname>$item</varname> in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
14737 them. The result of that expansion is assigned to <varname>$value</varname> before the next
14738 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
14739 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
14740 number of ways. For example, to add up a list of numbers:
14741 </para>
14742 <literallayout class="monospaced">
14743 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
14744 </literallayout>
14745 <para>
14746 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
14747 can be found:
14748 </para>
14749 <literallayout class="monospaced">
14750 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
14751 </literallayout>
14752 <para>
14753 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
14754 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
14755 expansion items.
14756 </para>
14757 </listitem></varlistentry>
14758 <varlistentry>
14759 <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>
14760 <listitem>
14761 <para>
14762 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
14763 expansion item above.
14764 </para>
14765 </listitem></varlistentry>
14766 <varlistentry>
14767 <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>
14768 <listitem>
14769 <para>
14770 <indexterm role="concept">
14771 <primary>expansion</primary>
14772 <secondary>running a command</secondary>
14773 </indexterm>
14774 <indexterm role="concept">
14775 <primary><option>run</option> expansion item</primary>
14776 </indexterm>
14777 The command and its arguments are first expanded as one string. The string is
14778 split apart into individual arguments by spaces, and then the command is run
14779 in a separate process, but under the same uid and gid.  As in other command
14780 executions from Exim, a shell is not used by default. If the command requires
14781 a shell, you must explicitly code it.
14782 </para>
14783 <para>
14784 Since the arguments are split by spaces, when there is a variable expansion
14785 which has an empty result, it will cause the situation that the argument will
14786 simply be omitted when the program is actually executed by Exim. If the
14787 script/program requires a specific number of arguments and the expanded
14788 variable could possibly result in this empty expansion, the variable must be
14789 quoted. This is more difficult if the expanded variable itself could result
14790 in a string containing quotes, because it would interfere with the quotes
14791 around the command arguments. A possible guard against this is to wrap the
14792 variable in the <option>sg</option> operator to change any quote marks to some other
14793 character.
14794 </para>
14795 <para>
14796 The standard input for the command exists, but is empty. The standard output
14797 and standard error are set to the same file descriptor.
14798 <indexterm role="concept">
14799 <primary>return code</primary>
14800 <secondary>from <option>run</option> expansion</secondary>
14801 </indexterm>
14802 <indexterm role="variable">
14803 <primary><varname>$value</varname></primary>
14804 </indexterm>
14805 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
14806 and replaces the entire item; during this expansion, the standard output/error
14807 from the command is in the variable <varname>$value</varname>. If the command fails,
14808 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
14809 expansion, the standard output/error from the command is in the variable
14810 <varname>$value</varname>.
14811 </para>
14812 <para>
14813 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
14814 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
14815 command does not succeed. If both strings are omitted, the result is contents
14816 of the standard output/error on success, and nothing on failure.
14817 </para>
14818 <para>
14819 <indexterm role="variable">
14820 <primary><varname>$run_in_acl</varname></primary>
14821 </indexterm>
14822 The standard output/error of the command is put in the variable <varname>$value</varname>.
14823 In this ACL example, the output of a command is logged for the admin to
14824 troubleshoot:
14825 </para>
14826 <literallayout class="monospaced">
14827 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
14828       log_message  = Output of id: $value
14829 </literallayout>
14830 <para>
14831 If the command requires shell idioms, such as the &gt; redirect operator, the
14832 shell must be invoked directly, such as with:
14833 </para>
14834 <literallayout class="monospaced">
14835 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
14836 </literallayout>
14837 <para>
14838 <indexterm role="variable">
14839 <primary><varname>$runrc</varname></primary>
14840 </indexterm>
14841 The return code from the command is put in the variable <varname>$runrc</varname>, and this
14842 remains set afterwards, so in a filter file you can do things like this:
14843 </para>
14844 <literallayout class="monospaced">
14845 if "${run{x y z}{}}$runrc" is 1 then ...
14846   elif $runrc is 2 then ...
14847   ...
14848 endif
14849 </literallayout>
14850 <para>
14851 If execution of the command fails (for example, the command does not exist),
14852 the return code is 127 &ndash; the same code that shells use for non-existent
14853 commands.
14854 </para>
14855 <para>
14856 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
14857 option values are expanded, except for those preconditions whose order of
14858 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
14859 by the expansion of one option, and use it in another.
14860 </para>
14861 <para>
14862 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
14863 out the use of this expansion item in filter files.
14864 </para>
14865 </listitem></varlistentry>
14866 <varlistentry>
14867 <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>
14868 <listitem>
14869 <para>
14870 <indexterm role="concept">
14871 <primary>expansion</primary>
14872 <secondary>string substitution</secondary>
14873 </indexterm>
14874 <indexterm role="concept">
14875 <primary><option>sg</option> expansion item</primary>
14876 </indexterm>
14877 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
14878 option; hence its name. However, unlike the Perl equivalent, Exim does not
14879 modify the subject string; instead it returns the modified string for insertion
14880 into the overall expansion. The item takes three arguments: the subject string,
14881 a regular expression, and a substitution string. For example:
14882 </para>
14883 <literallayout class="monospaced">
14884 ${sg{abcdefabcdef}{abc}{xyz}}
14885 </literallayout>
14886 <para>
14887 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
14888 if any $ or \ characters are required in the regular expression or in the
14889 substitution string, they have to be escaped. For example:
14890 </para>
14891 <literallayout class="monospaced">
14892 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
14893 </literallayout>
14894 <para>
14895 yields <quote>defabc</quote>, and
14896 </para>
14897 <literallayout class="monospaced">
14898 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
14899 </literallayout>
14900 <para>
14901 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
14902 the regular expression from string expansion.
14903 </para>
14904 </listitem></varlistentry>
14905 <varlistentry>
14906 <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>
14907 <listitem>
14908 <para>
14909 <indexterm role="concept">
14910 <primary>sorting</primary>
14911 <secondary>a list</secondary>
14912 </indexterm>
14913 <indexterm role="concept">
14914 <primary>list</primary>
14915 <secondary>sorting</secondary>
14916 </indexterm>
14917 <indexterm role="concept">
14918 <primary>expansion</primary>
14919 <secondary>list sorting</secondary>
14920 </indexterm>
14921 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14922 default, but the separator can be changed in the usual way.
14923 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
14924 of a two-argument expansion condition.
14925 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
14926 The comparison should return true when applied to two values
14927 if the first value should sort before the second value.
14928 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
14929 the element being placed in <varname>$item</varname>,
14930 to give values for comparison.
14931 </para>
14932 <para>
14933 The item result is a sorted list,
14934 with the original list separator,
14935 of the list elements (in full) of the original.
14936 </para>
14937 <para>
14938 Examples:
14939 </para>
14940 <literallayout class="monospaced">
14941 ${sort{3:2:1:4}{&lt;}{$item}}
14942 </literallayout>
14943 <para>
14944 sorts a list of numbers, and
14945 </para>
14946 <literallayout class="monospaced">
14947 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
14948 </literallayout>
14949 <para>
14950 will sort an MX lookup into priority order.
14951 </para>
14952 </listitem></varlistentry>
14953 <varlistentry>
14954 <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>
14955 <listitem>
14956 <para>
14957 <indexterm role="concept">
14958 <primary><option>substr</option> expansion item</primary>
14959 </indexterm>
14960 <indexterm role="concept">
14961 <primary>substring extraction</primary>
14962 </indexterm>
14963 <indexterm role="concept">
14964 <primary>expansion</primary>
14965 <secondary>substring extraction</secondary>
14966 </indexterm>
14967 The three strings are expanded; the first two must yield numbers. Call them
14968 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
14969 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
14970 can use the simpler operator notation that avoids some of the braces:
14971 </para>
14972 <literallayout class="monospaced">
14973 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14974 </literallayout>
14975 <para>
14976 The second number is optional (in both notations).
14977 If it is absent in the simpler format, the preceding underscore must also be
14978 omitted.
14979 </para>
14980 <para>
14981 The <option>substr</option> item can be used to extract more general substrings than
14982 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
14983 length required. For example
14984 </para>
14985 <literallayout class="monospaced">
14986 ${substr{3}{2}{$local_part}}
14987 </literallayout>
14988 <para>
14989 If the starting offset is greater than the string length the result is the
14990 null string; if the length plus starting offset is greater than the string
14991 length, the result is the right-hand part of the string, starting from the
14992 given offset. The first character in the string has offset zero.
14993 </para>
14994 <para>
14995 The <option>substr</option> expansion item can take negative offset values to count
14996 from the right-hand end of its operand. The last character is offset -1, the
14997 second-last is offset -2, and so on. Thus, for example,
14998 </para>
14999 <literallayout class="monospaced">
15000 ${substr{-5}{2}{1234567}}
15001 </literallayout>
15002 <para>
15003 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
15004 length of the string, the substring starts at the beginning of the string, and
15005 the length is reduced by the amount of overshoot. Thus, for example,
15006 </para>
15007 <literallayout class="monospaced">
15008 ${substr{-5}{2}{12}}
15009 </literallayout>
15010 <para>
15011 yields an empty string, but
15012 </para>
15013 <literallayout class="monospaced">
15014 ${substr{-3}{2}{12}}
15015 </literallayout>
15016 <para>
15017 yields <quote>1</quote>.
15018 </para>
15019 <para>
15020 When the second number is omitted from <option>substr</option>, the remainder of the string
15021 is taken if the offset is positive. If it is negative, all characters in the
15022 string preceding the offset point are taken. For example, an offset of -1 and
15023 no length, as in these semantically identical examples:
15024 </para>
15025 <literallayout class="monospaced">
15026 ${substr_-1:abcde}
15027 ${substr{-1}{abcde}}
15028 </literallayout>
15029 <para>
15030 yields all but the last character of the string, that is, <quote>abcd</quote>.
15031 </para>
15032 </listitem></varlistentry>
15033 <varlistentry>
15034 <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>
15035 <listitem>
15036 <para>
15037 <indexterm role="concept">
15038 <primary>expansion</primary>
15039 <secondary>character translation</secondary>
15040 </indexterm>
15041 <indexterm role="concept">
15042 <primary><option>tr</option> expansion item</primary>
15043 </indexterm>
15044 This item does single-character translation on its subject string. The second
15045 argument is a list of characters to be translated in the subject string. Each
15046 matching character is replaced by the corresponding character from the
15047 replacement list. For example
15048 </para>
15049 <literallayout class="monospaced">
15050 ${tr{abcdea}{ac}{13}}
15051 </literallayout>
15052 <para>
15053 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
15054 last occurrence is used. If the third string is shorter than the second, its
15055 last character is replicated. However, if it is empty, no translation takes
15056 place.
15057 </para>
15058 </listitem></varlistentry>
15059 </variablelist>
15060 </section>
15061 <section id="SECTexpop">
15062 <title>Expansion operators</title>
15063 <para>
15064 <indexterm role="concept">
15065 <primary>expansion</primary>
15066 <secondary>operators</secondary>
15067 </indexterm>
15068 For expansion items that perform transformations on a single argument string,
15069 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
15070 The substring is first expanded before the operation is applied to it. The
15071 following operations can be performed:
15072 </para>
15073 <variablelist>
15074 <varlistentry>
15075 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15076 <listitem>
15077 <para>
15078 <indexterm role="concept">
15079 <primary>expansion</primary>
15080 <secondary>RFC 2822 address handling</secondary>
15081 </indexterm>
15082 <indexterm role="concept">
15083 <primary><option>address</option> expansion item</primary>
15084 </indexterm>
15085 The string is interpreted as an RFC 2822 address, as it might appear in a
15086 header line, and the effective address is extracted from it. If the string does
15087 not parse successfully, the result is empty.
15088 </para>
15089 </listitem></varlistentry>
15090 <varlistentry>
15091 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15092 <listitem>
15093 <para>
15094 <indexterm role="concept">
15095 <primary>expansion</primary>
15096 <secondary>RFC 2822 address handling</secondary>
15097 </indexterm>
15098 <indexterm role="concept">
15099 <primary><option>addresses</option> expansion item</primary>
15100 </indexterm>
15101 The string (after expansion) is interpreted as a list of addresses in RFC
15102 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
15103 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
15104 result of the expansion is a colon-separated list, with appropriate
15105 doubling of colons should any happen to be present in the email addresses.
15106 Syntactically invalid RFC2822 address items are omitted from the output.
15107 </para>
15108 <para>
15109 It is possible to specify a character other than colon for the output
15110 separator by starting the string with &gt; followed by the new separator
15111 character. For example:
15112 </para>
15113 <literallayout class="monospaced">
15114 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
15115 </literallayout>
15116 <para>
15117 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
15118 expansion item, which extracts the working address from a single RFC2822
15119 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
15120 processing lists.
15121 </para>
15122 <para>
15123 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
15124 a strict interpretation of header line formatting.  Exim parses the bare,
15125 unquoted portion of an email address and if it finds a comma, treats it as an
15126 email address separator. For the example header line:
15127 </para>
15128 <literallayout class="monospaced">
15129 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
15130 </literallayout>
15131 <para>
15132 The first example below demonstrates that Q-encoded email addresses are parsed
15133 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
15134 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
15135 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
15136 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
15137 The third example shows that the presence of a comma is skipped when it is
15138 quoted.
15139 </para>
15140 <literallayout class="monospaced">
15141 # exim -be '${addresses:From: \
15142 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
15143 user@example.com
15144 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
15145 Last:user@example.com
15146 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
15147 user@example.com
15148 </literallayout>
15149 </listitem></varlistentry>
15150 <varlistentry>
15151 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15152 <listitem>
15153 <para>
15154 <indexterm role="concept">
15155 <primary><option>base32</option> expansion item</primary>
15156 </indexterm>
15157 <indexterm role="concept">
15158 <primary>expansion</primary>
15159 <secondary>conversion to base 32</secondary>
15160 </indexterm>
15161 The string must consist entirely of decimal digits. The number is converted to
15162 base 32 and output as a (empty, for zero) string of characters.
15163 Only lowercase letters are used.
15164 </para>
15165 </listitem></varlistentry>
15166 <varlistentry>
15167 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15168 <listitem>
15169 <para>
15170 <indexterm role="concept">
15171 <primary><option>base32d</option> expansion item</primary>
15172 </indexterm>
15173 <indexterm role="concept">
15174 <primary>expansion</primary>
15175 <secondary>conversion to base 32</secondary>
15176 </indexterm>
15177 The string must consist entirely of base-32 digits.
15178 The number is converted to decimal and output as a string.
15179 </para>
15180 </listitem></varlistentry>
15181 <varlistentry>
15182 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15183 <listitem>
15184 <para>
15185 <indexterm role="concept">
15186 <primary><option>base62</option> expansion item</primary>
15187 </indexterm>
15188 <indexterm role="concept">
15189 <primary>expansion</primary>
15190 <secondary>conversion to base 62</secondary>
15191 </indexterm>
15192 The string must consist entirely of decimal digits. The number is converted to
15193 base 62 and output as a string of six characters, including leading zeros. In
15194 the few operating environments where Exim uses base 36 instead of base 62 for
15195 its message identifiers (because those systems do not have case-sensitive file
15196 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
15197 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
15198 </para>
15199 </listitem></varlistentry>
15200 <varlistentry>
15201 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15202 <listitem>
15203 <para>
15204 <indexterm role="concept">
15205 <primary><option>base62d</option> expansion item</primary>
15206 </indexterm>
15207 <indexterm role="concept">
15208 <primary>expansion</primary>
15209 <secondary>conversion to base 62</secondary>
15210 </indexterm>
15211 The string must consist entirely of base-62 digits, or, in operating
15212 environments where Exim uses base 36 instead of base 62 for its message
15213 identifiers, base-36 digits. The number is converted to decimal and output as a
15214 string.
15215 </para>
15216 </listitem></varlistentry>
15217 <varlistentry>
15218 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15219 <listitem>
15220 <para>
15221 <indexterm role="concept">
15222 <primary>expansion</primary>
15223 <secondary>base64 encoding</secondary>
15224 </indexterm>
15225 <indexterm role="concept">
15226 <primary>base64 encoding</primary>
15227 <secondary>in string expansion</secondary>
15228 </indexterm>
15229 <indexterm role="concept">
15230 <primary><option>base64</option> expansion item</primary>
15231 </indexterm>
15232 <indexterm role="concept">
15233 <primary>certificate</primary>
15234 <secondary>base64 of DER</secondary>
15235 </indexterm>
15236 This operator converts a string into one that is base64 encoded.
15237 </para>
15238 <para>
15239 If the string is a single variable of type certificate,
15240 returns the base64 encoding of the DER form of the certificate.
15241 </para>
15242 </listitem></varlistentry>
15243 <varlistentry>
15244 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15245 <listitem>
15246 <para>
15247 <indexterm role="concept">
15248 <primary>expansion</primary>
15249 <secondary>base64 decoding</secondary>
15250 </indexterm>
15251 <indexterm role="concept">
15252 <primary>base64 decoding</primary>
15253 <secondary>in string expansion</secondary>
15254 </indexterm>
15255 <indexterm role="concept">
15256 <primary><option>base64d</option> expansion item</primary>
15257 </indexterm>
15258 This operator converts a base64-encoded string into the un-coded form.
15259 </para>
15260 </listitem></varlistentry>
15261 <varlistentry>
15262 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15263 <listitem>
15264 <para>
15265 <indexterm role="concept">
15266 <primary>domain</primary>
15267 <secondary>extraction</secondary>
15268 </indexterm>
15269 <indexterm role="concept">
15270 <primary>expansion</primary>
15271 <secondary>domain extraction</secondary>
15272 </indexterm>
15273 The string is interpreted as an RFC 2822 address and the domain is extracted
15274 from it. If the string does not parse successfully, the result is empty.
15275 </para>
15276 </listitem></varlistentry>
15277 <varlistentry>
15278 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15279 <listitem>
15280 <para>
15281 <indexterm role="concept">
15282 <primary>expansion</primary>
15283 <secondary>escaping non-printing characters</secondary>
15284 </indexterm>
15285 <indexterm role="concept">
15286 <primary><option>escape</option> expansion item</primary>
15287 </indexterm>
15288 If the string contains any non-printing characters, they are converted to
15289 escape sequences starting with a backslash. Whether characters with the most
15290 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
15291 is controlled by the <option>print_topbitchars</option> option.
15292 </para>
15293 </listitem></varlistentry>
15294 <varlistentry>
15295 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15296 <listitem>
15297 <para>
15298 <indexterm role="concept">
15299 <primary>expansion</primary>
15300 <secondary>escaping 8-bit characters</secondary>
15301 </indexterm>
15302 <indexterm role="concept">
15303 <primary><option>escape8bit</option> expansion item</primary>
15304 </indexterm>
15305 If the string contains and characters with the most significant bit set,
15306 they are converted to escape sequences starting with a backslash.
15307 Backslashes and DEL characters are also converted.
15308 </para>
15309 </listitem></varlistentry>
15310 <varlistentry>
15311 <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>
15312 <listitem>
15313 <para>
15314 <indexterm role="concept">
15315 <primary>expansion</primary>
15316 <secondary>expression evaluation</secondary>
15317 </indexterm>
15318 <indexterm role="concept">
15319 <primary>expansion</primary>
15320 <secondary>arithmetic expression</secondary>
15321 </indexterm>
15322 <indexterm role="concept">
15323 <primary><option>eval</option> expansion item</primary>
15324 </indexterm>
15325 These items supports simple arithmetic and bitwise logical operations in
15326 expansion strings. The string (after expansion) must be a conventional
15327 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
15328 logical operators, and parentheses. All operations are carried out using
15329 integer arithmetic. The operator priorities are as follows (the same as in the
15330 C programming language):
15331 </para>
15332 <informaltable frame="none">
15333 <tgroup cols="2" colsep="0" rowsep="0">
15334 <colspec colwidth="70pt" align="left"/>
15335 <colspec colwidth="300pt" align="left"/>
15336 <tbody>
15337 <row>
15338 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
15339 <entry>not (~), negate (-)</entry>
15340 </row>
15341 <row>
15342 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15343 <entry>multiply (*), divide (/), remainder (%)</entry>
15344 </row>
15345 <row>
15346 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15347 <entry>plus (+), minus (-)</entry>
15348 </row>
15349 <row>
15350 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15351 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
15352 </row>
15353 <row>
15354 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15355 <entry>and (&amp;)</entry>
15356 </row>
15357 <row>
15358 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
15359 <entry>xor (^)</entry>
15360 </row>
15361 <row>
15362 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
15363 <entry>or (|)</entry>
15364 </row>
15365 </tbody>
15366 </tgroup>
15367 </informaltable>
15368 <para>
15369 Binary operators with the same priority are evaluated from left to right. White
15370 space is permitted before or after operators.
15371 </para>
15372 <para>
15373 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
15374 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
15375 decimal, even if they start with a leading zero; hexadecimal numbers are not
15376 permitted. This can be useful when processing numbers extracted from dates or
15377 times, which often do have leading zeros.
15378 </para>
15379 <para>
15380 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
15381 or 1024*1024*1024,
15382 respectively. Negative numbers are supported. The result of the computation is
15383 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
15384 </para>
15385 <literallayout>
15386 <literal>${eval:1+1}            </literal>  yields 2
15387 <literal>${eval:1+2*3}          </literal>  yields 7
15388 <literal>${eval:(1+2)*3}        </literal>  yields 9
15389 <literal>${eval:2+42%5}         </literal>  yields 4
15390 <literal>${eval:0xc&amp;5}          </literal>  yields 4
15391 <literal>${eval:0xc|5}          </literal>  yields 13
15392 <literal>${eval:0xc^5}          </literal>  yields 9
15393 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
15394 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
15395 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
15396 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
15397 </literallayout>
15398 <para>
15399 As a more realistic example, in an ACL you might have
15400 </para>
15401 <literallayout class="monospaced">
15402 deny   message = Too many bad recipients
15403        condition =                    \
15404          ${if and {                   \
15405            {&gt;{$rcpt_count}{10}}       \
15406            {                          \
15407            &lt;                          \
15408              {$recipients_count}      \
15409              {${eval:$rcpt_count/2}}  \
15410            }                          \
15411          }{yes}{no}}
15412 </literallayout>
15413 <para>
15414 The condition is true if there have been more than 10 RCPT commands and
15415 fewer than half of them have resulted in a valid recipient.
15416 </para>
15417 </listitem></varlistentry>
15418 <varlistentry>
15419 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15420 <listitem>
15421 <para>
15422 <indexterm role="concept">
15423 <primary>expansion</primary>
15424 <secondary>re-expansion of substring</secondary>
15425 </indexterm>
15426 The <option>expand</option> operator causes a string to be expanded for a second time. For
15427 example,
15428 </para>
15429 <literallayout class="monospaced">
15430 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
15431 </literallayout>
15432 <para>
15433 first looks up a string in a file while expanding the operand for <option>expand</option>,
15434 and then re-expands what it has found.
15435 </para>
15436 </listitem></varlistentry>
15437 <varlistentry>
15438 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15439 <listitem>
15440 <para>
15441 <indexterm role="concept">
15442 <primary>Unicode</primary>
15443 </indexterm>
15444 <indexterm role="concept">
15445 <primary>UTF-8</primary>
15446 <secondary>conversion from</secondary>
15447 </indexterm>
15448 <indexterm role="concept">
15449 <primary>expansion</primary>
15450 <secondary>UTF-8 conversion</secondary>
15451 </indexterm>
15452 <indexterm role="concept">
15453 <primary><option>from_utf8</option> expansion item</primary>
15454 </indexterm>
15455 The world is slowly moving towards Unicode, although there are no standards for
15456 email yet. However, other applications (including some databases) are starting
15457 to store data in Unicode, using UTF-8 encoding. This operator converts from a
15458 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
15459 converted to underscores. The input must be a valid UTF-8 string. If it is not,
15460 the result is an undefined sequence of bytes.
15461 </para>
15462 <para>
15463 Unicode code points with values less than 256 are compatible with ASCII and
15464 ISO-8859-1 (also known as Latin-1).
15465 For example, character 169 is the copyright symbol in both cases, though the
15466 way it is encoded is different. In UTF-8, more than one byte is needed for
15467 characters with code values greater than 127, whereas ISO-8859-1 is a
15468 single-byte encoding (but thereby limited to 256 characters). This makes
15469 translation from UTF-8 to ISO-8859-1 straightforward.
15470 </para>
15471 </listitem></varlistentry>
15472 <varlistentry>
15473 <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>
15474 <listitem>
15475 <para>
15476 <indexterm role="concept">
15477 <primary>hash function</primary>
15478 <secondary>textual</secondary>
15479 </indexterm>
15480 <indexterm role="concept">
15481 <primary>expansion</primary>
15482 <secondary>textual hash</secondary>
15483 </indexterm>
15484 The <option>hash</option> operator is a simpler interface to the hashing function that can
15485 be used when the two parameters are fixed numbers (as opposed to strings that
15486 change when expanded). The effect is the same as
15487 </para>
15488 <literallayout class="monospaced">
15489 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15490 </literallayout>
15491 <para>
15492 See the description of the general <option>hash</option> item above for details. The
15493 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
15494 </para>
15495 </listitem></varlistentry>
15496 <varlistentry>
15497 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15498 <listitem>
15499 <para>
15500 <indexterm role="concept">
15501 <primary>base64 encoding</primary>
15502 <secondary>conversion from hex</secondary>
15503 </indexterm>
15504 <indexterm role="concept">
15505 <primary>expansion</primary>
15506 <secondary>hex to base64</secondary>
15507 </indexterm>
15508 <indexterm role="concept">
15509 <primary><option>hex2b64</option> expansion item</primary>
15510 </indexterm>
15511 This operator converts a hex string into one that is base64 encoded. This can
15512 be useful for processing the output of the MD5 and SHA-1 hashing functions.
15513 </para>
15514 </listitem></varlistentry>
15515 <varlistentry>
15516 <term><emphasis role="bold">${hexquote:</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>hex-encoded unprintable characters</secondary>
15522 </indexterm>
15523 <indexterm role="concept">
15524 <primary><option>hexquote</option> expansion item</primary>
15525 </indexterm>
15526 This operator converts non-printable characters in a string into a hex
15527 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
15528 as is, and other byte values are converted to <literal>\xNN</literal>, for example a
15529 byte value 127 is converted to <literal>\x7f</literal>.
15530 </para>
15531 </listitem></varlistentry>
15532 <varlistentry>
15533 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15534 <listitem>
15535 <para>
15536 <indexterm role="concept">
15537 <primary><option>ipv6denorm</option> expansion item</primary>
15538 </indexterm>
15539 <indexterm role="concept">
15540 <primary>IP address</primary>
15541 <secondary>normalisation</secondary>
15542 </indexterm>
15543 This expands an IPv6 address to a full eight-element colon-separated set
15544 of hex digits including leading zeroes.
15545 A trailing ipv4-style dotted-decimal set is converted to hex.
15546 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15547 </para>
15548 </listitem></varlistentry>
15549 <varlistentry>
15550 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15551 <listitem>
15552 <para>
15553 <indexterm role="concept">
15554 <primary><option>ipv6norm</option> expansion item</primary>
15555 </indexterm>
15556 <indexterm role="concept">
15557 <primary>IP address</primary>
15558 <secondary>normalisation</secondary>
15559 </indexterm>
15560 <indexterm role="concept">
15561 <primary>IP address</primary>
15562 <secondary>canonical form</secondary>
15563 </indexterm>
15564 This converts an IPv6 address to canonical form.
15565 Leading zeroes of groups are omitted, and the longest
15566 set of zero-valued groups is replaced with a double colon.
15567 A trailing ipv4-style dotted-decimal set is converted to hex.
15568 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
15569 </para>
15570 </listitem></varlistentry>
15571 <varlistentry>
15572 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15573 <listitem>
15574 <para>
15575 <indexterm role="concept">
15576 <primary>case forcing in strings</primary>
15577 </indexterm>
15578 <indexterm role="concept">
15579 <primary>string</primary>
15580 <secondary>case forcing</secondary>
15581 </indexterm>
15582 <indexterm role="concept">
15583 <primary>lower casing</primary>
15584 </indexterm>
15585 <indexterm role="concept">
15586 <primary>expansion</primary>
15587 <secondary>case forcing</secondary>
15588 </indexterm>
15589 <indexterm role="concept">
15590 <primary><option>lc</option> expansion item</primary>
15591 </indexterm>
15592 This forces the letters in the string into lower-case, for example:
15593 </para>
15594 <literallayout class="monospaced">
15595 ${lc:$local_part}
15596 </literallayout>
15597 </listitem></varlistentry>
15598 <varlistentry>
15599 <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>
15600 <listitem>
15601 <para>
15602 <indexterm role="concept">
15603 <primary>expansion</primary>
15604 <secondary>string truncation</secondary>
15605 </indexterm>
15606 <indexterm role="concept">
15607 <primary><option>length</option> expansion item</primary>
15608 </indexterm>
15609 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
15610 can be used when the parameter is a fixed number (as opposed to a string that
15611 changes when expanded). The effect is the same as
15612 </para>
15613 <literallayout class="monospaced">
15614 ${length{&lt;number&gt;}{&lt;string&gt;}}
15615 </literallayout>
15616 <para>
15617 See the description of the general <option>length</option> item above for details. Note that
15618 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
15619 when <option>length</option> is used as an operator.
15620 </para>
15621 </listitem></varlistentry>
15622 <varlistentry>
15623 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15624 <listitem>
15625 <para>
15626 <indexterm role="concept">
15627 <primary>expansion</primary>
15628 <secondary>list item count</secondary>
15629 </indexterm>
15630 <indexterm role="concept">
15631 <primary>list</primary>
15632 <secondary>item count</secondary>
15633 </indexterm>
15634 <indexterm role="concept">
15635 <primary>list</primary>
15636 <secondary>count of items</secondary>
15637 </indexterm>
15638 <indexterm role="concept">
15639 <primary><option>listcount</option> expansion item</primary>
15640 </indexterm>
15641 The string is interpreted as a list and the number of items is returned.
15642 </para>
15643 </listitem></varlistentry>
15644 <varlistentry>
15645 <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>
15646 <listitem>
15647 <para>
15648 <indexterm role="concept">
15649 <primary>expansion</primary>
15650 <secondary>named list</secondary>
15651 </indexterm>
15652 <indexterm role="concept">
15653 <primary><option>listnamed</option> expansion item</primary>
15654 </indexterm>
15655 The name is interpreted as a named list and the content of the list is returned,
15656 expanding any referenced lists, re-quoting as needed for colon-separation.
15657 If the optional type is given it must be one of "a", "d", "h" or "l"
15658 and selects address-, domain-, host- or localpart- lists to search among respectively.
15659 Otherwise all types are searched in an undefined order and the first
15660 matching list is returned.
15661 </para>
15662 </listitem></varlistentry>
15663 <varlistentry>
15664 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15665 <listitem>
15666 <para>
15667 <indexterm role="concept">
15668 <primary>expansion</primary>
15669 <secondary>local part extraction</secondary>
15670 </indexterm>
15671 <indexterm role="concept">
15672 <primary><option>local_part</option> expansion item</primary>
15673 </indexterm>
15674 The string is interpreted as an RFC 2822 address and the local part is
15675 extracted from it. If the string does not parse successfully, the result is
15676 empty.
15677 </para>
15678 </listitem></varlistentry>
15679 <varlistentry>
15680 <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>
15681 <listitem>
15682 <para>
15683 <indexterm role="concept">
15684 <primary>masked IP address</primary>
15685 </indexterm>
15686 <indexterm role="concept">
15687 <primary>IP address</primary>
15688 <secondary>masking</secondary>
15689 </indexterm>
15690 <indexterm role="concept">
15691 <primary>CIDR notation</primary>
15692 </indexterm>
15693 <indexterm role="concept">
15694 <primary>expansion</primary>
15695 <secondary>IP address masking</secondary>
15696 </indexterm>
15697 <indexterm role="concept">
15698 <primary><option>mask</option> expansion item</primary>
15699 </indexterm>
15700 If the form of the string to be operated on is not an IP address followed by a
15701 slash and an integer (that is, a network address in CIDR notation), the
15702 expansion fails. Otherwise, this operator converts the IP address to binary,
15703 masks off the least significant bits according to the bit count, and converts
15704 the result back to text, with mask appended. For example,
15705 </para>
15706 <literallayout class="monospaced">
15707 ${mask:10.111.131.206/28}
15708 </literallayout>
15709 <para>
15710 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
15711 be mostly used for looking up masked addresses in files, the result for an IPv6
15712 address uses dots to separate components instead of colons, because colon
15713 terminates a key string in lsearch files. So, for example,
15714 </para>
15715 <literallayout class="monospaced">
15716 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
15717 </literallayout>
15718 <para>
15719 returns the string
15720 </para>
15721 <literallayout class="monospaced">
15722 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
15723 </literallayout>
15724 <para>
15725 Letters in IPv6 addresses are always output in lower case.
15726 </para>
15727 </listitem></varlistentry>
15728 <varlistentry>
15729 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15730 <listitem>
15731 <para>
15732 <indexterm role="concept">
15733 <primary>MD5 hash</primary>
15734 </indexterm>
15735 <indexterm role="concept">
15736 <primary>expansion</primary>
15737 <secondary>MD5 hash</secondary>
15738 </indexterm>
15739 <indexterm role="concept">
15740 <primary>certificate</primary>
15741 <secondary>fingerprint</secondary>
15742 </indexterm>
15743 <indexterm role="concept">
15744 <primary><option>md5</option> expansion item</primary>
15745 </indexterm>
15746 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
15747 as a 32-digit hexadecimal number, in which any letters are in lower case.
15748 </para>
15749 <para>
15750 If the string is a single variable of type certificate,
15751 returns the MD5 hash fingerprint of the certificate.
15752 </para>
15753 </listitem></varlistentry>
15754 <varlistentry>
15755 <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>
15756 <listitem>
15757 <para>
15758 <indexterm role="concept">
15759 <primary>expansion</primary>
15760 <secondary>numeric hash</secondary>
15761 </indexterm>
15762 <indexterm role="concept">
15763 <primary>hash function</primary>
15764 <secondary>numeric</secondary>
15765 </indexterm>
15766 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
15767 that can be used when the two parameters are fixed numbers (as opposed to
15768 strings that change when expanded). The effect is the same as
15769 </para>
15770 <literallayout class="monospaced">
15771 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
15772 </literallayout>
15773 <para>
15774 See the description of the general <option>nhash</option> item above for details.
15775 </para>
15776 </listitem></varlistentry>
15777 <varlistentry>
15778 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15779 <listitem>
15780 <para>
15781 <indexterm role="concept">
15782 <primary>quoting</primary>
15783 <secondary>in string expansions</secondary>
15784 </indexterm>
15785 <indexterm role="concept">
15786 <primary>expansion</primary>
15787 <secondary>quoting</secondary>
15788 </indexterm>
15789 <indexterm role="concept">
15790 <primary><option>quote</option> expansion item</primary>
15791 </indexterm>
15792 The <option>quote</option> operator puts its argument into double quotes if it
15793 is an empty string or
15794 contains anything other than letters, digits, underscores, dots, and hyphens.
15795 Any occurrences of double quotes and backslashes are escaped with a backslash.
15796 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
15797 respectively For example,
15798 </para>
15799 <literallayout class="monospaced">
15800 ${quote:ab"*"cd}
15801 </literallayout>
15802 <para>
15803 becomes
15804 </para>
15805 <literallayout class="monospaced">
15806 "ab\"*\"cd"
15807 </literallayout>
15808 <para>
15809 The place where this is useful is when the argument is a substitution from a
15810 variable or a message header.
15811 </para>
15812 </listitem></varlistentry>
15813 <varlistentry>
15814 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15815 <listitem>
15816 <para>
15817 <indexterm role="concept">
15818 <primary><option>quote_local_part</option> expansion item</primary>
15819 </indexterm>
15820 This operator is like <option>quote</option>, except that it quotes the string only if
15821 required to do so by the rules of RFC 2822 for quoting local parts. For
15822 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
15823 If you are creating a new email address from the contents of <varname>$local_part</varname>
15824 (or any other unknown data), you should always use this operator.
15825 </para>
15826 </listitem></varlistentry>
15827 <varlistentry>
15828 <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>
15829 <listitem>
15830 <para>
15831 <indexterm role="concept">
15832 <primary>quoting</primary>
15833 <secondary>lookup-specific</secondary>
15834 </indexterm>
15835 This operator applies lookup-specific quoting rules to the string. Each
15836 query-style lookup type has its own quoting rules which are described with
15837 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
15838 </para>
15839 <literallayout class="monospaced">
15840 ${quote_ldap:two * two}
15841 </literallayout>
15842 <para>
15843 returns
15844 </para>
15845 <literallayout class="monospaced">
15846 two%20%5C2A%20two
15847 </literallayout>
15848 <para>
15849 For single-key lookup types, no quoting is ever necessary and this operator
15850 yields an unchanged string.
15851 </para>
15852 </listitem></varlistentry>
15853 <varlistentry>
15854 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15855 <listitem>
15856 <para>
15857 <indexterm role="concept">
15858 <primary>random number</primary>
15859 </indexterm>
15860 This operator returns a somewhat random number which is less than the
15861 supplied number and is at least 0.  The quality of this randomness depends
15862 on how Exim was built; the values are not suitable for keying material.
15863 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
15864 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
15865 for versions of GnuTLS with that function.
15866 Otherwise, the implementation may be arc4random(), random() seeded by
15867 srandomdev() or srandom(), or a custom implementation even weaker than
15868 random().
15869 </para>
15870 </listitem></varlistentry>
15871 <varlistentry>
15872 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15873 <listitem>
15874 <para>
15875 <indexterm role="concept">
15876 <primary>expansion</primary>
15877 <secondary>IP address</secondary>
15878 </indexterm>
15879 This operator reverses an IP address; for IPv4 addresses, the result is in
15880 dotted-quad decimal form, while for IPv6 addresses the result is in
15881 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
15882 for DNS.  For example,
15883 </para>
15884 <literallayout class="monospaced">
15885 ${reverse_ip:192.0.2.4}
15886 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
15887 </literallayout>
15888 <para>
15889 returns
15890 </para>
15891 <literallayout class="monospaced">
15892 4.2.0.192
15893 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
15894 </literallayout>
15895 </listitem></varlistentry>
15896 <varlistentry>
15897 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15898 <listitem>
15899 <para>
15900 <indexterm role="concept">
15901 <primary>expansion</primary>
15902 <secondary>RFC 2047</secondary>
15903 </indexterm>
15904 <indexterm role="concept">
15905 <primary>RFC 2047</primary>
15906 <secondary>expansion operator</secondary>
15907 </indexterm>
15908 <indexterm role="concept">
15909 <primary><option>rfc2047</option> expansion item</primary>
15910 </indexterm>
15911 This operator encodes text according to the rules of RFC 2047. This is an
15912 encoding that is used in header lines to encode non-ASCII characters. It is
15913 assumed that the input string is in the encoding specified by the
15914 <option>headers_charset</option> option, which gets its default at build time. If the string
15915 contains only characters in the range 33&ndash;126, and no instances of the
15916 characters
15917 </para>
15918 <literallayout class="monospaced">
15919 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
15920 </literallayout>
15921 <para>
15922 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
15923 string, using as many <quote>encoded words</quote> as necessary to encode all the
15924 characters.
15925 </para>
15926 </listitem></varlistentry>
15927 <varlistentry>
15928 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15929 <listitem>
15930 <para>
15931 <indexterm role="concept">
15932 <primary>expansion</primary>
15933 <secondary>RFC 2047</secondary>
15934 </indexterm>
15935 <indexterm role="concept">
15936 <primary>RFC 2047</primary>
15937 <secondary>decoding</secondary>
15938 </indexterm>
15939 <indexterm role="concept">
15940 <primary><option>rfc2047d</option> expansion item</primary>
15941 </indexterm>
15942 This operator decodes strings that are encoded as per RFC 2047. Binary zero
15943 bytes are replaced by question marks. Characters are converted into the
15944 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
15945 not recognized unless <option>check_rfc2047_length</option> is set false.
15946 </para>
15947 <para>
15948 <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
15949 access a header line, RFC 2047 decoding is done automatically. You do not need
15950 to use this operator as well.
15951 </para>
15952 </listitem></varlistentry>
15953 <varlistentry>
15954 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15955 <listitem>
15956 <para>
15957 <indexterm role="concept">
15958 <primary>quoting</primary>
15959 <secondary>in regular expressions</secondary>
15960 </indexterm>
15961 <indexterm role="concept">
15962 <primary>regular expressions</primary>
15963 <secondary>quoting</secondary>
15964 </indexterm>
15965 <indexterm role="concept">
15966 <primary><option>rxquote</option> expansion item</primary>
15967 </indexterm>
15968 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
15969 characters in its argument. This is useful when substituting the values of
15970 variables or headers inside regular expressions.
15971 </para>
15972 </listitem></varlistentry>
15973 <varlistentry>
15974 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15975 <listitem>
15976 <para>
15977 <indexterm role="concept">
15978 <primary>SHA-1 hash</primary>
15979 </indexterm>
15980 <indexterm role="concept">
15981 <primary>expansion</primary>
15982 <secondary>SHA-1 hashing</secondary>
15983 </indexterm>
15984 <indexterm role="concept">
15985 <primary>certificate</primary>
15986 <secondary>fingerprint</secondary>
15987 </indexterm>
15988 <indexterm role="concept">
15989 <primary><option>sha1</option> expansion item</primary>
15990 </indexterm>
15991 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
15992 it as a 40-digit hexadecimal number, in which any letters are in upper case.
15993 </para>
15994 <para>
15995 If the string is a single variable of type certificate,
15996 returns the SHA-1 hash fingerprint of the certificate.
15997 </para>
15998 </listitem></varlistentry>
15999 <varlistentry>
16000 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16001 <listitem>
16002 <para>
16003 <indexterm role="concept">
16004 <primary>SHA-256 hash</primary>
16005 </indexterm>
16006 <indexterm role="concept">
16007 <primary>certificate</primary>
16008 <secondary>fingerprint</secondary>
16009 </indexterm>
16010 <indexterm role="concept">
16011 <primary>expansion</primary>
16012 <secondary>SHA-256 hashing</secondary>
16013 </indexterm>
16014 <indexterm role="concept">
16015 <primary><option>sha256</option> expansion item</primary>
16016 </indexterm>
16017 The <option>sha256</option> operator computes the SHA-256 hash value of the string
16018 and returns
16019 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16020 </para>
16021 <para>
16022 If the string is a single variable of type certificate,
16023 returns the SHA-256 hash fingerprint of the certificate.
16024 </para>
16025 </listitem></varlistentry>
16026 <varlistentry>
16027 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16028 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16029 <listitem>
16030 <para>
16031 <indexterm role="concept">
16032 <primary>SHA3 hash</primary>
16033 </indexterm>
16034 <indexterm role="concept">
16035 <primary>expansion</primary>
16036 <secondary>SHA3 hashing</secondary>
16037 </indexterm>
16038 <indexterm role="concept">
16039 <primary><option>sha3</option> expansion item</primary>
16040 </indexterm>
16041 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
16042 and returns
16043 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16044 </para>
16045 <para>
16046 If a number is appended, separated by an underbar, it specifies
16047 the output length.  Values of 224, 256, 384 and 512 are accepted;
16048 with 256 being the default.
16049 </para>
16050 <para>
16051 The <option>sha3</option> expansion item is only supported if Exim has been
16052 compiled with GnuTLS 3.5.0 or later.
16053 </para>
16054 </listitem></varlistentry>
16055 <varlistentry>
16056 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16057 <listitem>
16058 <para>
16059 <indexterm role="concept">
16060 <primary>expansion</primary>
16061 <secondary>statting a file</secondary>
16062 </indexterm>
16063 <indexterm role="concept">
16064 <primary>file</primary>
16065 <secondary>extracting characteristics</secondary>
16066 </indexterm>
16067 <indexterm role="concept">
16068 <primary><option>stat</option> expansion item</primary>
16069 </indexterm>
16070 The string, after expansion, must be a file path. A call to the <function>stat()</function>
16071 function is made for this path. If <function>stat()</function> fails, an error occurs and the
16072 expansion fails. If it succeeds, the data from the stat replaces the item, as a
16073 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
16074 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
16075 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
16076 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
16077 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
16078 can extract individual fields using the <option>extract</option> expansion item.
16079 </para>
16080 <para>
16081 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
16082 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
16083 systems for files larger than 2GB.
16084 </para>
16085 </listitem></varlistentry>
16086 <varlistentry>
16087 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16088 <listitem>
16089 <para>
16090 <indexterm role="concept">
16091 <primary><option>str2b64</option> expansion item</primary>
16092 </indexterm>
16093 Now deprecated, a synonym for the <option>base64</option> expansion operator.
16094 </para>
16095 </listitem></varlistentry>
16096 <varlistentry>
16097 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16098 <listitem>
16099 <para>
16100 <indexterm role="concept">
16101 <primary>expansion</primary>
16102 <secondary>string length</secondary>
16103 </indexterm>
16104 <indexterm role="concept">
16105 <primary>string</primary>
16106 <secondary>length in expansion</secondary>
16107 </indexterm>
16108 <indexterm role="concept">
16109 <primary><option>strlen</option> expansion item</primary>
16110 </indexterm>
16111 The item is replace by the length of the expanded string, expressed as a
16112 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
16113 </para>
16114 </listitem></varlistentry>
16115 <varlistentry>
16116 <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>
16117 <listitem>
16118 <para>
16119 <indexterm role="concept">
16120 <primary><option>substr</option> expansion item</primary>
16121 </indexterm>
16122 <indexterm role="concept">
16123 <primary>substring extraction</primary>
16124 </indexterm>
16125 <indexterm role="concept">
16126 <primary>expansion</primary>
16127 <secondary>substring expansion</secondary>
16128 </indexterm>
16129 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
16130 can be used when the two parameters are fixed numbers (as opposed to strings
16131 that change when expanded). The effect is the same as
16132 </para>
16133 <literallayout class="monospaced">
16134 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
16135 </literallayout>
16136 <para>
16137 See the description of the general <option>substr</option> item above for details. The
16138 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
16139 </para>
16140 </listitem></varlistentry>
16141 <varlistentry>
16142 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16143 <listitem>
16144 <para>
16145 <indexterm role="concept">
16146 <primary><option>time_eval</option> expansion item</primary>
16147 </indexterm>
16148 <indexterm role="concept">
16149 <primary>time interval</primary>
16150 <secondary>decoding</secondary>
16151 </indexterm>
16152 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
16153 seconds.
16154 </para>
16155 </listitem></varlistentry>
16156 <varlistentry>
16157 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16158 <listitem>
16159 <para>
16160 <indexterm role="concept">
16161 <primary><option>time_interval</option> expansion item</primary>
16162 </indexterm>
16163 <indexterm role="concept">
16164 <primary>time interval</primary>
16165 <secondary>formatting</secondary>
16166 </indexterm>
16167 The argument (after sub-expansion) must be a sequence of decimal digits that
16168 represents an interval of time as a number of seconds. It is converted into a
16169 number of larger units and output in Exim&#x2019;s normal time format, for example,
16170 <literal>1w3d4h2m6s</literal>.
16171 </para>
16172 </listitem></varlistentry>
16173 <varlistentry>
16174 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16175 <listitem>
16176 <para>
16177 <indexterm role="concept">
16178 <primary>case forcing in strings</primary>
16179 </indexterm>
16180 <indexterm role="concept">
16181 <primary>string</primary>
16182 <secondary>case forcing</secondary>
16183 </indexterm>
16184 <indexterm role="concept">
16185 <primary>upper casing</primary>
16186 </indexterm>
16187 <indexterm role="concept">
16188 <primary>expansion</primary>
16189 <secondary>case forcing</secondary>
16190 </indexterm>
16191 <indexterm role="concept">
16192 <primary><option>uc</option> expansion item</primary>
16193 </indexterm>
16194 This forces the letters in the string into upper-case.
16195 </para>
16196 </listitem></varlistentry>
16197 <varlistentry>
16198 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16199 <listitem>
16200 <para>
16201 <indexterm role="concept">
16202 <primary>correction of invalid utf-8 sequences in strings</primary>
16203 </indexterm>
16204 <indexterm role="concept">
16205 <primary>utf-8</primary>
16206 <secondary>utf-8 sequences</secondary>
16207 </indexterm>
16208 <indexterm role="concept">
16209 <primary>incorrect utf-8</primary>
16210 </indexterm>
16211 <indexterm role="concept">
16212 <primary>expansion</primary>
16213 <secondary>utf-8 forcing</secondary>
16214 </indexterm>
16215 <indexterm role="concept">
16216 <primary><option>utf8clean</option> expansion item</primary>
16217 </indexterm>
16218 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
16219 </para>
16220 </listitem></varlistentry>
16221 <varlistentry>
16222 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16223 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16224 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16225 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16226 <listitem>
16227 <para>
16228 <indexterm role="concept">
16229 <primary>expansion</primary>
16230 <secondary>UTF-8</secondary>
16231 </indexterm>
16232 <indexterm role="concept">
16233 <primary>UTF-8</primary>
16234 <secondary>expansion</secondary>
16235 </indexterm>
16236 <indexterm role="concept">
16237 <primary>EAI</primary>
16238 </indexterm>
16239 <indexterm role="concept">
16240 <primary>internationalisation</primary>
16241 </indexterm>
16242 <indexterm role="concept">
16243 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
16244 </indexterm>
16245 <indexterm role="concept">
16246 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
16247 </indexterm>
16248 <indexterm role="concept">
16249 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
16250 </indexterm>
16251 <indexterm role="concept">
16252 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
16253 </indexterm>
16254 These convert EAI mail name components between UTF-8 and a-label forms.
16255 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
16256 </para>
16257 </listitem></varlistentry>
16258 </variablelist>
16259 </section>
16260 <section id="SECTexpcond">
16261 <title>Expansion conditions</title>
16262 <para>
16263 <indexterm role="concept" id="IIDexpcond" class="startofrange">
16264 <primary>expansion</primary>
16265 <secondary>conditions</secondary>
16266 </indexterm>
16267 The following conditions are available for testing by the <option>${if</option> construct
16268 while expanding strings:
16269 </para>
16270 <variablelist>
16271 <varlistentry>
16272 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
16273 <listitem>
16274 <para>
16275 <indexterm role="concept">
16276 <primary>expansion</primary>
16277 <secondary>negating a condition</secondary>
16278 </indexterm>
16279 <indexterm role="concept">
16280 <primary>negation</primary>
16281 <secondary>in expansion condition</secondary>
16282 </indexterm>
16283 Preceding any condition with an exclamation mark negates the result of the
16284 condition.
16285 </para>
16286 </listitem></varlistentry>
16287 <varlistentry>
16288 <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>
16289 <listitem>
16290 <para>
16291 <indexterm role="concept">
16292 <primary>numeric comparison</primary>
16293 </indexterm>
16294 <indexterm role="concept">
16295 <primary>expansion</primary>
16296 <secondary>numeric comparison</secondary>
16297 </indexterm>
16298 There are a number of symbolic operators for doing numeric comparisons. They
16299 are:
16300 </para>
16301 <literallayout>
16302 <literal>=   </literal>   equal
16303 <literal>==  </literal>   equal
16304 <literal>&gt;   </literal>   greater
16305 <literal>&gt;=  </literal>   greater or equal
16306 <literal>&lt;   </literal>   less
16307 <literal>&lt;=  </literal>   less or equal
16308 </literallayout>
16309 <para>
16310 For example:
16311 </para>
16312 <literallayout class="monospaced">
16313 ${if &gt;{$message_size}{10M} ...
16314 </literallayout>
16315 <para>
16316 Note that the general negation operator provides for inequality testing. The
16317 two strings must take the form of optionally signed decimal integers,
16318 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
16319 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
16320 As a special case, the numerical value of an empty string is taken as
16321 zero.
16322 </para>
16323 <para>
16324 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
16325 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
16326 10M, not if 10M is larger than <varname>$message_size</varname>.
16327 </para>
16328 </listitem></varlistentry>
16329 <varlistentry>
16330 <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>
16331 <listitem>
16332 <para>
16333 <indexterm role="concept">
16334 <primary>expansion</primary>
16335 <secondary>calling an acl</secondary>
16336 </indexterm>
16337 <indexterm role="concept">
16338 <primary><option>acl</option></primary>
16339 <secondary>expansion condition</secondary>
16340 </indexterm>
16341 The name and zero to nine argument strings are first expanded separately.  The expanded
16342 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
16343 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
16344 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
16345 and may use the variables; if another acl expansion is used the values
16346 are restored after it returns.  If the ACL sets
16347 a value using a "message =" modifier the variable $value becomes
16348 the result of the expansion, otherwise it is empty.
16349 If the ACL returns accept the condition is true; if deny, false.
16350 If the ACL returns defer the result is a forced-fail.
16351 </para>
16352 </listitem></varlistentry>
16353 <varlistentry>
16354 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16355 <listitem>
16356 <para>
16357 <indexterm role="concept">
16358 <primary>expansion</primary>
16359 <secondary>boolean parsing</secondary>
16360 </indexterm>
16361 <indexterm role="concept">
16362 <primary><option>bool</option> expansion condition</primary>
16363 </indexterm>
16364 This condition turns a string holding a true or false representation into
16365 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
16366 (case-insensitively); also integer numbers map to true if non-zero,
16367 false if zero.
16368 An empty string is treated as false.
16369 Leading and trailing whitespace is ignored;
16370 thus a string consisting only of whitespace is false.
16371 All other string values will result in expansion failure.
16372 </para>
16373 <para>
16374 When combined with ACL variables, this expansion condition will let you
16375 make decisions in one place and act on those decisions in another place.
16376 For example:
16377 </para>
16378 <literallayout class="monospaced">
16379 ${if bool{$acl_m_privileged_sender} ...
16380 </literallayout>
16381 </listitem></varlistentry>
16382 <varlistentry>
16383 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16384 <listitem>
16385 <para>
16386 <indexterm role="concept">
16387 <primary>expansion</primary>
16388 <secondary>boolean parsing</secondary>
16389 </indexterm>
16390 <indexterm role="concept">
16391 <primary><option>bool_lax</option> expansion condition</primary>
16392 </indexterm>
16393 Like <option>bool</option>, this condition turns a string into a boolean state.  But
16394 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
16395 loose definition that the Router <option>condition</option> option uses.  The empty string
16396 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
16397 true.  Leading and trailing whitespace is ignored.
16398 </para>
16399 <para>
16400 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
16401 </para>
16402 </listitem></varlistentry>
16403 <varlistentry>
16404 <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>
16405 <listitem>
16406 <para>
16407 <indexterm role="concept">
16408 <primary>expansion</primary>
16409 <secondary>encrypted comparison</secondary>
16410 </indexterm>
16411 <indexterm role="concept">
16412 <primary>encrypted strings, comparing</primary>
16413 </indexterm>
16414 <indexterm role="concept">
16415 <primary><option>crypteq</option> expansion condition</primary>
16416 </indexterm>
16417 This condition is included in the Exim binary if it is built to support any
16418 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
16419 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
16420 included in the binary.
16421 </para>
16422 <para>
16423 The <option>crypteq</option> condition has two arguments. The first is encrypted and
16424 compared against the second, which is already encrypted. The second string may
16425 be in the LDAP form for storing encrypted strings, which starts with the
16426 encryption type in curly brackets, followed by the data. If the second string
16427 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
16428 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
16429 Typically this will be a field from a password file. An example of an encrypted
16430 string in LDAP form is:
16431 </para>
16432 <literallayout class="monospaced">
16433 {md5}CY9rzUYh03PK3k6DJie09g==
16434 </literallayout>
16435 <para>
16436 If such a string appears directly in an expansion, the curly brackets have to
16437 be quoted, because they are part of the expansion syntax. For example:
16438 </para>
16439 <literallayout class="monospaced">
16440 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
16441 </literallayout>
16442 <para>
16443 The following encryption types (whose names are matched case-independently) are
16444 supported:
16445 </para>
16446 <itemizedlist>
16447 <listitem>
16448 <para>
16449 <indexterm role="concept">
16450 <primary>MD5 hash</primary>
16451 </indexterm>
16452 <indexterm role="concept">
16453 <primary>base64 encoding</primary>
16454 <secondary>in encrypted password</secondary>
16455 </indexterm>
16456 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
16457 printable characters to compare with the remainder of the second string. If the
16458 length of the comparison string is 24, Exim assumes that it is base64 encoded
16459 (as in the above example). If the length is 32, Exim assumes that it is a
16460 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
16461 comparison fails.
16462 </para>
16463 </listitem>
16464 <listitem>
16465 <para>
16466 <indexterm role="concept">
16467 <primary>SHA-1 hash</primary>
16468 </indexterm>
16469 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
16470 printable characters to compare with the remainder of the second string. If the
16471 length of the comparison string is 28, Exim assumes that it is base64 encoded.
16472 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
16473 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
16474 </para>
16475 </listitem>
16476 <listitem>
16477 <para>
16478 <indexterm role="concept">
16479 <primary><function>crypt()</function></primary>
16480 </indexterm>
16481 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
16482 only the first eight characters of the password. However, in modern operating
16483 systems this is no longer true, and in many cases the entire password is used,
16484 whatever its length.
16485 </para>
16486 </listitem>
16487 <listitem>
16488 <para>
16489 <indexterm role="concept">
16490 <primary><function>crypt16()</function></primary>
16491 </indexterm>
16492 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
16493 use up to 16 characters of the password in some operating systems. Again, in
16494 modern operating systems, more characters may be used.
16495 </para>
16496 </listitem>
16497 </itemizedlist>
16498 <para>
16499 Exim has its own version of <function>crypt16()</function>, which is just a double call to
16500 <function>crypt()</function>. For operating systems that have their own version, setting
16501 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
16502 operating system version instead of its own. This option is set by default in
16503 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
16504 support <function>crypt16()</function>.
16505 </para>
16506 <para>
16507 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
16508 it was not using the same algorithm as some operating systems&#x2019; versions. It
16509 turns out that as well as <function>crypt16()</function> there is a function called
16510 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
16511 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
16512 </para>
16513 <para>
16514 However, since there is now a move away from the traditional <function>crypt()</function>
16515 functions towards using SHA1 and other algorithms, tidying up this area of
16516 Exim is seen as very low priority.
16517 </para>
16518 <para>
16519 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
16520 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
16521 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
16522 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
16523 function by specifying it explicitly in curly brackets.
16524 </para>
16525 </listitem></varlistentry>
16526 <varlistentry>
16527 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
16528 <listitem>
16529 <para>
16530 <indexterm role="concept">
16531 <primary>expansion</primary>
16532 <secondary>checking for empty variable</secondary>
16533 </indexterm>
16534 <indexterm role="concept">
16535 <primary><option>def</option> expansion condition</primary>
16536 </indexterm>
16537 The <option>def</option> condition must be followed by the name of one of the expansion
16538 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
16539 variable does not contain the empty string. For example:
16540 </para>
16541 <literallayout class="monospaced">
16542 ${if def:sender_ident {from $sender_ident}}
16543 </literallayout>
16544 <para>
16545 Note that the variable name is given without a leading <option>$</option> character. If the
16546 variable does not exist, the expansion fails.
16547 </para>
16548 </listitem></varlistentry>
16549 <varlistentry>
16550 <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>
16551 <listitem>
16552 <para>
16553 <indexterm role="concept">
16554 <primary>expansion</primary>
16555 <secondary>checking header line existence</secondary>
16556 </indexterm>
16557 This condition is true if a message is being processed and the named header
16558 exists in the message. For example,
16559 </para>
16560 <literallayout class="monospaced">
16561 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
16562 </literallayout>
16563 <para>
16564 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
16565 the header name must be terminated by a colon if white space does not follow.
16566 </para>
16567 </listitem></varlistentry>
16568 <varlistentry>
16569 <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>
16570 <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>
16571 <listitem>
16572 <para>
16573 <indexterm role="concept">
16574 <primary>string</primary>
16575 <secondary>comparison</secondary>
16576 </indexterm>
16577 <indexterm role="concept">
16578 <primary>expansion</primary>
16579 <secondary>string comparison</secondary>
16580 </indexterm>
16581 <indexterm role="concept">
16582 <primary><option>eq</option> expansion condition</primary>
16583 </indexterm>
16584 <indexterm role="concept">
16585 <primary><option>eqi</option> expansion condition</primary>
16586 </indexterm>
16587 The two substrings are first expanded. The condition is true if the two
16588 resulting strings are identical. For <option>eq</option> the comparison includes the case of
16589 letters, whereas for <option>eqi</option> the comparison is case-independent.
16590 </para>
16591 </listitem></varlistentry>
16592 <varlistentry>
16593 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16594 <listitem>
16595 <para>
16596 <indexterm role="concept">
16597 <primary>expansion</primary>
16598 <secondary>file existence test</secondary>
16599 </indexterm>
16600 <indexterm role="concept">
16601 <primary>file</primary>
16602 <secondary>existence test</secondary>
16603 </indexterm>
16604 <indexterm role="concept">
16605 <primary><option>exists</option>, expansion condition</primary>
16606 </indexterm>
16607 The substring is first expanded and then interpreted as an absolute path. The
16608 condition is true if the named file (or directory) exists. The existence test
16609 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
16610 users&#x2019; filter files may be locked out by the system administrator.
16611 </para>
16612 </listitem></varlistentry>
16613 <varlistentry>
16614 <term><emphasis role="bold">first_delivery</emphasis></term>
16615 <listitem>
16616 <para>
16617 <indexterm role="concept">
16618 <primary>delivery</primary>
16619 <secondary>first</secondary>
16620 </indexterm>
16621 <indexterm role="concept">
16622 <primary>first delivery</primary>
16623 </indexterm>
16624 <indexterm role="concept">
16625 <primary>expansion</primary>
16626 <secondary>first delivery test</secondary>
16627 </indexterm>
16628 <indexterm role="concept">
16629 <primary><option>first_delivery</option> expansion condition</primary>
16630 </indexterm>
16631 This condition, which has no data, is true during a message&#x2019;s first delivery
16632 attempt. It is false during any subsequent delivery attempts.
16633 </para>
16634 </listitem></varlistentry>
16635 <varlistentry>
16636 <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>
16637 <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>
16638 <listitem>
16639 <para>
16640 <indexterm role="concept">
16641 <primary>list</primary>
16642 <secondary>iterative conditions</secondary>
16643 </indexterm>
16644 <indexterm role="concept">
16645 <primary>expansion</primary>
16646 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
16647 </indexterm>
16648 <indexterm role="concept">
16649 <primary>expansion</primary>
16650 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
16651 </indexterm>
16652 <indexterm role="variable">
16653 <primary><varname>$item</varname></primary>
16654 </indexterm>
16655 These conditions iterate over a list. The first argument is expanded to form
16656 the list. By default, the list separator is a colon, but it can be changed by
16657 the normal method. The second argument is interpreted as a condition that is to
16658 be applied to each item in the list in turn. During the interpretation of the
16659 condition, the current list item is placed in a variable called <varname>$item</varname>.
16660 </para>
16661 <itemizedlist>
16662 <listitem>
16663 <para>
16664 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
16665 the result of the whole condition is true. If the condition is false for all
16666 items in the list, the overall condition is false.
16667 </para>
16668 </listitem>
16669 <listitem>
16670 <para>
16671 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
16672 and the result of the whole condition is false. If the condition is true for
16673 all items in the list, the overall condition is true.
16674 </para>
16675 </listitem>
16676 </itemizedlist>
16677 <para>
16678 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
16679 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
16680 that the condition must be false for at least one item. In this example, the
16681 list separator is changed to a comma:
16682 </para>
16683 <literallayout class="monospaced">
16684 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
16685 </literallayout>
16686 <para>
16687 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
16688 being processed, to enable these expansion items to be nested.
16689 </para>
16690 <para>
16691 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
16692 </para>
16693 </listitem></varlistentry>
16694 <varlistentry>
16695 <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>
16696 <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>
16697 <listitem>
16698 <para>
16699 <indexterm role="concept">
16700 <primary>string</primary>
16701 <secondary>comparison</secondary>
16702 </indexterm>
16703 <indexterm role="concept">
16704 <primary>expansion</primary>
16705 <secondary>string comparison</secondary>
16706 </indexterm>
16707 <indexterm role="concept">
16708 <primary><option>ge</option> expansion condition</primary>
16709 </indexterm>
16710 <indexterm role="concept">
16711 <primary><option>gei</option> expansion condition</primary>
16712 </indexterm>
16713 The two substrings are first expanded. The condition is true if the first
16714 string is lexically greater than or equal to the second string. For <option>ge</option> the
16715 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
16716 case-independent.
16717 </para>
16718 </listitem></varlistentry>
16719 <varlistentry>
16720 <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>
16721 <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>
16722 <listitem>
16723 <para>
16724 <indexterm role="concept">
16725 <primary>string</primary>
16726 <secondary>comparison</secondary>
16727 </indexterm>
16728 <indexterm role="concept">
16729 <primary>expansion</primary>
16730 <secondary>string comparison</secondary>
16731 </indexterm>
16732 <indexterm role="concept">
16733 <primary><option>gt</option> expansion condition</primary>
16734 </indexterm>
16735 <indexterm role="concept">
16736 <primary><option>gti</option> expansion condition</primary>
16737 </indexterm>
16738 The two substrings are first expanded. The condition is true if the first
16739 string is lexically greater than the second string. For <option>gt</option> the comparison
16740 includes the case of letters, whereas for <option>gti</option> the comparison is
16741 case-independent.
16742 </para>
16743 </listitem></varlistentry>
16744 <varlistentry>
16745 <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>
16746 <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>
16747 <listitem>
16748 <para>
16749 <indexterm role="concept">
16750 <primary>string</primary>
16751 <secondary>comparison</secondary>
16752 </indexterm>
16753 <indexterm role="concept">
16754 <primary>list</primary>
16755 <secondary>iterative conditions</secondary>
16756 </indexterm>
16757 Both strings are expanded; the second string is treated as a list of simple
16758 strings; if the first string is a member of the second, then the condition
16759 is true.
16760 </para>
16761 <para>
16762 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
16763 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
16764 </para>
16765 <literallayout class="monospaced">
16766 ${if inlist{needle}{foo:needle:bar}}
16767   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
16768 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
16769   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
16770 </literallayout>
16771 </listitem></varlistentry>
16772 <varlistentry>
16773 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16774 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16775 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16776 <listitem>
16777 <para>
16778 <indexterm role="concept">
16779 <primary>IP address</primary>
16780 <secondary>testing string format</secondary>
16781 </indexterm>
16782 <indexterm role="concept">
16783 <primary>string</primary>
16784 <secondary>testing for IP address</secondary>
16785 </indexterm>
16786 <indexterm role="concept">
16787 <primary><option>isip</option> expansion condition</primary>
16788 </indexterm>
16789 <indexterm role="concept">
16790 <primary><option>isip4</option> expansion condition</primary>
16791 </indexterm>
16792 <indexterm role="concept">
16793 <primary><option>isip6</option> expansion condition</primary>
16794 </indexterm>
16795 The substring is first expanded, and then tested to see if it has the form of
16796 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
16797 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
16798 </para>
16799 <para>
16800 For an IPv4 address, the test is for four dot-separated components, each of
16801 which consists of from one to three digits. For an IPv6 address, up to eight
16802 colon-separated components are permitted, each containing from one to four
16803 hexadecimal digits. There may be fewer than eight components if an empty
16804 component (adjacent colons) is present. Only one empty component is permitted.
16805 </para>
16806 <para>
16807 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
16808 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
16809 check. The main use of these tests is to distinguish between IP addresses and
16810 host names, or between IPv4 and IPv6 addresses. For example, you could use
16811 </para>
16812 <literallayout class="monospaced">
16813 ${if isip4{$sender_host_address}...
16814 </literallayout>
16815 <para>
16816 to test which IP version an incoming SMTP connection is using.
16817 </para>
16818 </listitem></varlistentry>
16819 <varlistentry>
16820 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16821 <listitem>
16822 <para>
16823 <indexterm role="concept">
16824 <primary>LDAP</primary>
16825 <secondary>use for authentication</secondary>
16826 </indexterm>
16827 <indexterm role="concept">
16828 <primary>expansion</primary>
16829 <secondary>LDAP authentication test</secondary>
16830 </indexterm>
16831 <indexterm role="concept">
16832 <primary><option>ldapauth</option> expansion condition</primary>
16833 </indexterm>
16834 This condition supports user authentication using LDAP. See section
16835 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
16836 queries. For this use, the query must contain a user name and password. The
16837 query itself is not used, and can be empty. The condition is true if the
16838 password is not empty, and the user name and password are accepted by the LDAP
16839 server. An empty password is rejected without calling LDAP because LDAP binds
16840 with an empty password are considered anonymous regardless of the username, and
16841 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
16842 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
16843 this can be used.
16844 </para>
16845 </listitem></varlistentry>
16846 <varlistentry>
16847 <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>
16848 <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>
16849 <listitem>
16850 <para>
16851 <indexterm role="concept">
16852 <primary>string</primary>
16853 <secondary>comparison</secondary>
16854 </indexterm>
16855 <indexterm role="concept">
16856 <primary>expansion</primary>
16857 <secondary>string comparison</secondary>
16858 </indexterm>
16859 <indexterm role="concept">
16860 <primary><option>le</option> expansion condition</primary>
16861 </indexterm>
16862 <indexterm role="concept">
16863 <primary><option>lei</option> expansion condition</primary>
16864 </indexterm>
16865 The two substrings are first expanded. The condition is true if the first
16866 string is lexically less than or equal to the second string. For <option>le</option> the
16867 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
16868 case-independent.
16869 </para>
16870 </listitem></varlistentry>
16871 <varlistentry>
16872 <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>
16873 <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>
16874 <listitem>
16875 <para>
16876 <indexterm role="concept">
16877 <primary>string</primary>
16878 <secondary>comparison</secondary>
16879 </indexterm>
16880 <indexterm role="concept">
16881 <primary>expansion</primary>
16882 <secondary>string comparison</secondary>
16883 </indexterm>
16884 <indexterm role="concept">
16885 <primary><option>lt</option> expansion condition</primary>
16886 </indexterm>
16887 <indexterm role="concept">
16888 <primary><option>lti</option> expansion condition</primary>
16889 </indexterm>
16890 The two substrings are first expanded. The condition is true if the first
16891 string is lexically less than the second string. For <option>lt</option> the comparison
16892 includes the case of letters, whereas for <option>lti</option> the comparison is
16893 case-independent.
16894 </para>
16895 </listitem></varlistentry>
16896 <varlistentry>
16897 <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>
16898 <listitem>
16899 <para>
16900 <indexterm role="concept">
16901 <primary>expansion</primary>
16902 <secondary>regular expression comparison</secondary>
16903 </indexterm>
16904 <indexterm role="concept">
16905 <primary>regular expressions</primary>
16906 <secondary>match in expanded string</secondary>
16907 </indexterm>
16908 <indexterm role="concept">
16909 <primary><option>match</option> expansion condition</primary>
16910 </indexterm>
16911 The two substrings are first expanded. The second is then treated as a regular
16912 expression and applied to the first. Because of the pre-expansion, if the
16913 regular expression contains dollar, or backslash characters, they must be
16914 escaped. Care must also be taken if the regular expression contains braces
16915 (curly brackets). A closing brace must be escaped so that it is not taken as a
16916 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
16917 <literal>\N</literal> feature to disable expansion of the regular expression.
16918 For example,
16919 </para>
16920 <literallayout class="monospaced">
16921 ${if match {$local_part}{\N^\d{3}\N} ...
16922 </literallayout>
16923 <para>
16924 If the whole expansion string is in double quotes, further escaping of
16925 backslashes is also required.
16926 </para>
16927 <para>
16928 The condition is true if the regular expression match succeeds.
16929 The regular expression is not required to begin with a circumflex
16930 metacharacter, but if there is no circumflex, the expression is not anchored,
16931 and it may match anywhere in the subject, not just at the start. If you want
16932 the pattern to match at the end of the subject, you must include the <literal>$</literal>
16933 metacharacter at an appropriate point.
16934 </para>
16935 <para>
16936 <indexterm role="concept">
16937 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
16938 <secondary>in <option>if</option> expansion</secondary>
16939 </indexterm>
16940 At the start of an <option>if</option> expansion the values of the numeric variable
16941 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
16942 succeeds causes them to be reset to the substrings of that condition and they
16943 will have these values during the expansion of the success string. At the end
16944 of the <option>if</option> expansion, the previous values are restored. After testing a
16945 combination of conditions using <option>or</option>, the subsequent values of the numeric
16946 variables are those of the condition that succeeded.
16947 </para>
16948 </listitem></varlistentry>
16949 <varlistentry>
16950 <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>
16951 <listitem>
16952 <para>
16953 <indexterm role="concept">
16954 <primary><option>match_address</option> expansion condition</primary>
16955 </indexterm>
16956 See <emphasis role="bold">match_local_part</emphasis>.
16957 </para>
16958 </listitem></varlistentry>
16959 <varlistentry>
16960 <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>
16961 <listitem>
16962 <para>
16963 <indexterm role="concept">
16964 <primary><option>match_domain</option> expansion condition</primary>
16965 </indexterm>
16966 See <emphasis role="bold">match_local_part</emphasis>.
16967 </para>
16968 </listitem></varlistentry>
16969 <varlistentry>
16970 <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>
16971 <listitem>
16972 <para>
16973 <indexterm role="concept">
16974 <primary><option>match_ip</option> expansion condition</primary>
16975 </indexterm>
16976 This condition matches an IP address to a list of IP address patterns. It must
16977 be followed by two argument strings. The first (after expansion) must be an IP
16978 address or an empty string. The second (not expanded) is a restricted host
16979 list that can match only an IP address, not a host name. For example:
16980 </para>
16981 <literallayout class="monospaced">
16982 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
16983 </literallayout>
16984 <para>
16985 The specific types of host list item that are permitted in the list are:
16986 </para>
16987 <itemizedlist>
16988 <listitem>
16989 <para>
16990 An IP address, optionally with a CIDR mask.
16991 </para>
16992 </listitem>
16993 <listitem>
16994 <para>
16995 A single asterisk, which matches any IP address.
16996 </para>
16997 </listitem>
16998 <listitem>
16999 <para>
17000 An empty item, which matches only if the IP address is empty. This could be
17001 useful for testing for a locally submitted message or one from specific hosts
17002 in a single test such as
17003 </para>
17004 <literallayout class="monospaced">
17005   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
17006 </literallayout>
17007 <para>
17008 where the first item in the list is the empty string.
17009 </para>
17010 </listitem>
17011 <listitem>
17012 <para>
17013 The item @[] matches any of the local host&#x2019;s interface addresses.
17014 </para>
17015 </listitem>
17016 <listitem>
17017 <para>
17018 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
17019 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
17020 address into a host name. The most common type of linear search for
17021 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
17022 masks. For example:
17023 </para>
17024 <literallayout class="monospaced">
17025   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
17026 </literallayout>
17027 <para>
17028 It is of course possible to use other kinds of lookup, and in such a case, you
17029 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
17030 address mask, for example:
17031 </para>
17032 <literallayout class="monospaced">
17033   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
17034 </literallayout>
17035 <para>
17036 However, unless you are combining a <option>match_ip</option> condition with others, it is
17037 just as easy to use the fact that a lookup is itself a condition, and write:
17038 </para>
17039 <literallayout class="monospaced">
17040   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
17041 </literallayout>
17042 </listitem>
17043 </itemizedlist>
17044 <para>
17045 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17046 Exim was built with the EXPAND_LISTMATCH_RHS option.
17047 </para>
17048 <para>
17049 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
17050 </para>
17051 </listitem></varlistentry>
17052 <varlistentry>
17053 <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>
17054 <listitem>
17055 <para>
17056 <indexterm role="concept">
17057 <primary>domain list</primary>
17058 <secondary>in expansion condition</secondary>
17059 </indexterm>
17060 <indexterm role="concept">
17061 <primary>address list</primary>
17062 <secondary>in expansion condition</secondary>
17063 </indexterm>
17064 <indexterm role="concept">
17065 <primary>local part</primary>
17066 <secondary>list, in expansion condition</secondary>
17067 </indexterm>
17068 <indexterm role="concept">
17069 <primary><option>match_local_part</option> expansion condition</primary>
17070 </indexterm>
17071 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
17072 possible to test domain, address, and local part lists within expansions. Each
17073 condition requires two arguments: an item and a list to match. A trivial
17074 example is:
17075 </para>
17076 <literallayout class="monospaced">
17077 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
17078 </literallayout>
17079 <para>
17080 In each case, the second argument may contain any of the allowable items for a
17081 list of the appropriate type. Also, because the second argument (after
17082 expansion) is a standard form of list, it is possible to refer to a named list.
17083 Thus, you can use conditions like this:
17084 </para>
17085 <literallayout class="monospaced">
17086 ${if match_domain{$domain}{+local_domains}{...
17087 </literallayout>
17088 <para>
17089 <indexterm role="concept">
17090 <primary><literal>+caseful</literal></primary>
17091 </indexterm>
17092 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
17093 item can be used, as in all address lists, to cause subsequent items to
17094 have their local parts matched casefully. Domains are always matched
17095 caselessly.
17096 </para>
17097 <para>
17098 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
17099 Exim was built with the EXPAND_LISTMATCH_RHS option.
17100 </para>
17101 <para>
17102 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
17103 hosts have two identities: a name and an IP address, and it is not clear
17104 how to specify cleanly how such a test would work. However, IP addresses can be
17105 matched using <option>match_ip</option>.
17106 </para>
17107 </listitem></varlistentry>
17108 <varlistentry>
17109 <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>
17110 <listitem>
17111 <para>
17112 <indexterm role="concept">
17113 <primary>PAM authentication</primary>
17114 </indexterm>
17115 <indexterm role="concept">
17116 <primary>AUTH</primary>
17117 <secondary>with PAM</secondary>
17118 </indexterm>
17119 <indexterm role="concept">
17120 <primary>Solaris</primary>
17121 <secondary>PAM support</secondary>
17122 </indexterm>
17123 <indexterm role="concept">
17124 <primary>expansion</primary>
17125 <secondary>PAM authentication test</secondary>
17126 </indexterm>
17127 <indexterm role="concept">
17128 <primary><option>pam</option> expansion condition</primary>
17129 </indexterm>
17130 <emphasis>Pluggable Authentication Modules</emphasis>
17131 (<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
17132 available in the latest releases of Solaris and in some GNU/Linux
17133 distributions. The Exim support, which is intended for use in conjunction with
17134 the SMTP AUTH command, is available only if Exim is compiled with
17135 </para>
17136 <literallayout class="monospaced">
17137 SUPPORT_PAM=yes
17138 </literallayout>
17139 <para>
17140 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
17141 in some releases of GNU/Linux <option>-ldl</option> is also needed.
17142 </para>
17143 <para>
17144 The argument string is first expanded, and the result must be a
17145 colon-separated list of strings. Leading and trailing white space is ignored.
17146 The PAM module is initialized with the service name <quote>exim</quote> and the user name
17147 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
17148 The remaining items in the data string are passed over in response to requests
17149 from the authentication function. In the simple case there will only be one
17150 request, for a password, so the data consists of just two strings.
17151 </para>
17152 <para>
17153 There can be problems if any of the strings are permitted to contain colon
17154 characters. In the usual way, these have to be doubled to avoid being taken as
17155 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
17156 item can be used to double any existing colons. For example, the configuration
17157 of a LOGIN authenticator might contain this setting:
17158 </para>
17159 <literallayout class="monospaced">
17160 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
17161 </literallayout>
17162 <para>
17163 For a PLAIN authenticator you could use:
17164 </para>
17165 <literallayout class="monospaced">
17166 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
17167 </literallayout>
17168 <para>
17169 In some operating systems, PAM authentication can be done only from a process
17170 running as root. Since Exim is running as the Exim user when receiving
17171 messages, this means that PAM cannot be used directly in those systems.
17172 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
17173 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>.
17174 The patched module allows one special uid/gid combination, in addition to root,
17175 to authenticate. If you build the patched module to allow the Exim user and
17176 group, PAM can then be used from an Exim authenticator.
17177 </para>
17178 </listitem></varlistentry>
17179 <varlistentry>
17180 <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>
17181 <listitem>
17182 <para>
17183 <indexterm role="concept">
17184 <primary><emphasis>pwcheck</emphasis> daemon</primary>
17185 </indexterm>
17186 <indexterm role="concept">
17187 <primary>Cyrus</primary>
17188 </indexterm>
17189 <indexterm role="concept">
17190 <primary>expansion</primary>
17191 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
17192 </indexterm>
17193 <indexterm role="concept">
17194 <primary><option>pwcheck</option> expansion condition</primary>
17195 </indexterm>
17196 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
17197 This is one way of making it possible for passwords to be checked by a process
17198 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
17199 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
17200 </para>
17201 <para>
17202 The pwcheck support is not included in Exim by default. You need to specify
17203 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17204 building Exim. For example:
17205 </para>
17206 <literallayout class="monospaced">
17207 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
17208 </literallayout>
17209 <para>
17210 You do not need to install the full Cyrus software suite in order to use
17211 the pwcheck daemon. You can compile and install just the daemon alone
17212 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
17213 access to the <filename>/var/pwcheck</filename> directory.
17214 </para>
17215 <para>
17216 The <option>pwcheck</option> condition takes one argument, which must be the user name and
17217 password, separated by a colon. For example, in a LOGIN authenticator
17218 configuration, you might have this:
17219 </para>
17220 <literallayout class="monospaced">
17221 server_condition = ${if pwcheck{$auth1:$auth2}}
17222 </literallayout>
17223 <para>
17224 Again, for a PLAIN authenticator configuration, this would be:
17225 </para>
17226 <literallayout class="monospaced">
17227 server_condition = ${if pwcheck{$auth2:$auth3}}
17228 </literallayout>
17229 </listitem></varlistentry>
17230 <varlistentry>
17231 <term><emphasis role="bold">queue_running</emphasis></term>
17232 <listitem>
17233 <para>
17234 <indexterm role="concept">
17235 <primary>queue runner</primary>
17236 <secondary>detecting when delivering from</secondary>
17237 </indexterm>
17238 <indexterm role="concept">
17239 <primary>expansion</primary>
17240 <secondary>queue runner test</secondary>
17241 </indexterm>
17242 <indexterm role="concept">
17243 <primary><option>queue_running</option> expansion condition</primary>
17244 </indexterm>
17245 This condition, which has no data, is true during delivery attempts that are
17246 initiated by queue runner processes, and false otherwise.
17247 </para>
17248 </listitem></varlistentry>
17249 <varlistentry>
17250 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17251 <listitem>
17252 <para>
17253 <indexterm role="concept">
17254 <primary>Radius</primary>
17255 </indexterm>
17256 <indexterm role="concept">
17257 <primary>expansion</primary>
17258 <secondary>Radius authentication</secondary>
17259 </indexterm>
17260 <indexterm role="concept">
17261 <primary><option>radius</option> expansion condition</primary>
17262 </indexterm>
17263 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
17264 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
17265 the Radius client configuration file in order to build Exim with Radius
17266 support.
17267 </para>
17268 <para>
17269 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
17270 library, using the original API. If you are using release 0.4.0 or later of
17271 this library, you need to set
17272 </para>
17273 <literallayout class="monospaced">
17274 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
17275 </literallayout>
17276 <para>
17277 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
17278 <option>libradius</option> library that comes with FreeBSD. To do this, set
17279 </para>
17280 <literallayout class="monospaced">
17281 RADIUS_LIB_TYPE=RADLIB
17282 </literallayout>
17283 <para>
17284 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
17285 You may also have to supply a suitable setting in EXTRALIBS so that the
17286 Radius library can be found when Exim is linked.
17287 </para>
17288 <para>
17289 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
17290 Radius client library, which calls the Radius server. The condition is true if
17291 the authentication is successful. For example:
17292 </para>
17293 <literallayout class="monospaced">
17294 server_condition = ${if radius{&lt;arguments&gt;}}
17295 </literallayout>
17296 </listitem></varlistentry>
17297 <varlistentry>
17298 <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>
17299 <listitem>
17300 <para>
17301 <indexterm role="concept">
17302 <primary><emphasis>saslauthd</emphasis> daemon</primary>
17303 </indexterm>
17304 <indexterm role="concept">
17305 <primary>Cyrus</primary>
17306 </indexterm>
17307 <indexterm role="concept">
17308 <primary>expansion</primary>
17309 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
17310 </indexterm>
17311 <indexterm role="concept">
17312 <primary><option>saslauthd</option> expansion condition</primary>
17313 </indexterm>
17314 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
17315 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
17316 Using this daemon is one way of making it possible for passwords to be checked
17317 by a process that is not running as root.
17318 </para>
17319 <para>
17320 The saslauthd support is not included in Exim by default. You need to specify
17321 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
17322 building Exim. For example:
17323 </para>
17324 <literallayout class="monospaced">
17325 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
17326 </literallayout>
17327 <para>
17328 You do not need to install the full Cyrus software suite in order to use
17329 the saslauthd daemon. You can compile and install just the daemon alone
17330 from the Cyrus SASL library.
17331 </para>
17332 <para>
17333 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
17334 two are mandatory. For example:
17335 </para>
17336 <literallayout class="monospaced">
17337 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
17338 </literallayout>
17339 <para>
17340 The service and the realm are optional (which is why the arguments are enclosed
17341 in their own set of braces). For details of the meaning of the service and
17342 realm, and how to run the daemon, consult the Cyrus documentation.
17343 </para>
17344 </listitem></varlistentry>
17345 </variablelist>
17346 </section>
17347 <section id="SECID84">
17348 <title>Combining expansion conditions</title>
17349 <para>
17350 <indexterm role="concept">
17351 <primary>expansion</primary>
17352 <secondary>combining conditions</secondary>
17353 </indexterm>
17354 Several conditions can be tested at once by combining them using the <option>and</option>
17355 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
17356 conditions on their own, and precede their lists of sub-conditions. Each
17357 sub-condition must be enclosed in braces within the overall braces that contain
17358 the list. No repetition of <option>if</option> is used.
17359 </para>
17360 <variablelist>
17361 <varlistentry>
17362 <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>
17363 <listitem>
17364 <para>
17365 <indexterm role="concept">
17366 <primary><quote>or</quote> expansion condition</primary>
17367 </indexterm>
17368 <indexterm role="concept">
17369 <primary>expansion</primary>
17370 <secondary><quote>or</quote> of conditions</secondary>
17371 </indexterm>
17372 The sub-conditions are evaluated from left to right. The condition is true if
17373 any one of the sub-conditions is true.
17374 For example,
17375 </para>
17376 <literallayout class="monospaced">
17377 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
17378 </literallayout>
17379 <para>
17380 When a true sub-condition is found, the following ones are parsed but not
17381 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
17382 numeric variables afterwards are taken from the first one that succeeds.
17383 </para>
17384 </listitem></varlistentry>
17385 <varlistentry>
17386 <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>
17387 <listitem>
17388 <para>
17389 <indexterm role="concept">
17390 <primary><quote>and</quote> expansion condition</primary>
17391 </indexterm>
17392 <indexterm role="concept">
17393 <primary>expansion</primary>
17394 <secondary><quote>and</quote> of conditions</secondary>
17395 </indexterm>
17396 The sub-conditions are evaluated from left to right. The condition is true if
17397 all of the sub-conditions are true. If there are several <quote>match</quote>
17398 sub-conditions, the values of the numeric variables afterwards are taken from
17399 the last one. When a false sub-condition is found, the following ones are
17400 parsed but not evaluated.
17401 </para>
17402 </listitem></varlistentry>
17403 </variablelist>
17404 <para>
17405 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
17406 </para>
17407 </section>
17408 <section id="SECTexpvar">
17409 <title>Expansion variables</title>
17410 <para>
17411 <indexterm role="concept">
17412 <primary>expansion</primary>
17413 <secondary>variables, list of</secondary>
17414 </indexterm>
17415 This section contains an alphabetical list of all the expansion variables. Some
17416 of them are available only when Exim is compiled with specific options such as
17417 support for TLS or the content scanning extension.
17418 </para>
17419 <variablelist>
17420 <varlistentry>
17421 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
17422 <listitem>
17423 <para>
17424 <indexterm role="concept">
17425 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17426 </indexterm>
17427 When a <option>match</option> expansion condition succeeds, these variables contain the
17428 captured substrings identified by the regular expression during subsequent
17429 processing of the success string of the containing <option>if</option> expansion item.
17430 In the expansion condition case
17431 they do not retain their values afterwards; in fact, their previous
17432 values are restored at the end of processing an <option>if</option> item. The numerical
17433 variables may also be set externally by some other matching process which
17434 precedes the expansion of the string. For example, the commands available in
17435 Exim filter files include an <option>if</option> command with its own regular expression
17436 matching condition.
17437 </para>
17438 </listitem></varlistentry>
17439 <varlistentry>
17440 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
17441 <listitem>
17442 <para>
17443 Within an acl condition, expansion condition or expansion item
17444 any arguments are copied to these variables,
17445 any unused variables being made empty.
17446 </para>
17447 </listitem></varlistentry>
17448 <varlistentry>
17449 <term><varname>$acl_c...</varname></term>
17450 <listitem>
17451 <para>
17452 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
17453 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
17454 long, but the sixth character must be either a digit or an underscore. For
17455 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
17456 variables persist throughout the lifetime of an SMTP connection. They can be
17457 used to pass information between ACLs and between different invocations of the
17458 same ACL. When a message is received, the values of these variables are saved
17459 with the message, and can be accessed by filters, routers, and transports
17460 during subsequent delivery.
17461 </para>
17462 </listitem></varlistentry>
17463 <varlistentry>
17464 <term><varname>$acl_m...</varname></term>
17465 <listitem>
17466 <para>
17467 These variables are like the <varname>$acl_c...</varname> variables, except that their values
17468 are reset after a message has been received. Thus, if several messages are
17469 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
17470 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
17471 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
17472 message is received, the values of these variables are saved with the message,
17473 and can be accessed by filters, routers, and transports during subsequent
17474 delivery.
17475 </para>
17476 </listitem></varlistentry>
17477 <varlistentry>
17478 <term><varname>$acl_narg</varname></term>
17479 <listitem>
17480 <para>
17481 Within an acl condition, expansion condition or expansion item
17482 this variable has the number of arguments.
17483 </para>
17484 </listitem></varlistentry>
17485 <varlistentry>
17486 <term><varname>$acl_verify_message</varname></term>
17487 <listitem>
17488 <para>
17489 <indexterm role="variable">
17490 <primary><varname>$acl_verify_message</varname></primary>
17491 </indexterm>
17492 After an address verification has failed, this variable contains the failure
17493 message. It retains its value for use in subsequent modifiers. The message can
17494 be preserved by coding like this:
17495 </para>
17496 <literallayout class="monospaced">
17497 warn !verify = sender
17498      set acl_m0 = $acl_verify_message
17499 </literallayout>
17500 <para>
17501 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
17502 <option>log_message</option> modifiers, to include information about the verification
17503 failure.
17504 </para>
17505 </listitem></varlistentry>
17506 <varlistentry>
17507 <term><varname>$address_data</varname></term>
17508 <listitem>
17509 <para>
17510 <indexterm role="variable">
17511 <primary><varname>$address_data</varname></primary>
17512 </indexterm>
17513 This variable is set by means of the <option>address_data</option> option in routers. The
17514 value then remains with the address while it is processed by subsequent routers
17515 and eventually a transport. If the transport is handling multiple addresses,
17516 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
17517 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
17518 user filter files.
17519 </para>
17520 <para>
17521 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
17522 a recipient address, the final value is still in the variable for subsequent
17523 conditions and modifiers of the ACL statement. If routing the address caused it
17524 to be redirected to just one address, the child address is also routed as part
17525 of the verification, and in this case the final value of <varname>$address_data</varname> is
17526 from the child&#x2019;s routing.
17527 </para>
17528 <para>
17529 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17530 sender address, the final value is also preserved, but this time in
17531 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
17532 address.
17533 </para>
17534 <para>
17535 In both cases (recipient and sender verification), the value does not persist
17536 after the end of the current ACL statement. If you want to preserve
17537 these values for longer, you can save them in ACL variables.
17538 </para>
17539 </listitem></varlistentry>
17540 <varlistentry>
17541 <term><varname>$address_file</varname></term>
17542 <listitem>
17543 <para>
17544 <indexterm role="variable">
17545 <primary><varname>$address_file</varname></primary>
17546 </indexterm>
17547 When, as a result of aliasing, forwarding, or filtering, a message is directed
17548 to a specific file, this variable holds the name of the file when the transport
17549 is running. At other times, the variable is empty. For example, using the
17550 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
17551 </para>
17552 <literallayout class="monospaced">
17553 /home/r2d2/savemail
17554 </literallayout>
17555 <para>
17556 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
17557 contains the text string <literal>/home/r2d2/savemail</literal>.
17558 <indexterm role="concept">
17559 <primary>Sieve filter</primary>
17560 <secondary>value of <varname>$address_file</varname></secondary>
17561 </indexterm>
17562 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
17563 then up to the transport configuration to generate an appropriate absolute path
17564 to the relevant file.
17565 </para>
17566 </listitem></varlistentry>
17567 <varlistentry>
17568 <term><varname>$address_pipe</varname></term>
17569 <listitem>
17570 <para>
17571 <indexterm role="variable">
17572 <primary><varname>$address_pipe</varname></primary>
17573 </indexterm>
17574 When, as a result of aliasing or forwarding, a message is directed to a pipe,
17575 this variable holds the pipe command when the transport is running.
17576 </para>
17577 </listitem></varlistentry>
17578 <varlistentry>
17579 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
17580 <listitem>
17581 <para>
17582 <indexterm role="variable">
17583 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
17584 </indexterm>
17585 These variables are used in SMTP authenticators (see chapters
17586 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
17587 </para>
17588 </listitem></varlistentry>
17589 <varlistentry>
17590 <term><varname>$authenticated_id</varname></term>
17591 <listitem>
17592 <para>
17593 <indexterm role="concept">
17594 <primary>authentication</primary>
17595 <secondary>id</secondary>
17596 </indexterm>
17597 <indexterm role="variable">
17598 <primary><varname>$authenticated_id</varname></primary>
17599 </indexterm>
17600 When a server successfully authenticates a client it may be configured to
17601 preserve some of the authentication information in the variable
17602 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
17603 user/password authenticator configuration might preserve the user name for use
17604 in the routers. Note that this is not the same information that is saved in
17605 <varname>$sender_host_authenticated</varname>.
17606 When a message is submitted locally (that is, not over a TCP connection)
17607 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
17608 process. However, a trusted user can override this by means of the <option>-oMai</option>
17609 command line option.
17610 </para>
17611 </listitem></varlistentry>
17612 <varlistentry>
17613 <term><varname>$authenticated_fail_id</varname></term>
17614 <listitem>
17615 <para>
17616 <indexterm role="concept">
17617 <primary>authentication</primary>
17618 <secondary>fail</secondary>
17619 </indexterm>
17620 <indexterm role="variable">
17621 <primary><varname>$authenticated_fail_id</varname></primary>
17622 </indexterm>
17623 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
17624 will contain the failed authentication id. If more than one authentication
17625 id is attempted, it will contain only the last one. The variable is
17626 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
17627 A message to a local recipient could still be accepted without requiring
17628 authentication, which means this variable could also be visible in all of
17629 the ACL&#x2019;s as well.
17630 </para>
17631 </listitem></varlistentry>
17632 <varlistentry>
17633 <term><varname>$authenticated_sender</varname></term>
17634 <listitem>
17635 <para>
17636 <indexterm role="concept">
17637 <primary>sender</primary>
17638 <secondary>authenticated</secondary>
17639 </indexterm>
17640 <indexterm role="concept">
17641 <primary>authentication</primary>
17642 <secondary>sender</secondary>
17643 </indexterm>
17644 <indexterm role="concept">
17645 <primary>AUTH</primary>
17646 <secondary>on MAIL command</secondary>
17647 </indexterm>
17648 <indexterm role="variable">
17649 <primary><varname>$authenticated_sender</varname></primary>
17650 </indexterm>
17651 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
17652 SMTP MAIL command if it believes the sender is sufficiently trusted, as
17653 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
17654 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
17655 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
17656 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
17657 </para>
17658 <para>
17659 <indexterm role="variable">
17660 <primary><varname>$qualify_domain</varname></primary>
17661 </indexterm>
17662 When a message is submitted locally (that is, not over a TCP connection), the
17663 value of <varname>$authenticated_sender</varname> is an address constructed from the login
17664 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
17665 can override this by means of the <option>-oMas</option> command line option.
17666 </para>
17667 </listitem></varlistentry>
17668 <varlistentry>
17669 <term><varname>$authentication_failed</varname></term>
17670 <listitem>
17671 <para>
17672 <indexterm role="concept">
17673 <primary>authentication</primary>
17674 <secondary>failure</secondary>
17675 </indexterm>
17676 <indexterm role="variable">
17677 <primary><varname>$authentication_failed</varname></primary>
17678 </indexterm>
17679 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
17680 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
17681 possible to distinguish between <quote>did not try to authenticate</quote>
17682 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
17683 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
17684 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
17685 negative response to an AUTH command, including (for example) an attempt to use
17686 an undefined mechanism.
17687 </para>
17688 </listitem></varlistentry>
17689 <varlistentry>
17690 <term><varname>$av_failed</varname></term>
17691 <listitem>
17692 <para>
17693 <indexterm role="concept">
17694 <primary>content scanning</primary>
17695 <secondary>AV scanner failure</secondary>
17696 </indexterm>
17697 This variable is available when Exim is compiled with the content-scanning
17698 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
17699 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
17700 the ACL malware condition.
17701 </para>
17702 </listitem></varlistentry>
17703 <varlistentry>
17704 <term><varname>$body_linecount</varname></term>
17705 <listitem>
17706 <para>
17707 <indexterm role="concept">
17708 <primary>message body</primary>
17709 <secondary>line count</secondary>
17710 </indexterm>
17711 <indexterm role="concept">
17712 <primary>body of message</primary>
17713 <secondary>line count</secondary>
17714 </indexterm>
17715 <indexterm role="variable">
17716 <primary><varname>$body_linecount</varname></primary>
17717 </indexterm>
17718 When a message is being received or delivered, this variable contains the
17719 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
17720 </para>
17721 </listitem></varlistentry>
17722 <varlistentry>
17723 <term><varname>$body_zerocount</varname></term>
17724 <listitem>
17725 <para>
17726 <indexterm role="concept">
17727 <primary>message body</primary>
17728 <secondary>binary zero count</secondary>
17729 </indexterm>
17730 <indexterm role="concept">
17731 <primary>body of message</primary>
17732 <secondary>binary zero count</secondary>
17733 </indexterm>
17734 <indexterm role="concept">
17735 <primary>binary zero</primary>
17736 <secondary>in message body</secondary>
17737 </indexterm>
17738 <indexterm role="variable">
17739 <primary><varname>$body_zerocount</varname></primary>
17740 </indexterm>
17741 When a message is being received or delivered, this variable contains the
17742 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
17743 </para>
17744 </listitem></varlistentry>
17745 <varlistentry>
17746 <term><varname>$bounce_recipient</varname></term>
17747 <listitem>
17748 <para>
17749 <indexterm role="variable">
17750 <primary><varname>$bounce_recipient</varname></primary>
17751 </indexterm>
17752 This is set to the recipient address of a bounce message while Exim is creating
17753 it. It is useful if a customized bounce message text file is in use (see
17754 chapter <xref linkend="CHAPemsgcust"/>).
17755 </para>
17756 </listitem></varlistentry>
17757 <varlistentry>
17758 <term><varname>$bounce_return_size_limit</varname></term>
17759 <listitem>
17760 <para>
17761 <indexterm role="variable">
17762 <primary><varname>$bounce_return_size_limit</varname></primary>
17763 </indexterm>
17764 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
17765 up to a multiple of 1000. It is useful when a customized error message text
17766 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
17767 </para>
17768 </listitem></varlistentry>
17769 <varlistentry>
17770 <term><varname>$caller_gid</varname></term>
17771 <listitem>
17772 <para>
17773 <indexterm role="concept">
17774 <primary>gid (group id)</primary>
17775 <secondary>caller</secondary>
17776 </indexterm>
17777 <indexterm role="variable">
17778 <primary><varname>$caller_gid</varname></primary>
17779 </indexterm>
17780 The real group id under which the process that called Exim was running. This is
17781 not the same as the group id of the originator of a message (see
17782 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
17783 incarnation normally contains the Exim gid.
17784 </para>
17785 </listitem></varlistentry>
17786 <varlistentry>
17787 <term><varname>$caller_uid</varname></term>
17788 <listitem>
17789 <para>
17790 <indexterm role="concept">
17791 <primary>uid (user id)</primary>
17792 <secondary>caller</secondary>
17793 </indexterm>
17794 <indexterm role="variable">
17795 <primary><varname>$caller_uid</varname></primary>
17796 </indexterm>
17797 The real user id under which the process that called Exim was running. This is
17798 not the same as the user id of the originator of a message (see
17799 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
17800 incarnation normally contains the Exim uid.
17801 </para>
17802 </listitem></varlistentry>
17803 <varlistentry>
17804 <term><varname>$callout_address</varname></term>
17805 <listitem>
17806 <para>
17807 <indexterm role="variable">
17808 <primary><varname>$callout_address</varname></primary>
17809 </indexterm>
17810 After a callout for verification, spamd or malware daemon service, the
17811 address that was connected to.
17812 </para>
17813 </listitem></varlistentry>
17814 <varlistentry>
17815 <term><varname>$compile_number</varname></term>
17816 <listitem>
17817 <para>
17818 <indexterm role="variable">
17819 <primary><varname>$compile_number</varname></primary>
17820 </indexterm>
17821 The building process for Exim keeps a count of the number
17822 of times it has been compiled. This serves to distinguish different
17823 compilations of the same version of the program.
17824 </para>
17825 </listitem></varlistentry>
17826 <varlistentry>
17827 <term><varname>$config_dir</varname></term>
17828 <listitem>
17829 <para>
17830 <indexterm role="variable">
17831 <primary><varname>$config_dir</varname></primary>
17832 </indexterm>
17833 The directory name of the main configuration file. That is, the content of
17834 <varname>$config_file</varname> with the last component stripped. The value does not
17835 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
17836 <varname>$config_dir</varname> is ".".
17837 </para>
17838 </listitem></varlistentry>
17839 <varlistentry>
17840 <term><varname>$config_file</varname></term>
17841 <listitem>
17842 <para>
17843 <indexterm role="variable">
17844 <primary><varname>$config_file</varname></primary>
17845 </indexterm>
17846 The name of the main configuration file Exim is using.
17847 </para>
17848 </listitem></varlistentry>
17849 <varlistentry>
17850 <term><varname>$dkim_cur_signer</varname></term>
17851 <term><varname>$dkim_verify_status</varname></term>
17852 <term><varname>$dkim_verify_reason</varname></term>
17853 <term><varname>$dkim_domain</varname></term>
17854 <term><varname>$dkim_identity</varname></term>
17855 <term><varname>$dkim_selector</varname></term>
17856 <term><varname>$dkim_algo</varname></term>
17857 <term><varname>$dkim_canon_body</varname></term>
17858 <term><varname>$dkim_canon_headers</varname></term>
17859 <term><varname>$dkim_copiedheaders</varname></term>
17860 <term><varname>$dkim_bodylength</varname></term>
17861 <term><varname>$dkim_created</varname></term>
17862 <term><varname>$dkim_expires</varname></term>
17863 <term><varname>$dkim_headernames</varname></term>
17864 <term><varname>$dkim_key_testing</varname></term>
17865 <term><varname>$dkim_key_nosubdomains</varname></term>
17866 <term><varname>$dkim_key_srvtype</varname></term>
17867 <term><varname>$dkim_key_granularity</varname></term>
17868 <term><varname>$dkim_key_notes</varname></term>
17869 <term><varname>$dkim_key_length</varname></term>
17870 <listitem>
17871 <para>
17872 These variables are only available within the DKIM ACL.
17873 For details see chapter <xref linkend="CHAPdkim"/>.
17874 </para>
17875 </listitem></varlistentry>
17876 <varlistentry>
17877 <term><varname>$dkim_signers</varname></term>
17878 <listitem>
17879 <para>
17880 <indexterm role="variable">
17881 <primary><varname>$dkim_signers</varname></primary>
17882 </indexterm>
17883 When a message has been received this variable contains
17884 a colon-separated list of signer domains and identities for the message.
17885 For details see chapter <xref linkend="CHAPdkim"/>.
17886 </para>
17887 </listitem></varlistentry>
17888 <varlistentry>
17889 <term><varname>$dnslist_domain</varname></term>
17890 <term><varname>$dnslist_matched</varname></term>
17891 <term><varname>$dnslist_text</varname></term>
17892 <term><varname>$dnslist_value</varname></term>
17893 <listitem>
17894 <para>
17895 <indexterm role="variable">
17896 <primary><varname>$dnslist_domain</varname></primary>
17897 </indexterm>
17898 <indexterm role="variable">
17899 <primary><varname>$dnslist_matched</varname></primary>
17900 </indexterm>
17901 <indexterm role="variable">
17902 <primary><varname>$dnslist_text</varname></primary>
17903 </indexterm>
17904 <indexterm role="variable">
17905 <primary><varname>$dnslist_value</varname></primary>
17906 </indexterm>
17907 <indexterm role="concept">
17908 <primary>black list (DNS)</primary>
17909 </indexterm>
17910 When a DNS (black) list lookup succeeds, these variables are set to contain
17911 the following data from the lookup: the list&#x2019;s domain name, the key that was
17912 looked up, the contents of any associated TXT record, and the value from the
17913 main A record. See section <xref linkend="SECID204"/> for more details.
17914 </para>
17915 </listitem></varlistentry>
17916 <varlistentry>
17917 <term><varname>$domain</varname></term>
17918 <listitem>
17919 <para>
17920 <indexterm role="variable">
17921 <primary><varname>$domain</varname></primary>
17922 </indexterm>
17923 When an address is being routed, or delivered on its own, this variable
17924 contains the domain. Uppercase letters in the domain are converted into lower
17925 case for <varname>$domain</varname>.
17926 </para>
17927 <para>
17928 Global address rewriting happens when a message is received, so the value of
17929 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
17930 is set during user filtering, but not during system filtering, because a
17931 message may have many recipients and the system filter is called just once.
17932 </para>
17933 <para>
17934 When more than one address is being delivered at once (for example, several
17935 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
17936 have the same domain. Transports can be restricted to handling only one domain
17937 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
17938 the default for local transports. For further details of the environment in
17939 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
17940 </para>
17941 <para>
17942 <indexterm role="option">
17943 <primary><option>delay_warning_condition</option></primary>
17944 </indexterm>
17945 At the end of a delivery, if all deferred addresses have the same domain, it is
17946 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
17947 </para>
17948 <para>
17949 The <varname>$domain</varname> variable is also used in some other circumstances:
17950 </para>
17951 <itemizedlist>
17952 <listitem>
17953 <para>
17954 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
17955 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
17956 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
17957 normally set during the running of the MAIL ACL. However, if the sender address
17958 is verified with a callout during the MAIL ACL, the sender domain is placed in
17959 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
17960 the <command>smtp</command> transport.
17961 </para>
17962 </listitem>
17963 <listitem>
17964 <para>
17965 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
17966 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
17967 it can be used in the expansion of the replacement address, for example, to
17968 rewrite domains by file lookup.
17969 </para>
17970 </listitem>
17971 <listitem>
17972 <para>
17973 With one important exception, whenever a domain list is being scanned,
17974 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
17975 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
17976 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
17977 that, in a RCPT ACL, the sender domain list can be dependent on the
17978 recipient domain (which is what is in <varname>$domain</varname> at this time).
17979 </para>
17980 </listitem>
17981 <listitem>
17982 <para>
17983 <indexterm role="concept">
17984 <primary>ETRN</primary>
17985 <secondary>value of <varname>$domain</varname></secondary>
17986 </indexterm>
17987 <indexterm role="option">
17988 <primary><option>smtp_etrn_command</option></primary>
17989 </indexterm>
17990 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
17991 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
17992 </para>
17993 </listitem>
17994 </itemizedlist>
17995 </listitem></varlistentry>
17996 <varlistentry>
17997 <term><varname>$domain_data</varname></term>
17998 <listitem>
17999 <para>
18000 <indexterm role="variable">
18001 <primary><varname>$domain_data</varname></primary>
18002 </indexterm>
18003 When the <option>domains</option> option on a router matches a domain by
18004 means of a lookup, the data read by the lookup is available during the running
18005 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
18006 address to a transport, the value is available in that transport. If the
18007 transport is handling multiple addresses, the value from the first address is
18008 used.
18009 </para>
18010 <para>
18011 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
18012 domain by means of a lookup. The data read by the lookup is available during
18013 the rest of the ACL statement. In all other situations, this variable expands
18014 to nothing.
18015 </para>
18016 </listitem></varlistentry>
18017 <varlistentry>
18018 <term><varname>$exim_gid</varname></term>
18019 <listitem>
18020 <para>
18021 <indexterm role="variable">
18022 <primary><varname>$exim_gid</varname></primary>
18023 </indexterm>
18024 This variable contains the numerical value of the Exim group id.
18025 </para>
18026 </listitem></varlistentry>
18027 <varlistentry>
18028 <term><varname>$exim_path</varname></term>
18029 <listitem>
18030 <para>
18031 <indexterm role="variable">
18032 <primary><varname>$exim_path</varname></primary>
18033 </indexterm>
18034 This variable contains the path to the Exim binary.
18035 </para>
18036 </listitem></varlistentry>
18037 <varlistentry>
18038 <term><varname>$exim_uid</varname></term>
18039 <listitem>
18040 <para>
18041 <indexterm role="variable">
18042 <primary><varname>$exim_uid</varname></primary>
18043 </indexterm>
18044 This variable contains the numerical value of the Exim user id.
18045 </para>
18046 </listitem></varlistentry>
18047 <varlistentry>
18048 <term><varname>$exim_version</varname></term>
18049 <listitem>
18050 <para>
18051 <indexterm role="variable">
18052 <primary><varname>$exim_version</varname></primary>
18053 </indexterm>
18054 This variable contains the version string of the Exim build.
18055 The first character is a major version number, currently 4.
18056 Then after a dot, the next group of digits is a minor version number.
18057 There may be other characters following the minor version.
18058 </para>
18059 </listitem></varlistentry>
18060 <varlistentry>
18061 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
18062 <listitem>
18063 <para>
18064 This is not strictly an expansion variable. It is expansion syntax for
18065 inserting the message header line with the given name. Note that the name must
18066 be terminated by colon or white space, because it may contain a wide variety of
18067 characters. Note also that braces must <emphasis>not</emphasis> be used.
18068 </para>
18069 </listitem></varlistentry>
18070 <varlistentry>
18071 <term><varname>$headers_added</varname></term>
18072 <listitem>
18073 <para>
18074 <indexterm role="variable">
18075 <primary><varname>$headers_added</varname></primary>
18076 </indexterm>
18077 Within an ACL this variable contains the headers added so far by
18078 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
18079 The headers are a newline-separated list.
18080 </para>
18081 </listitem></varlistentry>
18082 <varlistentry>
18083 <term><varname>$home</varname></term>
18084 <listitem>
18085 <para>
18086 <indexterm role="variable">
18087 <primary><varname>$home</varname></primary>
18088 </indexterm>
18089 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
18090 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
18091 means it is set during the running of users&#x2019; filter files. A router may also
18092 explicitly set a home directory for use by a transport; this can be overridden
18093 by a setting on the transport itself.
18094 </para>
18095 <para>
18096 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
18097 of the environment variable HOME, which is subject to the
18098 <option>keep_environment</option> and <option>add_environment</option> main config options.
18099 </para>
18100 </listitem></varlistentry>
18101 <varlistentry>
18102 <term><varname>$host</varname></term>
18103 <listitem>
18104 <para>
18105 <indexterm role="variable">
18106 <primary><varname>$host</varname></primary>
18107 </indexterm>
18108 If a router assigns an address to a transport (any transport), and passes a
18109 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
18110 to run is the name of the first host on the list. Note that this applies both
18111 to local and remote transports.
18112 </para>
18113 <para>
18114 <indexterm role="concept">
18115 <primary>transport</primary>
18116 <secondary>filter</secondary>
18117 </indexterm>
18118 <indexterm role="concept">
18119 <primary>filter</primary>
18120 <secondary>transport filter</secondary>
18121 </indexterm>
18122 For the <command>smtp</command> transport, if there is more than one host, the value of
18123 <varname>$host</varname> changes as the transport works its way through the list. In
18124 particular, when the <command>smtp</command> transport is expanding its options for encryption
18125 using TLS, or for specifying a transport filter (see chapter
18126 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
18127 is connected.
18128 </para>
18129 <para>
18130 When used in the client part of an authenticator configuration (see chapter
18131 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
18132 client is connected.
18133 </para>
18134 </listitem></varlistentry>
18135 <varlistentry>
18136 <term><varname>$host_address</varname></term>
18137 <listitem>
18138 <para>
18139 <indexterm role="variable">
18140 <primary><varname>$host_address</varname></primary>
18141 </indexterm>
18142 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
18143 for a remote connection. It is also set to the IP address that is being checked
18144 when the <option>ignore_target_hosts</option> option is being processed.
18145 </para>
18146 </listitem></varlistentry>
18147 <varlistentry>
18148 <term><varname>$host_data</varname></term>
18149 <listitem>
18150 <para>
18151 <indexterm role="variable">
18152 <primary><varname>$host_data</varname></primary>
18153 </indexterm>
18154 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
18155 result of the lookup is made available in the <varname>$host_data</varname> variable. This
18156 allows you, for example, to do things like this:
18157 </para>
18158 <literallayout class="monospaced">
18159 deny  hosts = net-lsearch;/some/file
18160 message = $host_data
18161 </literallayout>
18162 </listitem></varlistentry>
18163 <varlistentry>
18164 <term><varname>$host_lookup_deferred</varname></term>
18165 <listitem>
18166 <para>
18167 <indexterm role="concept">
18168 <primary>host name</primary>
18169 <secondary>lookup, failure of</secondary>
18170 </indexterm>
18171 <indexterm role="variable">
18172 <primary><varname>$host_lookup_deferred</varname></primary>
18173 </indexterm>
18174 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
18175 message comes from a remote host and there is an attempt to look up the host&#x2019;s
18176 name from its IP address, and the attempt is not successful, one of these
18177 variables is set to <quote>1</quote>.
18178 </para>
18179 <itemizedlist>
18180 <listitem>
18181 <para>
18182 If the lookup receives a definite negative response (for example, a DNS lookup
18183 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
18184 </para>
18185 </listitem>
18186 <listitem>
18187 <para>
18188 If there is any kind of problem during the lookup, such that Exim cannot
18189 tell whether or not the host name is defined (for example, a timeout for a DNS
18190 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
18191 </para>
18192 </listitem>
18193 </itemizedlist>
18194 <para>
18195 Looking up a host&#x2019;s name from its IP address consists of more than just a
18196 single reverse lookup. Exim checks that a forward lookup of at least one of the
18197 names it receives from a reverse lookup yields the original IP address. If this
18198 is not the case, Exim does not accept the looked up name(s), and
18199 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
18200 IP address (for example, the existence of a PTR record in the DNS) is not
18201 sufficient on its own for the success of a host name lookup. If the reverse
18202 lookup succeeds, but there is a lookup problem such as a timeout when checking
18203 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
18204 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
18205 </para>
18206 </listitem></varlistentry>
18207 <varlistentry>
18208 <term><varname>$host_lookup_failed</varname></term>
18209 <listitem>
18210 <para>
18211 <indexterm role="variable">
18212 <primary><varname>$host_lookup_failed</varname></primary>
18213 </indexterm>
18214 See <varname>$host_lookup_deferred</varname>.
18215 </para>
18216 </listitem></varlistentry>
18217 <varlistentry>
18218 <term><varname>$host_port</varname></term>
18219 <listitem>
18220 <para>
18221 <indexterm role="variable">
18222 <primary><varname>$host_port</varname></primary>
18223 </indexterm>
18224 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
18225 for an outbound connection.
18226 </para>
18227 </listitem></varlistentry>
18228 <varlistentry>
18229 <term><varname>$initial_cwd</varname></term>
18230 <listitem>
18231 <para>
18232 <indexterm role="variable">
18233 <primary><varname>$initial_cwd</varname></primary>
18234 </indexterm>
18235 This variable contains the full path name of the initial working
18236 directory of the current Exim process. This may differ from the current
18237 working directory, as Exim changes this to "/" during early startup, and
18238 to <varname>$spool_directory</varname> later.
18239 </para>
18240 </listitem></varlistentry>
18241 <varlistentry>
18242 <term><varname>$inode</varname></term>
18243 <listitem>
18244 <para>
18245 <indexterm role="variable">
18246 <primary><varname>$inode</varname></primary>
18247 </indexterm>
18248 The only time this variable is set is while expanding the <option>directory_file</option>
18249 option in the <command>appendfile</command> transport. The variable contains the inode number
18250 of the temporary file which is about to be renamed. It can be used to construct
18251 a unique name for the file.
18252 </para>
18253 </listitem></varlistentry>
18254 <varlistentry>
18255 <term><varname>$interface_address</varname></term>
18256 <listitem>
18257 <para>
18258 <indexterm role="variable">
18259 <primary><varname>$interface_address</varname></primary>
18260 </indexterm>
18261 This is an obsolete name for <varname>$received_ip_address</varname>.
18262 </para>
18263 </listitem></varlistentry>
18264 <varlistentry>
18265 <term><varname>$interface_port</varname></term>
18266 <listitem>
18267 <para>
18268 <indexterm role="variable">
18269 <primary><varname>$interface_port</varname></primary>
18270 </indexterm>
18271 This is an obsolete name for <varname>$received_port</varname>.
18272 </para>
18273 </listitem></varlistentry>
18274 <varlistentry>
18275 <term><varname>$item</varname></term>
18276 <listitem>
18277 <para>
18278 <indexterm role="variable">
18279 <primary><varname>$item</varname></primary>
18280 </indexterm>
18281 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
18282 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
18283 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
18284 empty.
18285 </para>
18286 </listitem></varlistentry>
18287 <varlistentry>
18288 <term><varname>$ldap_dn</varname></term>
18289 <listitem>
18290 <para>
18291 <indexterm role="variable">
18292 <primary><varname>$ldap_dn</varname></primary>
18293 </indexterm>
18294 This variable, which is available only when Exim is compiled with LDAP support,
18295 contains the DN from the last entry in the most recently successful LDAP
18296 lookup.
18297 </para>
18298 </listitem></varlistentry>
18299 <varlistentry>
18300 <term><varname>$load_average</varname></term>
18301 <listitem>
18302 <para>
18303 <indexterm role="variable">
18304 <primary><varname>$load_average</varname></primary>
18305 </indexterm>
18306 This variable contains the system load average, multiplied by 1000 so that it
18307 is an integer. For example, if the load average is 0.21, the value of the
18308 variable is 210. The value is recomputed every time the variable is referenced.
18309 </para>
18310 </listitem></varlistentry>
18311 <varlistentry>
18312 <term><varname>$local_part</varname></term>
18313 <listitem>
18314 <para>
18315 <indexterm role="variable">
18316 <primary><varname>$local_part</varname></primary>
18317 </indexterm>
18318 When an address is being routed, or delivered on its own, this
18319 variable contains the local part. When a number of addresses are being
18320 delivered together (for example, multiple RCPT commands in an SMTP
18321 session), <varname>$local_part</varname> is not set.
18322 </para>
18323 <para>
18324 Global address rewriting happens when a message is received, so the value of
18325 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
18326 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
18327 because a message may have many recipients and the system filter is called just
18328 once.
18329 </para>
18330 <para>
18331 <indexterm role="variable">
18332 <primary><varname>$local_part_prefix</varname></primary>
18333 </indexterm>
18334 <indexterm role="variable">
18335 <primary><varname>$local_part_suffix</varname></primary>
18336 </indexterm>
18337 If a local part prefix or suffix has been recognized, it is not included in the
18338 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
18339 any prefix or suffix are in <varname>$local_part_prefix</varname> and
18340 <varname>$local_part_suffix</varname>, respectively.
18341 </para>
18342 <para>
18343 When a message is being delivered to a file, pipe, or autoreply transport as a
18344 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
18345 the parent address, not to the file name or command (see <varname>$address_file</varname> and
18346 <varname>$address_pipe</varname>).
18347 </para>
18348 <para>
18349 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
18350 local part of the recipient address.
18351 </para>
18352 <para>
18353 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18354 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
18355 it can be used in the expansion of the replacement address, for example.
18356 </para>
18357 <para>
18358 In all cases, all quoting is removed from the local part. For example, for both
18359 the addresses
18360 </para>
18361 <literallayout class="monospaced">
18362 "abc:xyz"@test.example
18363 abc\:xyz@test.example
18364 </literallayout>
18365 <para>
18366 the value of <varname>$local_part</varname> is
18367 </para>
18368 <literallayout class="monospaced">
18369 abc:xyz
18370 </literallayout>
18371 <para>
18372 If you use <varname>$local_part</varname> to create another address, you should always wrap it
18373 inside a quoting operator. For example, in a <command>redirect</command> router you could
18374 have:
18375 </para>
18376 <literallayout class="monospaced">
18377 data = ${quote_local_part:$local_part}@new.domain.example
18378 </literallayout>
18379 <para>
18380 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
18381 to process local parts in a case-dependent manner in a router, you can set the
18382 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
18383 </para>
18384 </listitem></varlistentry>
18385 <varlistentry>
18386 <term><varname>$local_part_data</varname></term>
18387 <listitem>
18388 <para>
18389 <indexterm role="variable">
18390 <primary><varname>$local_part_data</varname></primary>
18391 </indexterm>
18392 When the <option>local_parts</option> option on a router matches a local part by means of a
18393 lookup, the data read by the lookup is available during the running of the
18394 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
18395 to a transport, the value is available in that transport. If the transport is
18396 handling multiple addresses, the value from the first address is used.
18397 </para>
18398 <para>
18399 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
18400 matches a local part by means of a lookup. The data read by the lookup is
18401 available during the rest of the ACL statement. In all other situations, this
18402 variable expands to nothing.
18403 </para>
18404 </listitem></varlistentry>
18405 <varlistentry>
18406 <term><varname>$local_part_prefix</varname></term>
18407 <listitem>
18408 <para>
18409 <indexterm role="variable">
18410 <primary><varname>$local_part_prefix</varname></primary>
18411 </indexterm>
18412 When an address is being routed or delivered, and a
18413 specific prefix for the local part was recognized, it is available in this
18414 variable, having been removed from <varname>$local_part</varname>.
18415 </para>
18416 </listitem></varlistentry>
18417 <varlistentry>
18418 <term><varname>$local_part_suffix</varname></term>
18419 <listitem>
18420 <para>
18421 <indexterm role="variable">
18422 <primary><varname>$local_part_suffix</varname></primary>
18423 </indexterm>
18424 When an address is being routed or delivered, and a
18425 specific suffix for the local part was recognized, it is available in this
18426 variable, having been removed from <varname>$local_part</varname>.
18427 </para>
18428 </listitem></varlistentry>
18429 <varlistentry>
18430 <term><varname>$local_scan_data</varname></term>
18431 <listitem>
18432 <para>
18433 <indexterm role="variable">
18434 <primary><varname>$local_scan_data</varname></primary>
18435 </indexterm>
18436 This variable contains the text returned by the <function>local_scan()</function> function when
18437 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
18438 </para>
18439 </listitem></varlistentry>
18440 <varlistentry>
18441 <term><varname>$local_user_gid</varname></term>
18442 <listitem>
18443 <para>
18444 <indexterm role="variable">
18445 <primary><varname>$local_user_gid</varname></primary>
18446 </indexterm>
18447 See <varname>$local_user_uid</varname>.
18448 </para>
18449 </listitem></varlistentry>
18450 <varlistentry>
18451 <term><varname>$local_user_uid</varname></term>
18452 <listitem>
18453 <para>
18454 <indexterm role="variable">
18455 <primary><varname>$local_user_uid</varname></primary>
18456 </indexterm>
18457 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
18458 <option>check_local_user</option> router precondition succeeds. This means that their values
18459 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
18460 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
18461 router-specific expansions. At all other times, the values in these variables
18462 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
18463 </para>
18464 </listitem></varlistentry>
18465 <varlistentry>
18466 <term><varname>$localhost_number</varname></term>
18467 <listitem>
18468 <para>
18469 <indexterm role="variable">
18470 <primary><varname>$localhost_number</varname></primary>
18471 </indexterm>
18472 This contains the expanded value of the
18473 <option>localhost_number</option> option. The expansion happens after the main options have
18474 been read.
18475 </para>
18476 </listitem></varlistentry>
18477 <varlistentry>
18478 <term><varname>$log_inodes</varname></term>
18479 <listitem>
18480 <para>
18481 <indexterm role="variable">
18482 <primary><varname>$log_inodes</varname></primary>
18483 </indexterm>
18484 The number of free inodes in the disk partition where Exim&#x2019;s
18485 log files are being written. The value is recalculated whenever the variable is
18486 referenced. If the relevant file system does not have the concept of inodes,
18487 the value of is -1. See also the <option>check_log_inodes</option> option.
18488 </para>
18489 </listitem></varlistentry>
18490 <varlistentry>
18491 <term><varname>$log_space</varname></term>
18492 <listitem>
18493 <para>
18494 <indexterm role="variable">
18495 <primary><varname>$log_space</varname></primary>
18496 </indexterm>
18497 The amount of free space (as a number of kilobytes) in the disk
18498 partition where Exim&#x2019;s log files are being written. The value is recalculated
18499 whenever the variable is referenced. If the operating system does not have the
18500 ability to find the amount of free space (only true for experimental systems),
18501 the space value is -1. See also the <option>check_log_space</option> option.
18502 </para>
18503 </listitem></varlistentry>
18504 <varlistentry>
18505 <term><varname>$lookup_dnssec_authenticated</varname></term>
18506 <listitem>
18507 <para>
18508 <indexterm role="variable">
18509 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
18510 </indexterm>
18511 This variable is set after a DNS lookup done by
18512 a dnsdb lookup expansion, dnslookup router or smtp transport.
18513 <indexterm role="concept">
18514 <primary>DNS</primary>
18515 <secondary>DNSSEC</secondary>
18516 </indexterm>
18517 It will be empty if <command>DNSSEC</command> was not requested,
18518 <quote>no</quote> if the result was not labelled as authenticated data
18519 and <quote>yes</quote> if it was.
18520 Results that are labelled as authoritative answer that match
18521 the <option>dns_trust_aa</option> configuration variable count also
18522 as authenticated data.
18523 </para>
18524 </listitem></varlistentry>
18525 <varlistentry>
18526 <term><varname>$mailstore_basename</varname></term>
18527 <listitem>
18528 <para>
18529 <indexterm role="variable">
18530 <primary><varname>$mailstore_basename</varname></primary>
18531 </indexterm>
18532 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
18533 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
18534 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
18535 contains the basename of the files that are being written, that is, the name
18536 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
18537 variable is empty.
18538 </para>
18539 </listitem></varlistentry>
18540 <varlistentry>
18541 <term><varname>$malware_name</varname></term>
18542 <listitem>
18543 <para>
18544 <indexterm role="variable">
18545 <primary><varname>$malware_name</varname></primary>
18546 </indexterm>
18547 This variable is available when Exim is compiled with the
18548 content-scanning extension. It is set to the name of the virus that was found
18549 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
18550 </para>
18551 </listitem></varlistentry>
18552 <varlistentry>
18553 <term><varname>$max_received_linelength</varname></term>
18554 <listitem>
18555 <para>
18556 <indexterm role="variable">
18557 <primary><varname>$max_received_linelength</varname></primary>
18558 </indexterm>
18559 <indexterm role="concept">
18560 <primary>maximum</primary>
18561 <secondary>line length</secondary>
18562 </indexterm>
18563 <indexterm role="concept">
18564 <primary>line length</primary>
18565 <secondary>maximum</secondary>
18566 </indexterm>
18567 This variable contains the number of bytes in the longest line that was
18568 received as part of the message, not counting the line termination
18569 character(s).
18570 </para>
18571 </listitem></varlistentry>
18572 <varlistentry>
18573 <term><varname>$message_age</varname></term>
18574 <listitem>
18575 <para>
18576 <indexterm role="concept">
18577 <primary>message</primary>
18578 <secondary>age of</secondary>
18579 </indexterm>
18580 <indexterm role="variable">
18581 <primary><varname>$message_age</varname></primary>
18582 </indexterm>
18583 This variable is set at the start of a delivery attempt to contain the number
18584 of seconds since the message was received. It does not change during a single
18585 delivery attempt.
18586 </para>
18587 </listitem></varlistentry>
18588 <varlistentry>
18589 <term><varname>$message_body</varname></term>
18590 <listitem>
18591 <para>
18592 <indexterm role="concept">
18593 <primary>body of message</primary>
18594 <secondary>expansion variable</secondary>
18595 </indexterm>
18596 <indexterm role="concept">
18597 <primary>message body</primary>
18598 <secondary>in expansion</secondary>
18599 </indexterm>
18600 <indexterm role="concept">
18601 <primary>binary zero</primary>
18602 <secondary>in message body</secondary>
18603 </indexterm>
18604 <indexterm role="variable">
18605 <primary><varname>$message_body</varname></primary>
18606 </indexterm>
18607 <indexterm role="option">
18608 <primary><option>message_body_visible</option></primary>
18609 </indexterm>
18610 This variable contains the initial portion of a message&#x2019;s body while it is
18611 being delivered, and is intended mainly for use in filter files. The maximum
18612 number of characters of the body that are put into the variable is set by the
18613 <option>message_body_visible</option> configuration option; the default is 500.
18614 </para>
18615 <para>
18616 <indexterm role="option">
18617 <primary><option>message_body_newlines</option></primary>
18618 </indexterm>
18619 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
18620 easier to search for phrases that might be split over a line break. However,
18621 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
18622 zeros are always converted into spaces.
18623 </para>
18624 </listitem></varlistentry>
18625 <varlistentry>
18626 <term><varname>$message_body_end</varname></term>
18627 <listitem>
18628 <para>
18629 <indexterm role="concept">
18630 <primary>body of message</primary>
18631 <secondary>expansion variable</secondary>
18632 </indexterm>
18633 <indexterm role="concept">
18634 <primary>message body</primary>
18635 <secondary>in expansion</secondary>
18636 </indexterm>
18637 <indexterm role="variable">
18638 <primary><varname>$message_body_end</varname></primary>
18639 </indexterm>
18640 This variable contains the final portion of a message&#x2019;s
18641 body while it is being delivered. The format and maximum size are as for
18642 <varname>$message_body</varname>.
18643 </para>
18644 </listitem></varlistentry>
18645 <varlistentry>
18646 <term><varname>$message_body_size</varname></term>
18647 <listitem>
18648 <para>
18649 <indexterm role="concept">
18650 <primary>body of message</primary>
18651 <secondary>size</secondary>
18652 </indexterm>
18653 <indexterm role="concept">
18654 <primary>message body</primary>
18655 <secondary>size</secondary>
18656 </indexterm>
18657 <indexterm role="variable">
18658 <primary><varname>$message_body_size</varname></primary>
18659 </indexterm>
18660 When a message is being delivered, this variable contains the size of the body
18661 in bytes. The count starts from the character after the blank line that
18662 separates the body from the header. Newlines are included in the count. See
18663 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18664 </para>
18665 </listitem></varlistentry>
18666 <varlistentry>
18667 <term><varname>$message_exim_id</varname></term>
18668 <listitem>
18669 <para>
18670 <indexterm role="variable">
18671 <primary><varname>$message_exim_id</varname></primary>
18672 </indexterm>
18673 When a message is being received or delivered, this variable contains the
18674 unique message id that is generated and used by Exim to identify the message.
18675 An id is not created for a message until after its header has been successfully
18676 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
18677 line; it is the local id that Exim assigns to the message, for example:
18678 <literal>1BXTIK-0001yO-VA</literal>.
18679 </para>
18680 </listitem></varlistentry>
18681 <varlistentry>
18682 <term><varname>$message_headers</varname></term>
18683 <listitem>
18684 <para>
18685 <indexterm role="variable">
18686 <primary><varname>$message_headers</varname></primary>
18687 </indexterm>
18688 This variable contains a concatenation of all the header lines when a message
18689 is being processed, except for lines added by routers or transports. The header
18690 lines are separated by newline characters. Their contents are decoded in the
18691 same way as a header line that is inserted by <option>bheader</option>.
18692 </para>
18693 </listitem></varlistentry>
18694 <varlistentry>
18695 <term><varname>$message_headers_raw</varname></term>
18696 <listitem>
18697 <para>
18698 <indexterm role="variable">
18699 <primary><varname>$message_headers_raw</varname></primary>
18700 </indexterm>
18701 This variable is like <varname>$message_headers</varname> except that no processing of the
18702 contents of header lines is done.
18703 </para>
18704 </listitem></varlistentry>
18705 <varlistentry>
18706 <term><varname>$message_id</varname></term>
18707 <listitem>
18708 <para>
18709 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
18710 </para>
18711 </listitem></varlistentry>
18712 <varlistentry>
18713 <term><varname>$message_linecount</varname></term>
18714 <listitem>
18715 <para>
18716 <indexterm role="variable">
18717 <primary><varname>$message_linecount</varname></primary>
18718 </indexterm>
18719 This variable contains the total number of lines in the header and body of the
18720 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
18721 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
18722 number of lines received. Before delivery happens (that is, before filters,
18723 routers, and transports run) the count is increased to include the
18724 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
18725 lines that are added by ACLs. The blank line that separates the message header
18726 from the body is not counted.
18727 </para>
18728 <para>
18729 As with the special case of <varname>$message_size</varname>, during the expansion of the
18730 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
18731 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
18732 file that has been written (minus one for the blank line between the
18733 header and the body).
18734 </para>
18735 <para>
18736 Here is an example of the use of this variable in a DATA ACL:
18737 </para>
18738 <literallayout class="monospaced">
18739 deny message   = Too many lines in message header
18740      condition = \
18741       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
18742 </literallayout>
18743 <para>
18744 In the MAIL and RCPT ACLs, the value is zero because at that stage the
18745 message has not yet been received.
18746 </para>
18747 </listitem></varlistentry>
18748 <varlistentry>
18749 <term><varname>$message_size</varname></term>
18750 <listitem>
18751 <para>
18752 <indexterm role="concept">
18753 <primary>size</primary>
18754 <secondary>of message</secondary>
18755 </indexterm>
18756 <indexterm role="concept">
18757 <primary>message</primary>
18758 <secondary>size</secondary>
18759 </indexterm>
18760 <indexterm role="variable">
18761 <primary><varname>$message_size</varname></primary>
18762 </indexterm>
18763 When a message is being processed, this variable contains its size in bytes. In
18764 most cases, the size includes those headers that were received with the
18765 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
18766 deliveries as they are written. However, there is one special case: during the
18767 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
18768 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
18769 precise size of the file that has been written. See also
18770 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
18771 </para>
18772 <para>
18773 <indexterm role="concept">
18774 <primary>RCPT</primary>
18775 <secondary>value of <varname>$message_size</varname></secondary>
18776 </indexterm>
18777 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
18778 contains the size supplied on the MAIL command, or -1 if no size was given. The
18779 value may not, of course, be truthful.
18780 </para>
18781 </listitem></varlistentry>
18782 <varlistentry>
18783 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
18784 <listitem>
18785 <para>
18786 A number of variables whose names start with <varname>$mime</varname> are
18787 available when Exim is compiled with the content-scanning extension. For
18788 details, see section <xref linkend="SECTscanmimepart"/>.
18789 </para>
18790 </listitem></varlistentry>
18791 <varlistentry>
18792 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
18793 <listitem>
18794 <para>
18795 These variables are counters that can be incremented by means
18796 of the <option>add</option> command in filter files.
18797 </para>
18798 </listitem></varlistentry>
18799 <varlistentry>
18800 <term><varname>$original_domain</varname></term>
18801 <listitem>
18802 <para>
18803 <indexterm role="variable">
18804 <primary><varname>$domain</varname></primary>
18805 </indexterm>
18806 <indexterm role="variable">
18807 <primary><varname>$original_domain</varname></primary>
18808 </indexterm>
18809 When a top-level address is being processed for delivery, this contains the
18810 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
18811 generated by an alias, forward, or filter file) is being processed, this
18812 variable contains the domain of the original address (lower cased). This
18813 differs from <varname>$parent_domain</varname> only when there is more than one level of
18814 aliasing or forwarding. When more than one address is being delivered in a
18815 single transport run, <varname>$original_domain</varname> is not set.
18816 </para>
18817 <para>
18818 If a new address is created by means of a <option>deliver</option> command in a system
18819 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18820 part <emphasis>system-filter</emphasis> and the default qualify domain.
18821 </para>
18822 </listitem></varlistentry>
18823 <varlistentry>
18824 <term><varname>$original_local_part</varname></term>
18825 <listitem>
18826 <para>
18827 <indexterm role="variable">
18828 <primary><varname>$local_part</varname></primary>
18829 </indexterm>
18830 <indexterm role="variable">
18831 <primary><varname>$original_local_part</varname></primary>
18832 </indexterm>
18833 When a top-level address is being processed for delivery, this contains the
18834 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
18835 local part, because <varname>$original_local_part</varname> always contains the full local
18836 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
18837 filter file) is being processed, this variable contains the full local part of
18838 the original address.
18839 </para>
18840 <para>
18841 If the router that did the redirection processed the local part
18842 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
18843 This variable differs from <varname>$parent_local_part</varname> only when there is more than
18844 one level of aliasing or forwarding. When more than one address is being
18845 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
18846 </para>
18847 <para>
18848 If a new address is created by means of a <option>deliver</option> command in a system
18849 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
18850 part <emphasis>system-filter</emphasis> and the default qualify domain.
18851 </para>
18852 </listitem></varlistentry>
18853 <varlistentry>
18854 <term><varname>$originator_gid</varname></term>
18855 <listitem>
18856 <para>
18857 <indexterm role="concept">
18858 <primary>gid (group id)</primary>
18859 <secondary>of originating user</secondary>
18860 </indexterm>
18861 <indexterm role="concept">
18862 <primary>sender</primary>
18863 <secondary>gid</secondary>
18864 </indexterm>
18865 <indexterm role="variable">
18866 <primary><varname>$caller_gid</varname></primary>
18867 </indexterm>
18868 <indexterm role="variable">
18869 <primary><varname>$originator_gid</varname></primary>
18870 </indexterm>
18871 This variable contains the value of <varname>$caller_gid</varname> that was set when the
18872 message was received. For messages received via the command line, this is the
18873 gid of the sending user. For messages received by SMTP over TCP/IP, this is
18874 normally the gid of the Exim user.
18875 </para>
18876 </listitem></varlistentry>
18877 <varlistentry>
18878 <term><varname>$originator_uid</varname></term>
18879 <listitem>
18880 <para>
18881 <indexterm role="concept">
18882 <primary>uid (user id)</primary>
18883 <secondary>of originating user</secondary>
18884 </indexterm>
18885 <indexterm role="concept">
18886 <primary>sender</primary>
18887 <secondary>uid</secondary>
18888 </indexterm>
18889 <indexterm role="variable">
18890 <primary><varname>$caller_uid</varname></primary>
18891 </indexterm>
18892 <indexterm role="variable">
18893 <primary><varname>$originator_uid</varname></primary>
18894 </indexterm>
18895 The value of <varname>$caller_uid</varname> that was set when the message was received. For
18896 messages received via the command line, this is the uid of the sending user.
18897 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
18898 user.
18899 </para>
18900 </listitem></varlistentry>
18901 <varlistentry>
18902 <term><varname>$parent_domain</varname></term>
18903 <listitem>
18904 <para>
18905 <indexterm role="variable">
18906 <primary><varname>$parent_domain</varname></primary>
18907 </indexterm>
18908 This variable is similar to <varname>$original_domain</varname> (see
18909 above), except that it refers to the immediately preceding parent address.
18910 </para>
18911 </listitem></varlistentry>
18912 <varlistentry>
18913 <term><varname>$parent_local_part</varname></term>
18914 <listitem>
18915 <para>
18916 <indexterm role="variable">
18917 <primary><varname>$parent_local_part</varname></primary>
18918 </indexterm>
18919 This variable is similar to <varname>$original_local_part</varname>
18920 (see above), except that it refers to the immediately preceding parent address.
18921 </para>
18922 </listitem></varlistentry>
18923 <varlistentry>
18924 <term><varname>$pid</varname></term>
18925 <listitem>
18926 <para>
18927 <indexterm role="concept">
18928 <primary>pid (process id)</primary>
18929 <secondary>of current process</secondary>
18930 </indexterm>
18931 <indexterm role="variable">
18932 <primary><varname>$pid</varname></primary>
18933 </indexterm>
18934 This variable contains the current process id.
18935 </para>
18936 </listitem></varlistentry>
18937 <varlistentry>
18938 <term><varname>$pipe_addresses</varname></term>
18939 <listitem>
18940 <para>
18941 <indexterm role="concept">
18942 <primary>filter</primary>
18943 <secondary>transport filter</secondary>
18944 </indexterm>
18945 <indexterm role="concept">
18946 <primary>transport</primary>
18947 <secondary>filter</secondary>
18948 </indexterm>
18949 <indexterm role="variable">
18950 <primary><varname>$pipe_addresses</varname></primary>
18951 </indexterm>
18952 This is not an expansion variable, but is mentioned here because the string
18953 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
18954 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
18955 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
18956 It cannot be used in general expansion strings, and provokes an <quote>unknown
18957 variable</quote> error if encountered.
18958 </para>
18959 </listitem></varlistentry>
18960 <varlistentry>
18961 <term><varname>$primary_hostname</varname></term>
18962 <listitem>
18963 <para>
18964 <indexterm role="variable">
18965 <primary><varname>$primary_hostname</varname></primary>
18966 </indexterm>
18967 This variable contains the value set by <option>primary_hostname</option> in the
18968 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
18969 a single-component name, Exim calls <function>gethostbyname()</function> (or
18970 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
18971 qualified host name. See also <varname>$smtp_active_hostname</varname>.
18972 </para>
18973 </listitem></varlistentry>
18974 <varlistentry>
18975 <term><varname>$proxy_external_address</varname></term>
18976 <term><varname>$proxy_external_port</varname></term>
18977 <term><varname>$proxy_local_address</varname></term>
18978 <term><varname>$proxy_local_port</varname></term>
18979 <term><varname>$proxy_session</varname></term>
18980 <listitem>
18981 <para>
18982 These variables are only available when built with Proxy Protocol
18983 or SOCKS5 support.
18984 For details see chapter <xref linkend="SECTproxyInbound"/>.
18985 </para>
18986 </listitem></varlistentry>
18987 <varlistentry>
18988 <term><varname>$prdr_requested</varname></term>
18989 <listitem>
18990 <para>
18991 <indexterm role="concept">
18992 <primary>PRDR</primary>
18993 <secondary>variable for</secondary>
18994 </indexterm>
18995 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
18996 current message, otherwise <quote>no</quote>.
18997 </para>
18998 </listitem></varlistentry>
18999 <varlistentry>
19000 <term><varname>$prvscheck_address</varname></term>
19001 <listitem>
19002 <para>
19003 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19004 which is described in sections <xref linkend="SECTexpansionitems"/> and
19005 <xref linkend="SECTverifyPRVS"/>.
19006 </para>
19007 </listitem></varlistentry>
19008 <varlistentry>
19009 <term><varname>$prvscheck_keynum</varname></term>
19010 <listitem>
19011 <para>
19012 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19013 which is described in sections <xref linkend="SECTexpansionitems"/> and
19014 <xref linkend="SECTverifyPRVS"/>.
19015 </para>
19016 </listitem></varlistentry>
19017 <varlistentry>
19018 <term><varname>$prvscheck_result</varname></term>
19019 <listitem>
19020 <para>
19021 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
19022 which is described in sections <xref linkend="SECTexpansionitems"/> and
19023 <xref linkend="SECTverifyPRVS"/>.
19024 </para>
19025 </listitem></varlistentry>
19026 <varlistentry>
19027 <term><varname>$qualify_domain</varname></term>
19028 <listitem>
19029 <para>
19030 <indexterm role="variable">
19031 <primary><varname>$qualify_domain</varname></primary>
19032 </indexterm>
19033 The value set for the <option>qualify_domain</option> option in the configuration file.
19034 </para>
19035 </listitem></varlistentry>
19036 <varlistentry>
19037 <term><varname>$qualify_recipient</varname></term>
19038 <listitem>
19039 <para>
19040 <indexterm role="variable">
19041 <primary><varname>$qualify_recipient</varname></primary>
19042 </indexterm>
19043 The value set for the <option>qualify_recipient</option> option in the configuration file,
19044 or if not set, the value of <varname>$qualify_domain</varname>.
19045 </para>
19046 </listitem></varlistentry>
19047 <varlistentry>
19048 <term><varname>$queue_name</varname></term>
19049 <listitem>
19050 <para>
19051 <indexterm role="variable">
19052 <primary><varname>$queue_name</varname></primary>
19053 </indexterm>
19054 <indexterm role="concept">
19055 <primary>named queues</primary>
19056 </indexterm>
19057 <indexterm role="concept">
19058 <primary>queues</primary>
19059 <secondary>named</secondary>
19060 </indexterm>
19061 The name of the spool queue in use; empty for the default queue.
19062 </para>
19063 </listitem></varlistentry>
19064 <varlistentry>
19065 <term><varname>$rcpt_count</varname></term>
19066 <listitem>
19067 <para>
19068 <indexterm role="variable">
19069 <primary><varname>$rcpt_count</varname></primary>
19070 </indexterm>
19071 When a message is being received by SMTP, this variable contains the number of
19072 RCPT commands received for the current message. If this variable is used in a
19073 RCPT ACL, its value includes the current command.
19074 </para>
19075 </listitem></varlistentry>
19076 <varlistentry>
19077 <term><varname>$rcpt_defer_count</varname></term>
19078 <listitem>
19079 <para>
19080 <indexterm role="variable">
19081 <primary><varname>$rcpt_defer_count</varname></primary>
19082 </indexterm>
19083 <indexterm role="concept">
19084 <primary>4<emphasis>xx</emphasis> responses</primary>
19085 <secondary>count of</secondary>
19086 </indexterm>
19087 When a message is being received by SMTP, this variable contains the number of
19088 RCPT commands in the current message that have previously been rejected with a
19089 temporary (4<emphasis>xx</emphasis>) response.
19090 </para>
19091 </listitem></varlistentry>
19092 <varlistentry>
19093 <term><varname>$rcpt_fail_count</varname></term>
19094 <listitem>
19095 <para>
19096 <indexterm role="variable">
19097 <primary><varname>$rcpt_fail_count</varname></primary>
19098 </indexterm>
19099 When a message is being received by SMTP, this variable contains the number of
19100 RCPT commands in the current message that have previously been rejected with a
19101 permanent (5<emphasis>xx</emphasis>) response.
19102 </para>
19103 </listitem></varlistentry>
19104 <varlistentry>
19105 <term><varname>$received_count</varname></term>
19106 <listitem>
19107 <para>
19108 <indexterm role="variable">
19109 <primary><varname>$received_count</varname></primary>
19110 </indexterm>
19111 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
19112 including the one added by Exim (so its value is always greater than zero). It
19113 is available in the DATA ACL, the non-SMTP ACL, and while routing and
19114 delivering.
19115 </para>
19116 </listitem></varlistentry>
19117 <varlistentry>
19118 <term><varname>$received_for</varname></term>
19119 <listitem>
19120 <para>
19121 <indexterm role="variable">
19122 <primary><varname>$received_for</varname></primary>
19123 </indexterm>
19124 If there is only a single recipient address in an incoming message, this
19125 variable contains that address when the <emphasis>Received:</emphasis> header line is being
19126 built. The value is copied after recipient rewriting has happened, but before
19127 the <function>local_scan()</function> function is run.
19128 </para>
19129 </listitem></varlistentry>
19130 <varlistentry>
19131 <term><varname>$received_ip_address</varname></term>
19132 <listitem>
19133 <para>
19134 <indexterm role="variable">
19135 <primary><varname>$received_ip_address</varname></primary>
19136 </indexterm>
19137 As soon as an Exim server starts processing an incoming TCP/IP connection, this
19138 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
19139 is set to the local port number. (The remote IP address and port are in
19140 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
19141 the port value is -1 unless it has been set using the <option>-oMi</option> command line
19142 option.
19143 </para>
19144 <para>
19145 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
19146 could be used, for example, to make the file name for a TLS certificate depend
19147 on which interface and/or port is being used for the incoming connection. The
19148 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
19149 messages that are received, thus making these variables available at delivery
19150 time.
19151 For outbound connections see <varname>$sending_ip_address</varname>.
19152 </para>
19153 </listitem></varlistentry>
19154 <varlistentry>
19155 <term><varname>$received_port</varname></term>
19156 <listitem>
19157 <para>
19158 <indexterm role="variable">
19159 <primary><varname>$received_port</varname></primary>
19160 </indexterm>
19161 See <varname>$received_ip_address</varname>.
19162 </para>
19163 </listitem></varlistentry>
19164 <varlistentry>
19165 <term><varname>$received_protocol</varname></term>
19166 <listitem>
19167 <para>
19168 <indexterm role="variable">
19169 <primary><varname>$received_protocol</varname></primary>
19170 </indexterm>
19171 When a message is being processed, this variable contains the name of the
19172 protocol by which it was received. Most of the names used by Exim are defined
19173 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
19174 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
19175 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
19176 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
19177 connection and the client was successfully authenticated.
19178 </para>
19179 <para>
19180 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
19181 automatically set up on connection without the use of STARTTLS (see
19182 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
19183 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
19184 where the client initially uses EHLO, sets up an encrypted connection using
19185 STARTTLS, and then uses HELO afterwards.
19186 </para>
19187 <para>
19188 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
19189 messages that are injected locally by trusted callers. This is commonly used to
19190 identify messages that are being re-injected after some kind of scanning.
19191 </para>
19192 </listitem></varlistentry>
19193 <varlistentry>
19194 <term><varname>$received_time</varname></term>
19195 <listitem>
19196 <para>
19197 <indexterm role="variable">
19198 <primary><varname>$received_time</varname></primary>
19199 </indexterm>
19200 This variable contains the date and time when the current message was received,
19201 as a number of seconds since the start of the Unix epoch.
19202 </para>
19203 </listitem></varlistentry>
19204 <varlistentry>
19205 <term><varname>$recipient_data</varname></term>
19206 <listitem>
19207 <para>
19208 <indexterm role="variable">
19209 <primary><varname>$recipient_data</varname></primary>
19210 </indexterm>
19211 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
19212 condition. It contains the data from the lookup, and the value remains set
19213 until the next <option>recipients</option> test. Thus, you can do things like this:
19214 </para>
19215 <literallayout>
19216 <literal>require recipients  = cdb*@;/some/file</literal>
19217 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
19218 </literallayout>
19219 <para>
19220 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19221 method in the address list, using the semicolon syntax as in the example above.
19222 The variable is not set for a lookup that is used as part of the string
19223 expansion that all such lists undergo before being interpreted.
19224 </para>
19225 </listitem></varlistentry>
19226 <varlistentry>
19227 <term><varname>$recipient_verify_failure</varname></term>
19228 <listitem>
19229 <para>
19230 <indexterm role="variable">
19231 <primary><varname>$recipient_verify_failure</varname></primary>
19232 </indexterm>
19233 In an ACL, when a recipient verification fails, this variable contains
19234 information about the failure. It is set to one of the following words:
19235 </para>
19236 <itemizedlist>
19237 <listitem>
19238 <para>
19239 <quote>qualify</quote>: The address was unqualified (no domain), and the message
19240 was neither local nor came from an exempted host.
19241 </para>
19242 </listitem>
19243 <listitem>
19244 <para>
19245 <quote>route</quote>: Routing failed.
19246 </para>
19247 </listitem>
19248 <listitem>
19249 <para>
19250 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
19251 or before the MAIL command (that is, on initial connection, HELO, or
19252 MAIL).
19253 </para>
19254 </listitem>
19255 <listitem>
19256 <para>
19257 <quote>recipient</quote>: The RCPT command in a callout was rejected.
19258 </para>
19259 </listitem>
19260 <listitem>
19261 <para>
19262 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
19263 </para>
19264 </listitem>
19265 </itemizedlist>
19266 <para>
19267 The main use of this variable is expected to be to distinguish between
19268 rejections of MAIL and rejections of RCPT.
19269 </para>
19270 </listitem></varlistentry>
19271 <varlistentry>
19272 <term><varname>$recipients</varname></term>
19273 <listitem>
19274 <para>
19275 <indexterm role="variable">
19276 <primary><varname>$recipients</varname></primary>
19277 </indexterm>
19278 This variable contains a list of envelope recipients for a message. A comma and
19279 a space separate the addresses in the replacement text. However, the variable
19280 is not generally available, to prevent exposure of Bcc recipients in
19281 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
19282 cases:
19283 </para>
19284 <orderedlist numeration="arabic">
19285 <listitem>
19286 <para>
19287 In a system filter file.
19288 </para>
19289 </listitem>
19290 <listitem>
19291 <para>
19292 In the ACLs associated with the DATA command and with non-SMTP messages, that
19293 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
19294 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
19295 <option>acl_not_smtp_mime</option>.
19296 </para>
19297 </listitem>
19298 <listitem>
19299 <para>
19300 From within a <function>local_scan()</function> function.
19301 </para>
19302 </listitem>
19303 </orderedlist>
19304 </listitem></varlistentry>
19305 <varlistentry>
19306 <term><varname>$recipients_count</varname></term>
19307 <listitem>
19308 <para>
19309 <indexterm role="variable">
19310 <primary><varname>$recipients_count</varname></primary>
19311 </indexterm>
19312 When a message is being processed, this variable contains the number of
19313 envelope recipients that came with the message. Duplicates are not excluded
19314 from the count. While a message is being received over SMTP, the number
19315 increases for each accepted recipient. It can be referenced in an ACL.
19316 </para>
19317 </listitem></varlistentry>
19318 <varlistentry>
19319 <term><varname>$regex_match_string</varname></term>
19320 <listitem>
19321 <para>
19322 <indexterm role="variable">
19323 <primary><varname>$regex_match_string</varname></primary>
19324 </indexterm>
19325 This variable is set to contain the matching regular expression after a
19326 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
19327 </para>
19328 </listitem></varlistentry>
19329 <varlistentry>
19330 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
19331 <listitem>
19332 <para>
19333 <indexterm role="concept">
19334 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
19335 </indexterm>
19336 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
19337 these variables contain the
19338 captured substrings identified by the regular expression.
19339 </para>
19340 </listitem></varlistentry>
19341 <varlistentry>
19342 <term><varname>$reply_address</varname></term>
19343 <listitem>
19344 <para>
19345 <indexterm role="variable">
19346 <primary><varname>$reply_address</varname></primary>
19347 </indexterm>
19348 When a message is being processed, this variable contains the contents of the
19349 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
19350 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
19351 white space, the value is not processed in any way. In particular, no RFC 2047
19352 decoding or character code translation takes place.
19353 </para>
19354 </listitem></varlistentry>
19355 <varlistentry>
19356 <term><varname>$return_path</varname></term>
19357 <listitem>
19358 <para>
19359 <indexterm role="variable">
19360 <primary><varname>$return_path</varname></primary>
19361 </indexterm>
19362 When a message is being delivered, this variable contains the return path &ndash;
19363 the sender field that will be sent as part of the envelope. It is not enclosed
19364 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
19365 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
19366 mailing list has been expanded by a router which specifies a different address
19367 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
19368 address, whereas <varname>$sender_address</varname> always contains the original sender address
19369 that was received with the message. In other words, <varname>$sender_address</varname> contains
19370 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
19371 envelope sender.
19372 </para>
19373 </listitem></varlistentry>
19374 <varlistentry>
19375 <term><varname>$return_size_limit</varname></term>
19376 <listitem>
19377 <para>
19378 <indexterm role="variable">
19379 <primary><varname>$return_size_limit</varname></primary>
19380 </indexterm>
19381 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
19382 </para>
19383 </listitem></varlistentry>
19384 <varlistentry>
19385 <term><varname>$router_name</varname></term>
19386 <listitem>
19387 <para>
19388 <indexterm role="concept">
19389 <primary>router</primary>
19390 <secondary>name</secondary>
19391 </indexterm>
19392 <indexterm role="concept">
19393 <primary>name</primary>
19394 <secondary>of router</secondary>
19395 </indexterm>
19396 <indexterm role="variable">
19397 <primary><varname>$router_name</varname></primary>
19398 </indexterm>
19399 During the running of a router this variable contains its name.
19400 </para>
19401 </listitem></varlistentry>
19402 <varlistentry>
19403 <term><varname>$runrc</varname></term>
19404 <listitem>
19405 <para>
19406 <indexterm role="concept">
19407 <primary>return code</primary>
19408 <secondary>from <option>run</option> expansion</secondary>
19409 </indexterm>
19410 <indexterm role="variable">
19411 <primary><varname>$runrc</varname></primary>
19412 </indexterm>
19413 This variable contains the return code from a command that is run by the
19414 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
19415 assume the order in which option values are expanded, except for those
19416 preconditions whose order of testing is documented. Therefore, you cannot
19417 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
19418 another.
19419 </para>
19420 </listitem></varlistentry>
19421 <varlistentry>
19422 <term><varname>$self_hostname</varname></term>
19423 <listitem>
19424 <para>
19425 <indexterm role="option">
19426 <primary><option>self</option></primary>
19427 <secondary>value of host name</secondary>
19428 </indexterm>
19429 <indexterm role="variable">
19430 <primary><varname>$self_hostname</varname></primary>
19431 </indexterm>
19432 When an address is routed to a supposedly remote host that turns out to be the
19433 local host, what happens is controlled by the <option>self</option> generic router option.
19434 One of its values causes the address to be passed to another router. When this
19435 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
19436 original router encountered. In other circumstances its contents are null.
19437 </para>
19438 </listitem></varlistentry>
19439 <varlistentry>
19440 <term><varname>$sender_address</varname></term>
19441 <listitem>
19442 <para>
19443 <indexterm role="variable">
19444 <primary><varname>$sender_address</varname></primary>
19445 </indexterm>
19446 When a message is being processed, this variable contains the sender&#x2019;s address
19447 that was received in the message&#x2019;s envelope. The case of letters in the address
19448 is retained, in both the local part and the domain. For bounce messages, the
19449 value of this variable is the empty string. See also <varname>$return_path</varname>.
19450 </para>
19451 </listitem></varlistentry>
19452 <varlistentry>
19453 <term><varname>$sender_address_data</varname></term>
19454 <listitem>
19455 <para>
19456 <indexterm role="variable">
19457 <primary><varname>$address_data</varname></primary>
19458 </indexterm>
19459 <indexterm role="variable">
19460 <primary><varname>$sender_address_data</varname></primary>
19461 </indexterm>
19462 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
19463 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
19464 distinguish it from data from a recipient address. The value does not persist
19465 after the end of the current ACL statement. If you want to preserve it for
19466 longer, you can save it in an ACL variable.
19467 </para>
19468 </listitem></varlistentry>
19469 <varlistentry>
19470 <term><varname>$sender_address_domain</varname></term>
19471 <listitem>
19472 <para>
19473 <indexterm role="variable">
19474 <primary><varname>$sender_address_domain</varname></primary>
19475 </indexterm>
19476 The domain portion of <varname>$sender_address</varname>.
19477 </para>
19478 </listitem></varlistentry>
19479 <varlistentry>
19480 <term><varname>$sender_address_local_part</varname></term>
19481 <listitem>
19482 <para>
19483 <indexterm role="variable">
19484 <primary><varname>$sender_address_local_part</varname></primary>
19485 </indexterm>
19486 The local part portion of <varname>$sender_address</varname>.
19487 </para>
19488 </listitem></varlistentry>
19489 <varlistentry>
19490 <term><varname>$sender_data</varname></term>
19491 <listitem>
19492 <para>
19493 <indexterm role="variable">
19494 <primary><varname>$sender_data</varname></primary>
19495 </indexterm>
19496 This variable is set after a lookup success in an ACL <option>senders</option> condition or
19497 in a router <option>senders</option> option. It contains the data from the lookup, and the
19498 value remains set until the next <option>senders</option> test. Thus, you can do things like
19499 this:
19500 </para>
19501 <literallayout>
19502 <literal>require senders      = cdb*@;/some/file</literal>
19503 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
19504 </literallayout>
19505 <para>
19506 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
19507 method in the address list, using the semicolon syntax as in the example above.
19508 The variable is not set for a lookup that is used as part of the string
19509 expansion that all such lists undergo before being interpreted.
19510 </para>
19511 </listitem></varlistentry>
19512 <varlistentry>
19513 <term><varname>$sender_fullhost</varname></term>
19514 <listitem>
19515 <para>
19516 <indexterm role="variable">
19517 <primary><varname>$sender_fullhost</varname></primary>
19518 </indexterm>
19519 When a message is received from a remote host, this variable contains the host
19520 name and IP address in a single string. It ends with the IP address in square
19521 brackets, followed by a colon and a port number if the logging of ports is
19522 enabled. The format of the rest of the string depends on whether the host
19523 issued a HELO or EHLO SMTP command, and whether the host name was verified by
19524 looking up its IP address. (Looking up the IP address can be forced by the
19525 <option>host_lookup</option> option, independent of verification.) A plain host name at the
19526 start of the string is a verified host name; if this is not present,
19527 verification either failed or was not requested. A host name in parentheses is
19528 the argument of a HELO or EHLO command. This is omitted if it is identical to
19529 the verified host name or to the host&#x2019;s IP address in square brackets.
19530 </para>
19531 </listitem></varlistentry>
19532 <varlistentry>
19533 <term><varname>$sender_helo_dnssec</varname></term>
19534 <listitem>
19535 <para>
19536 <indexterm role="variable">
19537 <primary><varname>$sender_helo_dnssec</varname></primary>
19538 </indexterm>
19539 This boolean variable is true if a successful HELO verification was
19540 <indexterm role="concept">
19541 <primary>DNS</primary>
19542 <secondary>DNSSEC</secondary>
19543 </indexterm>
19544 done using DNS information the resolver library stated was authenticated data.
19545 </para>
19546 </listitem></varlistentry>
19547 <varlistentry>
19548 <term><varname>$sender_helo_name</varname></term>
19549 <listitem>
19550 <para>
19551 <indexterm role="variable">
19552 <primary><varname>$sender_helo_name</varname></primary>
19553 </indexterm>
19554 When a message is received from a remote host that has issued a HELO or EHLO
19555 command, the argument of that command is placed in this variable. It is also
19556 set if HELO or EHLO is used when a message is received using SMTP locally via
19557 the <option>-bs</option> or <option>-bS</option> options.
19558 </para>
19559 </listitem></varlistentry>
19560 <varlistentry>
19561 <term><varname>$sender_host_address</varname></term>
19562 <listitem>
19563 <para>
19564 <indexterm role="variable">
19565 <primary><varname>$sender_host_address</varname></primary>
19566 </indexterm>
19567 When a message is received from a remote host using SMTP,
19568 this variable contains that
19569 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
19570 </para>
19571 </listitem></varlistentry>
19572 <varlistentry>
19573 <term><varname>$sender_host_authenticated</varname></term>
19574 <listitem>
19575 <para>
19576 <indexterm role="variable">
19577 <primary><varname>$sender_host_authenticated</varname></primary>
19578 </indexterm>
19579 This variable contains the name (not the public name) of the authenticator
19580 driver that successfully authenticated the client from which the message was
19581 received. It is empty if there was no successful authentication. See also
19582 <varname>$authenticated_id</varname>.
19583 </para>
19584 </listitem></varlistentry>
19585 <varlistentry>
19586 <term><varname>$sender_host_dnssec</varname></term>
19587 <listitem>
19588 <para>
19589 <indexterm role="variable">
19590 <primary><varname>$sender_host_dnssec</varname></primary>
19591 </indexterm>
19592 If an attempt to populate <varname>$sender_host_name</varname> has been made
19593 (by reference, <option>hosts_lookup</option> or
19594 otherwise) then this boolean will have been set true if, and only if, the
19595 resolver library states that both
19596 the reverse and forward DNS were authenticated data.  At all
19597 other times, this variable is false.
19598 </para>
19599 <para>
19600 <indexterm role="concept">
19601 <primary>DNS</primary>
19602 <secondary>DNSSEC</secondary>
19603 </indexterm>
19604 It is likely that you will need to coerce DNSSEC support on in the resolver
19605 library, by setting:
19606 </para>
19607 <literallayout class="monospaced">
19608 dns_dnssec_ok = 1
19609 </literallayout>
19610 <para>
19611 Exim does not perform DNSSEC validation itself, instead leaving that to a
19612 validating resolver (e.g. unbound, or bind with suitable configuration).
19613 </para>
19614 <para>
19615 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
19616 mechanism in the list, then this variable will be false.
19617 </para>
19618 <para revisionflag="changed">
19619 This requires that your system resolver library support EDNS0 (and that
19620 DNSSEC flags exist in the system headers).  If the resolver silently drops
19621 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
19622 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
19623 </para>
19624 </listitem></varlistentry>
19625 <varlistentry>
19626 <term><varname>$sender_host_name</varname></term>
19627 <listitem>
19628 <para>
19629 <indexterm role="variable">
19630 <primary><varname>$sender_host_name</varname></primary>
19631 </indexterm>
19632 When a message is received from a remote host, this variable contains the
19633 host&#x2019;s name as obtained by looking up its IP address. For messages received by
19634 other means, this variable is empty.
19635 </para>
19636 <para>
19637 <indexterm role="variable">
19638 <primary><varname>$host_lookup_failed</varname></primary>
19639 </indexterm>
19640 If the host name has not previously been looked up, a reference to
19641 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
19642 A looked up name is accepted only if it leads back to the original IP address
19643 via a forward lookup. If either the reverse or the forward lookup fails to find
19644 any data, or if the forward lookup does not yield the original IP address,
19645 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19646 </para>
19647 <para>
19648 <indexterm role="variable">
19649 <primary><varname>$host_lookup_deferred</varname></primary>
19650 </indexterm>
19651 However, if either of the lookups cannot be completed (for example, there is a
19652 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
19653 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
19654 </para>
19655 <para>
19656 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
19657 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
19658 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
19659 is set to <quote>1</quote>.
19660 </para>
19661 <para>
19662 Exim does not automatically look up every calling host&#x2019;s name. If you want
19663 maximum efficiency, you should arrange your configuration so that it avoids
19664 these lookups altogether. The lookup happens only if one or more of the
19665 following are true:
19666 </para>
19667 <itemizedlist>
19668 <listitem>
19669 <para>
19670 A string containing <varname>$sender_host_name</varname> is expanded.
19671 </para>
19672 </listitem>
19673 <listitem>
19674 <para>
19675 The calling host matches the list in <option>host_lookup</option>. In the default
19676 configuration, this option is set to *, so it must be changed if lookups are
19677 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
19678 </para>
19679 </listitem>
19680 <listitem>
19681 <para>
19682 Exim needs the host name in order to test an item in a host list. The items
19683 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
19684 <xref linkend="SECThoslispatnamsk"/>.
19685 </para>
19686 </listitem>
19687 <listitem>
19688 <para>
19689 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
19690 In this case, the host name is required to compare with the name quoted in any
19691 EHLO or HELO commands that the client issues.
19692 </para>
19693 </listitem>
19694 <listitem>
19695 <para>
19696 The remote host issues a EHLO or HELO command that quotes one of the
19697 domains in <option>helo_lookup_domains</option>. The default value of this option is
19698 </para>
19699 <literallayout class="monospaced">
19700   helo_lookup_domains = @ : @[]
19701 </literallayout>
19702 <para>
19703 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
19704 IP address in an EHLO or HELO command.
19705 </para>
19706 </listitem>
19707 </itemizedlist>
19708 </listitem></varlistentry>
19709 <varlistentry>
19710 <term><varname>$sender_host_port</varname></term>
19711 <listitem>
19712 <para>
19713 <indexterm role="variable">
19714 <primary><varname>$sender_host_port</varname></primary>
19715 </indexterm>
19716 When a message is received from a remote host, this variable contains the port
19717 number that was used on the remote host.
19718 </para>
19719 </listitem></varlistentry>
19720 <varlistentry>
19721 <term><varname>$sender_ident</varname></term>
19722 <listitem>
19723 <para>
19724 <indexterm role="variable">
19725 <primary><varname>$sender_ident</varname></primary>
19726 </indexterm>
19727 When a message is received from a remote host, this variable contains the
19728 identification received in response to an RFC 1413 request. When a message has
19729 been received locally, this variable contains the login name of the user that
19730 called Exim.
19731 </para>
19732 </listitem></varlistentry>
19733 <varlistentry>
19734 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
19735 <listitem>
19736 <para>
19737 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
19738 <option>ratelimit</option> ACL condition. Details are given in section
19739 <xref linkend="SECTratelimiting"/>.
19740 </para>
19741 </listitem></varlistentry>
19742 <varlistentry>
19743 <term><varname>$sender_rcvhost</varname></term>
19744 <listitem>
19745 <para>
19746 <indexterm role="concept">
19747 <primary>DNS</primary>
19748 <secondary>reverse lookup</secondary>
19749 </indexterm>
19750 <indexterm role="concept">
19751 <primary>reverse DNS lookup</primary>
19752 </indexterm>
19753 <indexterm role="variable">
19754 <primary><varname>$sender_rcvhost</varname></primary>
19755 </indexterm>
19756 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
19757 either the verified host name (as obtained from a reverse DNS lookup) or, if
19758 there is no verified host name, the IP address in square brackets. After that
19759 there may be text in parentheses. When the first item is a verified host name,
19760 the first thing in the parentheses is the IP address in square brackets,
19761 followed by a colon and a port number if port logging is enabled. When the
19762 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
19763 the parentheses.
19764 </para>
19765 <para>
19766 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
19767 was used and its argument was not identical to the real host name or IP
19768 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
19769 all three items are present in the parentheses, a newline and tab are inserted
19770 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
19771 </para>
19772 </listitem></varlistentry>
19773 <varlistentry>
19774 <term><varname>$sender_verify_failure</varname></term>
19775 <listitem>
19776 <para>
19777 <indexterm role="variable">
19778 <primary><varname>$sender_verify_failure</varname></primary>
19779 </indexterm>
19780 In an ACL, when a sender verification fails, this variable contains information
19781 about the failure. The details are the same as for
19782 <varname>$recipient_verify_failure</varname>.
19783 </para>
19784 </listitem></varlistentry>
19785 <varlistentry>
19786 <term><varname>$sending_ip_address</varname></term>
19787 <listitem>
19788 <para>
19789 <indexterm role="variable">
19790 <primary><varname>$sending_ip_address</varname></primary>
19791 </indexterm>
19792 This variable is set whenever an outgoing SMTP connection to another host has
19793 been set up. It contains the IP address of the local interface that is being
19794 used. This is useful if a host that has more than one IP address wants to take
19795 on different personalities depending on which one is being used. For incoming
19796 connections, see <varname>$received_ip_address</varname>.
19797 </para>
19798 </listitem></varlistentry>
19799 <varlistentry>
19800 <term><varname>$sending_port</varname></term>
19801 <listitem>
19802 <para>
19803 <indexterm role="variable">
19804 <primary><varname>$sending_port</varname></primary>
19805 </indexterm>
19806 This variable is set whenever an outgoing SMTP connection to another host has
19807 been set up. It contains the local port that is being used. For incoming
19808 connections, see <varname>$received_port</varname>.
19809 </para>
19810 </listitem></varlistentry>
19811 <varlistentry>
19812 <term><varname>$smtp_active_hostname</varname></term>
19813 <listitem>
19814 <para>
19815 <indexterm role="variable">
19816 <primary><varname>$smtp_active_hostname</varname></primary>
19817 </indexterm>
19818 During an incoming SMTP session, this variable contains the value of the active
19819 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
19820 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
19821 value can be consulted during routing and delivery.
19822 </para>
19823 </listitem></varlistentry>
19824 <varlistentry>
19825 <term><varname>$smtp_command</varname></term>
19826 <listitem>
19827 <para>
19828 <indexterm role="variable">
19829 <primary><varname>$smtp_command</varname></primary>
19830 </indexterm>
19831 During the processing of an incoming SMTP command, this variable contains the
19832 entire command. This makes it possible to distinguish between HELO and EHLO in
19833 the HELO ACL, and also to distinguish between commands such as these:
19834 </para>
19835 <literallayout class="monospaced">
19836 MAIL FROM:&lt;&gt;
19837 MAIL FROM: &lt;&gt;
19838 </literallayout>
19839 <para>
19840 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
19841 command, the address in <varname>$smtp_command</varname> is the original address before any
19842 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
19843 the address after SMTP-time rewriting.
19844 </para>
19845 </listitem></varlistentry>
19846 <varlistentry>
19847 <term><varname>$smtp_command_argument</varname></term>
19848 <listitem>
19849 <para>
19850 <indexterm role="concept">
19851 <primary>SMTP</primary>
19852 <secondary>command, argument for</secondary>
19853 </indexterm>
19854 <indexterm role="variable">
19855 <primary><varname>$smtp_command_argument</varname></primary>
19856 </indexterm>
19857 While an ACL is running to check an SMTP command, this variable contains the
19858 argument, that is, the text that follows the command name, with leading white
19859 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
19860 somewhat redundant, but is retained for backwards compatibility.
19861 </para>
19862 </listitem></varlistentry>
19863 <varlistentry>
19864 <term><varname>$smtp_count_at_connection_start</varname></term>
19865 <listitem>
19866 <para>
19867 <indexterm role="variable">
19868 <primary><varname>$smtp_count_at_connection_start</varname></primary>
19869 </indexterm>
19870 This variable is set greater than zero only in processes spawned by the Exim
19871 daemon for handling incoming SMTP connections. The name is deliberately long,
19872 in order to emphasize what the contents are. When the daemon accepts a new
19873 connection, it increments this variable. A copy of the variable is passed to
19874 the child process that handles the connection, but its value is fixed, and
19875 never changes. It is only an approximation of how many incoming connections
19876 there actually are, because many other connections may come and go while a
19877 single connection is being processed. When a child process terminates, the
19878 daemon decrements its copy of the variable.
19879 </para>
19880 </listitem></varlistentry>
19881 <varlistentry>
19882 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
19883 <listitem>
19884 <para>
19885 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
19886 that were current at the end of the system filter file. This allows a system
19887 filter file to set values that can be tested in users&#x2019; filter files. For
19888 example, a system filter could set a value indicating how likely it is that a
19889 message is junk mail.
19890 </para>
19891 </listitem></varlistentry>
19892 <varlistentry>
19893 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
19894 <listitem>
19895 <para>
19896 A number of variables whose names start with <varname>$spam</varname> are available when Exim
19897 is compiled with the content-scanning extension. For details, see section
19898 <xref linkend="SECTscanspamass"/>.
19899 </para>
19900 </listitem></varlistentry>
19901 <varlistentry>
19902 <term><varname>$spool_directory</varname></term>
19903 <listitem>
19904 <para>
19905 <indexterm role="variable">
19906 <primary><varname>$spool_directory</varname></primary>
19907 </indexterm>
19908 The name of Exim&#x2019;s spool directory.
19909 </para>
19910 </listitem></varlistentry>
19911 <varlistentry>
19912 <term><varname>$spool_inodes</varname></term>
19913 <listitem>
19914 <para>
19915 <indexterm role="variable">
19916 <primary><varname>$spool_inodes</varname></primary>
19917 </indexterm>
19918 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
19919 being written. The value is recalculated whenever the variable is referenced.
19920 If the relevant file system does not have the concept of inodes, the value of
19921 is -1. See also the <option>check_spool_inodes</option> option.
19922 </para>
19923 </listitem></varlistentry>
19924 <varlistentry>
19925 <term><varname>$spool_space</varname></term>
19926 <listitem>
19927 <para>
19928 <indexterm role="variable">
19929 <primary><varname>$spool_space</varname></primary>
19930 </indexterm>
19931 The amount of free space (as a number of kilobytes) in the disk partition where
19932 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
19933 variable is referenced. If the operating system does not have the ability to
19934 find the amount of free space (only true for experimental systems), the space
19935 value is -1. For example, to check in an ACL that there is at least 50
19936 megabytes free on the spool, you could write:
19937 </para>
19938 <literallayout class="monospaced">
19939 condition = ${if &gt; {$spool_space}{50000}}
19940 </literallayout>
19941 <para>
19942 See also the <option>check_spool_space</option> option.
19943 </para>
19944 </listitem></varlistentry>
19945 <varlistentry>
19946 <term><varname>$thisaddress</varname></term>
19947 <listitem>
19948 <para>
19949 <indexterm role="variable">
19950 <primary><varname>$thisaddress</varname></primary>
19951 </indexterm>
19952 This variable is set only during the processing of the <option>foranyaddress</option>
19953 command in a filter file. Its use is explained in the description of that
19954 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
19955 interfaces to mail filtering</emphasis>.
19956 </para>
19957 </listitem></varlistentry>
19958 <varlistentry>
19959 <term><varname>$tls_in_bits</varname></term>
19960 <listitem>
19961 <para>
19962 <indexterm role="variable">
19963 <primary><varname>$tls_in_bits</varname></primary>
19964 </indexterm>
19965 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19966 on the inbound connection; the meaning of
19967 this depends upon the TLS implementation used.
19968 If TLS has not been negotiated, the value will be 0.
19969 The value of this is automatically fed into the Cyrus SASL authenticator
19970 when acting as a server, to specify the "external SSF" (a SASL term).
19971 </para>
19972 <para>
19973 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
19974 except when used in the context of an outbound SMTP delivery, when it refers to
19975 the outbound.
19976 </para>
19977 </listitem></varlistentry>
19978 <varlistentry>
19979 <term><varname>$tls_out_bits</varname></term>
19980 <listitem>
19981 <para>
19982 <indexterm role="variable">
19983 <primary><varname>$tls_out_bits</varname></primary>
19984 </indexterm>
19985 Contains an approximation of the TLS cipher&#x2019;s bit-strength
19986 on an outbound SMTP connection; the meaning of
19987 this depends upon the TLS implementation used.
19988 If TLS has not been negotiated, the value will be 0.
19989 </para>
19990 </listitem></varlistentry>
19991 <varlistentry>
19992 <term><varname>$tls_in_ourcert</varname></term>
19993 <listitem>
19994 <para>
19995 <indexterm role="variable">
19996 <primary><varname>$tls_in_ourcert</varname></primary>
19997 </indexterm>
19998 <indexterm role="concept">
19999 <primary>certificate</primary>
20000 <secondary>variables</secondary>
20001 </indexterm>
20002 This variable refers to the certificate presented to the peer of an
20003 inbound connection when the message was received.
20004 It is only useful as the argument of a
20005 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20006 or a <option>def</option> condition.
20007 </para>
20008 </listitem></varlistentry>
20009 <varlistentry>
20010 <term><varname>$tls_in_peercert</varname></term>
20011 <listitem>
20012 <para>
20013 <indexterm role="variable">
20014 <primary><varname>$tls_in_peercert</varname></primary>
20015 </indexterm>
20016 This variable refers to the certificate presented by the peer of an
20017 inbound connection when the message was received.
20018 It is only useful as the argument of a
20019 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20020 or a <option>def</option> condition.
20021 If certificate verification fails it may refer to a failing chain element
20022 which is not the leaf.
20023 </para>
20024 </listitem></varlistentry>
20025 <varlistentry>
20026 <term><varname>$tls_out_ourcert</varname></term>
20027 <listitem>
20028 <para>
20029 <indexterm role="variable">
20030 <primary><varname>$tls_out_ourcert</varname></primary>
20031 </indexterm>
20032 This variable refers to the certificate presented to the peer of an
20033 outbound connection.  It is only useful as the argument of a
20034 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20035 or a <option>def</option> condition.
20036 </para>
20037 </listitem></varlistentry>
20038 <varlistentry>
20039 <term><varname>$tls_out_peercert</varname></term>
20040 <listitem>
20041 <para>
20042 <indexterm role="variable">
20043 <primary><varname>$tls_out_peercert</varname></primary>
20044 </indexterm>
20045 This variable refers to the certificate presented by the peer of an
20046 outbound connection.  It is only useful as the argument of a
20047 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
20048 or a <option>def</option> condition.
20049 If certificate verification fails it may refer to a failing chain element
20050 which is not the leaf.
20051 </para>
20052 </listitem></varlistentry>
20053 <varlistentry>
20054 <term><varname>$tls_in_certificate_verified</varname></term>
20055 <listitem>
20056 <para>
20057 <indexterm role="variable">
20058 <primary><varname>$tls_in_certificate_verified</varname></primary>
20059 </indexterm>
20060 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
20061 message was received, and <quote>0</quote> otherwise.
20062 </para>
20063 <para>
20064 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
20065 except when used in the context of an outbound SMTP delivery, when it refers to
20066 the outbound.
20067 </para>
20068 </listitem></varlistentry>
20069 <varlistentry>
20070 <term><varname>$tls_out_certificate_verified</varname></term>
20071 <listitem>
20072 <para>
20073 <indexterm role="variable">
20074 <primary><varname>$tls_out_certificate_verified</varname></primary>
20075 </indexterm>
20076 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
20077 outbound SMTP connection was made,
20078 and <quote>0</quote> otherwise.
20079 </para>
20080 </listitem></varlistentry>
20081 <varlistentry>
20082 <term><varname>$tls_in_cipher</varname></term>
20083 <listitem>
20084 <para>
20085 <indexterm role="variable">
20086 <primary><varname>$tls_in_cipher</varname></primary>
20087 </indexterm>
20088 <indexterm role="variable">
20089 <primary><varname>$tls_cipher</varname></primary>
20090 </indexterm>
20091 When a message is received from a remote host over an encrypted SMTP
20092 connection, this variable is set to the cipher suite that was negotiated, for
20093 example DES-CBC3-SHA. In other circumstances, in particular, for message
20094 received over unencrypted connections, the variable is empty. Testing
20095 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
20096 non-encrypted connections during ACL processing.
20097 </para>
20098 <para>
20099 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
20100 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
20101 becomes the same as <varname>$tls_out_cipher</varname>.
20102 </para>
20103 </listitem></varlistentry>
20104 <varlistentry>
20105 <term><varname>$tls_out_cipher</varname></term>
20106 <listitem>
20107 <para>
20108 <indexterm role="variable">
20109 <primary><varname>$tls_out_cipher</varname></primary>
20110 </indexterm>
20111 This variable is
20112 cleared before any outgoing SMTP connection is made,
20113 and then set to the outgoing cipher suite if one is negotiated. See chapter
20114 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
20115 details of the <command>smtp</command> transport.
20116 </para>
20117 </listitem></varlistentry>
20118 <varlistentry>
20119 <term><varname>$tls_in_ocsp</varname></term>
20120 <listitem>
20121 <para>
20122 <indexterm role="variable">
20123 <primary><varname>$tls_in_ocsp</varname></primary>
20124 </indexterm>
20125 When a message is received from a remote client connection
20126 the result of any OCSP request from the client is encoded in this variable:
20127 </para>
20128 <literallayout class="monospaced">
20129 0 OCSP proof was not requested (default value)
20130 1 No response to request
20131 2 Response not verified
20132 3 Verification failed
20133 4 Verification succeeded
20134 </literallayout>
20135 </listitem></varlistentry>
20136 <varlistentry>
20137 <term><varname>$tls_out_ocsp</varname></term>
20138 <listitem>
20139 <para>
20140 <indexterm role="variable">
20141 <primary><varname>$tls_out_ocsp</varname></primary>
20142 </indexterm>
20143 When a message is sent to a remote host connection
20144 the result of any OCSP request made is encoded in this variable.
20145 See <varname>$tls_in_ocsp</varname> for values.
20146 </para>
20147 </listitem></varlistentry>
20148 <varlistentry>
20149 <term><varname>$tls_in_peerdn</varname></term>
20150 <listitem>
20151 <para>
20152 <indexterm role="variable">
20153 <primary><varname>$tls_in_peerdn</varname></primary>
20154 </indexterm>
20155 <indexterm role="variable">
20156 <primary><varname>$tls_peerdn</varname></primary>
20157 </indexterm>
20158 <indexterm role="concept">
20159 <primary>certificate</primary>
20160 <secondary>extracting fields</secondary>
20161 </indexterm>
20162 When a message is received from a remote host over an encrypted SMTP
20163 connection, and Exim is configured to request a certificate from the client,
20164 the value of the Distinguished Name of the certificate is made available in the
20165 <varname>$tls_in_peerdn</varname> during subsequent processing.
20166 If certificate verification fails it may refer to a failing chain element
20167 which is not the leaf.
20168 </para>
20169 <para>
20170 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
20171 except when used in the context of an outbound SMTP delivery, when it refers to
20172 the outbound.
20173 </para>
20174 </listitem></varlistentry>
20175 <varlistentry>
20176 <term><varname>$tls_out_peerdn</varname></term>
20177 <listitem>
20178 <para>
20179 <indexterm role="variable">
20180 <primary><varname>$tls_out_peerdn</varname></primary>
20181 </indexterm>
20182 When a message is being delivered to a remote host over an encrypted SMTP
20183 connection, and Exim is configured to request a certificate from the server,
20184 the value of the Distinguished Name of the certificate is made available in the
20185 <varname>$tls_out_peerdn</varname> during subsequent processing.
20186 If certificate verification fails it may refer to a failing chain element
20187 which is not the leaf.
20188 </para>
20189 </listitem></varlistentry>
20190 <varlistentry>
20191 <term><varname>$tls_in_sni</varname></term>
20192 <listitem>
20193 <para>
20194 <indexterm role="variable">
20195 <primary><varname>$tls_in_sni</varname></primary>
20196 </indexterm>
20197 <indexterm role="variable">
20198 <primary><varname>$tls_sni</varname></primary>
20199 </indexterm>
20200 <indexterm role="concept">
20201 <primary>TLS</primary>
20202 <secondary>Server Name Indication</secondary>
20203 </indexterm>
20204 When a TLS session is being established, if the client sends the Server
20205 Name Indication extension, the value will be placed in this variable.
20206 If the variable appears in <option>tls_certificate</option> then this option and
20207 some others, described in <xref linkend="SECTtlssni"/>,
20208 will be re-expanded early in the TLS session, to permit
20209 a different certificate to be presented (and optionally a different key to be
20210 used) to the client, based upon the value of the SNI extension.
20211 </para>
20212 <para>
20213 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
20214 except when used in the context of an outbound SMTP delivery, when it refers to
20215 the outbound.
20216 </para>
20217 </listitem></varlistentry>
20218 <varlistentry>
20219 <term><varname>$tls_out_sni</varname></term>
20220 <listitem>
20221 <para>
20222 <indexterm role="variable">
20223 <primary><varname>$tls_out_sni</varname></primary>
20224 </indexterm>
20225 <indexterm role="concept">
20226 <primary>TLS</primary>
20227 <secondary>Server Name Indication</secondary>
20228 </indexterm>
20229 During outbound
20230 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
20231 the transport.
20232 </para>
20233 </listitem></varlistentry>
20234 <varlistentry>
20235 <term><varname>$tod_bsdinbox</varname></term>
20236 <listitem>
20237 <para>
20238 <indexterm role="variable">
20239 <primary><varname>$tod_bsdinbox</varname></primary>
20240 </indexterm>
20241 The time of day and the date, in the format required for BSD-style mailbox
20242 files, for example: Thu Oct 17 17:14:09 1995.
20243 </para>
20244 </listitem></varlistentry>
20245 <varlistentry>
20246 <term><varname>$tod_epoch</varname></term>
20247 <listitem>
20248 <para>
20249 <indexterm role="variable">
20250 <primary><varname>$tod_epoch</varname></primary>
20251 </indexterm>
20252 The time and date as a number of seconds since the start of the Unix epoch.
20253 </para>
20254 </listitem></varlistentry>
20255 <varlistentry>
20256 <term><varname>$tod_epoch_l</varname></term>
20257 <listitem>
20258 <para>
20259 <indexterm role="variable">
20260 <primary><varname>$tod_epoch_l</varname></primary>
20261 </indexterm>
20262 The time and date as a number of microseconds since the start of the Unix epoch.
20263 </para>
20264 </listitem></varlistentry>
20265 <varlistentry>
20266 <term><varname>$tod_full</varname></term>
20267 <listitem>
20268 <para>
20269 <indexterm role="variable">
20270 <primary><varname>$tod_full</varname></primary>
20271 </indexterm>
20272 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
20273 +0100. The timezone is always given as a numerical offset from UTC, with
20274 positive values used for timezones that are ahead (east) of UTC, and negative
20275 values for those that are behind (west).
20276 </para>
20277 </listitem></varlistentry>
20278 <varlistentry>
20279 <term><varname>$tod_log</varname></term>
20280 <listitem>
20281 <para>
20282 <indexterm role="variable">
20283 <primary><varname>$tod_log</varname></primary>
20284 </indexterm>
20285 The time and date in the format used for writing Exim&#x2019;s log files, for example:
20286 1995-10-12 15:32:29, but without a timezone.
20287 </para>
20288 </listitem></varlistentry>
20289 <varlistentry>
20290 <term><varname>$tod_logfile</varname></term>
20291 <listitem>
20292 <para>
20293 <indexterm role="variable">
20294 <primary><varname>$tod_logfile</varname></primary>
20295 </indexterm>
20296 This variable contains the date in the format yyyymmdd. This is the format that
20297 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
20298 flag.
20299 </para>
20300 </listitem></varlistentry>
20301 <varlistentry>
20302 <term><varname>$tod_zone</varname></term>
20303 <listitem>
20304 <para>
20305 <indexterm role="variable">
20306 <primary><varname>$tod_zone</varname></primary>
20307 </indexterm>
20308 This variable contains the numerical value of the local timezone, for example:
20309 -0500.
20310 </para>
20311 </listitem></varlistentry>
20312 <varlistentry>
20313 <term><varname>$tod_zulu</varname></term>
20314 <listitem>
20315 <para>
20316 <indexterm role="variable">
20317 <primary><varname>$tod_zulu</varname></primary>
20318 </indexterm>
20319 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
20320 by ISO 8601, for example: 20030221154023Z.
20321 </para>
20322 </listitem></varlistentry>
20323 <varlistentry>
20324 <term><varname>$transport_name</varname></term>
20325 <listitem>
20326 <para>
20327 <indexterm role="concept">
20328 <primary>transport</primary>
20329 <secondary>name</secondary>
20330 </indexterm>
20331 <indexterm role="concept">
20332 <primary>name</primary>
20333 <secondary>of transport</secondary>
20334 </indexterm>
20335 <indexterm role="variable">
20336 <primary><varname>$transport_name</varname></primary>
20337 </indexterm>
20338 During the running of a transport, this variable contains its name.
20339 </para>
20340 </listitem></varlistentry>
20341 <varlistentry>
20342 <term><varname>$value</varname></term>
20343 <listitem>
20344 <para>
20345 <indexterm role="variable">
20346 <primary><varname>$value</varname></primary>
20347 </indexterm>
20348 This variable contains the result of an expansion lookup, extraction operation,
20349 or external command, as described above. It is also used during a
20350 <emphasis role="bold">reduce</emphasis> expansion.
20351 </para>
20352 </listitem></varlistentry>
20353 <varlistentry>
20354 <term><varname>$verify_mode</varname></term>
20355 <listitem>
20356 <para>
20357 <indexterm role="variable">
20358 <primary><varname>$verify_mode</varname></primary>
20359 </indexterm>
20360 While a router or transport is being run in verify mode or for cutthrough delivery,
20361 contains "S" for sender-verification or "R" for recipient-verification.
20362 Otherwise, empty.
20363 </para>
20364 </listitem></varlistentry>
20365 <varlistentry>
20366 <term><varname>$version_number</varname></term>
20367 <listitem>
20368 <para>
20369 <indexterm role="variable">
20370 <primary><varname>$version_number</varname></primary>
20371 </indexterm>
20372 The version number of Exim.
20373 </para>
20374 </listitem></varlistentry>
20375 <varlistentry>
20376 <term><varname>$warn_message_delay</varname></term>
20377 <listitem>
20378 <para>
20379 <indexterm role="variable">
20380 <primary><varname>$warn_message_delay</varname></primary>
20381 </indexterm>
20382 This variable is set only during the creation of a message warning about a
20383 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20384 </para>
20385 </listitem></varlistentry>
20386 <varlistentry>
20387 <term><varname>$warn_message_recipients</varname></term>
20388 <listitem>
20389 <para>
20390 <indexterm role="variable">
20391 <primary><varname>$warn_message_recipients</varname></primary>
20392 </indexterm>
20393 This variable is set only during the creation of a message warning about a
20394 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
20395 </para>
20396 </listitem></varlistentry>
20397 </variablelist>
20398 <para>
20399 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
20400 </para>
20401 </section>
20402 </chapter>
20403
20404 <chapter id="CHAPperl">
20405 <title>Embedded Perl</title>
20406 <para>
20407 <indexterm role="concept" id="IIDperl" class="startofrange">
20408 <primary>Perl</primary>
20409 <secondary>calling from Exim</secondary>
20410 </indexterm>
20411 Exim can be built to include an embedded Perl interpreter. When this is done,
20412 Perl subroutines can be called as part of the string expansion process. To make
20413 use of the Perl support, you need version 5.004 or later of Perl installed on
20414 your system. To include the embedded interpreter in the Exim binary, include
20415 the line
20416 </para>
20417 <literallayout class="monospaced">
20418 EXIM_PERL = perl.o
20419 </literallayout>
20420 <para>
20421 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
20422 </para>
20423 <section id="SECID85">
20424 <title>Setting up so Perl can be used</title>
20425 <para>
20426 <indexterm role="option">
20427 <primary><option>perl_startup</option></primary>
20428 </indexterm>
20429 Access to Perl subroutines is via a global configuration option called
20430 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
20431 no <option>perl_startup</option> option in the Exim configuration file then no Perl
20432 interpreter is started and there is almost no overhead for Exim (since none of
20433 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
20434 option then the associated value is taken to be Perl code which is executed in
20435 a newly created Perl interpreter.
20436 </para>
20437 <para>
20438 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
20439 need backslashes before any characters to escape special meanings. The option
20440 should usually be something like
20441 </para>
20442 <literallayout class="monospaced">
20443 perl_startup = do '/etc/exim.pl'
20444 </literallayout>
20445 <para>
20446 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
20447 use from Exim. Exim can be configured either to start up a Perl interpreter as
20448 soon as it is entered, or to wait until the first time it is needed. Starting
20449 the interpreter at the beginning ensures that it is done while Exim still has
20450 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
20451 fact used in a particular run. Also, note that this does not mean that Exim is
20452 necessarily running as root when Perl is called at a later time. By default,
20453 the interpreter is started only when it is needed, but this can be changed in
20454 two ways:
20455 </para>
20456 <itemizedlist>
20457 <listitem>
20458 <para>
20459 <indexterm role="option">
20460 <primary><option>perl_at_start</option></primary>
20461 </indexterm>
20462 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
20463 a startup when Exim is entered.
20464 </para>
20465 </listitem>
20466 <listitem>
20467 <para>
20468 The command line option <option>-ps</option> also requests a startup when Exim is entered,
20469 overriding the setting of <option>perl_at_start</option>.
20470 </para>
20471 </listitem>
20472 </itemizedlist>
20473 <para>
20474 There is also a command line option <option>-pd</option> (for delay) which suppresses the
20475 initial startup, even if <option>perl_at_start</option> is set.
20476 </para>
20477 <itemizedlist>
20478 <listitem>
20479 <para>
20480 <indexterm role="option">
20481 <primary><option>perl_taintmode</option></primary>
20482 </indexterm>
20483 <indexterm role="concept">
20484 <primary>Perl</primary>
20485 <secondary>taintmode</secondary>
20486 </indexterm>
20487 To provide more security executing Perl code via the embedded Perl
20488 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
20489 taint mode of the Perl interpreter. You are encouraged to set this
20490 option to a true value. To avoid breaking existing installations, it
20491 defaults to false.
20492 </para>
20493 </listitem>
20494 </itemizedlist>
20495 </section>
20496 <section id="SECID86">
20497 <title>Calling Perl subroutines</title>
20498 <para>
20499 When the configuration file includes a <option>perl_startup</option> option you can make use
20500 of the string expansion item to call the Perl subroutines that are defined
20501 by the <option>perl_startup</option> code. The operator is used in any of the following
20502 forms:
20503 </para>
20504 <literallayout class="monospaced">
20505 ${perl{foo}}
20506 ${perl{foo}{argument}}
20507 ${perl{foo}{argument1}{argument2} ... }
20508 </literallayout>
20509 <para>
20510 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
20511 arguments may be passed. Passing more than this results in an expansion failure
20512 with an error message of the form
20513 </para>
20514 <literallayout class="monospaced">
20515 Too many arguments passed to Perl subroutine "foo" (max is 8)
20516 </literallayout>
20517 <para>
20518 The return value of the Perl subroutine is evaluated in a scalar context before
20519 it is passed back to Exim to be inserted into the expanded string. If the
20520 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
20521 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
20522 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
20523 that was passed to <option>die</option>.
20524 </para>
20525 </section>
20526 <section id="SECID87">
20527 <title>Calling Exim functions from Perl</title>
20528 <para>
20529 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
20530 is available to call back into Exim&#x2019;s string expansion function. For example,
20531 the Perl code
20532 </para>
20533 <literallayout class="monospaced">
20534 my $lp = Exim::expand_string('$local_part');
20535 </literallayout>
20536 <para>
20537 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
20538 Note those are single quotes and not double quotes to protect against
20539 <varname>$local_part</varname> being interpolated as a Perl variable.
20540 </para>
20541 <para>
20542 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
20543 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
20544 expansion string, the Perl call from the original expansion string fails with
20545 an appropriate error message, in the same way as if <option>die</option> were used.
20546 </para>
20547 <para>
20548 <indexterm role="concept">
20549 <primary>debugging</primary>
20550 <secondary>from embedded Perl</secondary>
20551 </indexterm>
20552 <indexterm role="concept">
20553 <primary>log</primary>
20554 <secondary>writing from embedded Perl</secondary>
20555 </indexterm>
20556 Two other Exim functions are available for use from within Perl code.
20557 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
20558 debugging is enabled. If you want a newline at the end, you must supply it.
20559 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
20560 timestamp. In this case, you should not supply a terminating newline.
20561 </para>
20562 </section>
20563 <section id="SECID88">
20564 <title>Use of standard output and error by Perl</title>
20565 <para>
20566 <indexterm role="concept">
20567 <primary>Perl</primary>
20568 <secondary>standard output and error</secondary>
20569 </indexterm>
20570 You should not write to the standard error or output streams from within your
20571 Perl code, as it is not defined how these are set up. In versions of Exim
20572 before 4.50, it is possible for the standard output or error to refer to the
20573 SMTP connection during message reception via the daemon. Writing to this stream
20574 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
20575 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
20576 avoided, but the output is lost.
20577 </para>
20578 <para>
20579 <indexterm role="concept">
20580 <primary>Perl</primary>
20581 <secondary>use of <option>warn</option></secondary>
20582 </indexterm>
20583 The Perl <option>warn</option> statement writes to the standard error stream by default.
20584 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
20585 you have no control. When Exim starts up the Perl interpreter, it arranges for
20586 output from the <option>warn</option> statement to be written to the Exim main log. You can
20587 change this by including appropriate Perl magic somewhere in your Perl code.
20588 For example, to discard <option>warn</option> output completely, you need this:
20589 </para>
20590 <literallayout class="monospaced">
20591 $SIG{__WARN__} = sub { };
20592 </literallayout>
20593 <para>
20594 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
20595 example, the code for the subroutine is empty, so it does nothing, but you can
20596 include any Perl code that you like. The text of the <option>warn</option> message is passed
20597 as the first subroutine argument.
20598 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
20599 </para>
20600 </section>
20601 </chapter>
20602
20603 <chapter id="CHAPinterfaces">
20604 <title>Starting the daemon and the use of network interfaces</title>
20605 <titleabbrev>Starting the daemon</titleabbrev>
20606 <para>
20607 <indexterm role="concept">
20608 <primary>daemon</primary>
20609 <secondary>starting</secondary>
20610 </indexterm>
20611 <indexterm role="concept">
20612 <primary>interface</primary>
20613 <secondary>listening</secondary>
20614 </indexterm>
20615 <indexterm role="concept">
20616 <primary>network interface</primary>
20617 </indexterm>
20618 <indexterm role="concept">
20619 <primary>interface</primary>
20620 <secondary>network</secondary>
20621 </indexterm>
20622 <indexterm role="concept">
20623 <primary>IP address</primary>
20624 <secondary>for listening</secondary>
20625 </indexterm>
20626 <indexterm role="concept">
20627 <primary>daemon</primary>
20628 <secondary>listening IP addresses</secondary>
20629 </indexterm>
20630 <indexterm role="concept">
20631 <primary>TCP/IP</primary>
20632 <secondary>setting listening interfaces</secondary>
20633 </indexterm>
20634 <indexterm role="concept">
20635 <primary>TCP/IP</primary>
20636 <secondary>setting listening ports</secondary>
20637 </indexterm>
20638 A host that is connected to a TCP/IP network may have one or more physical
20639 hardware network interfaces. Each of these interfaces may be configured as one
20640 or more <quote>logical</quote> interfaces, which are the entities that a program actually
20641 works with. Each of these logical interfaces is associated with an IP address.
20642 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
20643 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
20644 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
20645 </para>
20646 <orderedlist numeration="arabic">
20647 <listitem>
20648 <para>
20649 When a listening daemon is started, Exim needs to know which interfaces
20650 and ports to listen on.
20651 </para>
20652 </listitem>
20653 <listitem>
20654 <para>
20655 When Exim is routing an address, it needs to know which IP addresses
20656 are associated with local interfaces. This is required for the correct
20657 processing of MX lists by removing the local host and others with the
20658 same or higher priority values. Also, Exim needs to detect cases
20659 when an address is routed to an IP address that in fact belongs to the
20660 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
20661 option of the smtp transport is set (as appropriate), this is treated
20662 as an error situation.
20663 </para>
20664 </listitem>
20665 <listitem>
20666 <para>
20667 When Exim connects to a remote host, it may need to know which interface to use
20668 for the outgoing connection.
20669 </para>
20670 </listitem>
20671 </orderedlist>
20672 <para>
20673 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
20674 of cases. If your host has only one interface, and you want all its IP
20675 addresses to be treated in the same way, and you are using only the
20676 standard SMTP port, you should not need to take any special action. The
20677 rest of this chapter does not apply to you.
20678 </para>
20679 <para>
20680 In a more complicated situation you may want to listen only on certain
20681 interfaces, or on different ports, and for this reason there are a number of
20682 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
20683 chapter describes how they operate.
20684 </para>
20685 <para>
20686 When a message is received over TCP/IP, the interface and port that were
20687 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
20688 </para>
20689 <section id="SECID89">
20690 <title>Starting a listening daemon</title>
20691 <para>
20692 When a listening daemon is started (by means of the <option>-bd</option> command line
20693 option), the interfaces and ports on which it listens are controlled by the
20694 following options:
20695 </para>
20696 <itemizedlist>
20697 <listitem>
20698 <para>
20699 <option>daemon_smtp_ports</option> contains a list of default ports
20700 or service names.
20701 (For backward compatibility, this option can also be specified in the singular.)
20702 </para>
20703 </listitem>
20704 <listitem>
20705 <para>
20706 <option>local_interfaces</option> contains list of interface IP addresses on which to
20707 listen. Each item may optionally also specify a port.
20708 </para>
20709 </listitem>
20710 </itemizedlist>
20711 <para>
20712 The default list separator in both cases is a colon, but this can be changed as
20713 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
20714 it is usually best to change the separator to avoid having to double all the
20715 colons. For example:
20716 </para>
20717 <literallayout class="monospaced">
20718 local_interfaces = &lt;; 127.0.0.1 ; \
20719                       192.168.23.65 ; \
20720                       ::1 ; \
20721                       3ffe:ffff:836f::fe86:a061
20722 </literallayout>
20723 <para>
20724 There are two different formats for specifying a port along with an IP address
20725 in <option>local_interfaces</option>:
20726 </para>
20727 <orderedlist numeration="arabic">
20728 <listitem>
20729 <para>
20730 The port is added onto the address with a dot separator. For example, to listen
20731 on port 1234 on two different IP addresses:
20732 </para>
20733 <literallayout class="monospaced">
20734 local_interfaces = &lt;; 192.168.23.65.1234 ; \
20735                       3ffe:ffff:836f::fe86:a061.1234
20736 </literallayout>
20737 </listitem>
20738 <listitem>
20739 <para>
20740 The IP address is enclosed in square brackets, and the port is added
20741 with a colon separator, for example:
20742 </para>
20743 <literallayout class="monospaced">
20744 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
20745                       [3ffe:ffff:836f::fe86:a061]:1234
20746 </literallayout>
20747 </listitem>
20748 </orderedlist>
20749 <para>
20750 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
20751 default setting contains just one port:
20752 </para>
20753 <literallayout class="monospaced">
20754 daemon_smtp_ports = smtp
20755 </literallayout>
20756 <para>
20757 If more than one port is listed, each interface that does not have its own port
20758 specified listens on all of them. Ports that are listed in
20759 <option>daemon_smtp_ports</option> can be identified either by name (defined in
20760 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
20761 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
20762 </para>
20763 </section>
20764 <section id="SECID90">
20765 <title>Special IP listening addresses</title>
20766 <para>
20767 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
20768 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
20769 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
20770 instead of setting up separate listening sockets for each interface. The
20771 default value of <option>local_interfaces</option> is
20772 </para>
20773 <literallayout class="monospaced">
20774 local_interfaces = 0.0.0.0
20775 </literallayout>
20776 <para>
20777 when Exim is built without IPv6 support; otherwise it is:
20778 </para>
20779 <literallayout class="monospaced">
20780 local_interfaces = &lt;; ::0 ; 0.0.0.0
20781 </literallayout>
20782 <para>
20783 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
20784 </para>
20785 </section>
20786 <section id="SECID91">
20787 <title>Overriding local_interfaces and daemon_smtp_ports</title>
20788 <para>
20789 The <option>-oX</option> command line option can be used to override the values of
20790 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
20791 instance. Another way of doing this would be to use macros and the <option>-D</option>
20792 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
20793 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
20794 exim.
20795 </para>
20796 <para>
20797 The value of <option>-oX</option> is a list of items. The default colon separator can be
20798 changed in the usual way if required. If there are any items that do not
20799 contain dots or colons (that is, are not IP addresses), the value of
20800 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
20801 items that do contain dots or colons, the value of <option>local_interfaces</option> is
20802 replaced by those items. Thus, for example,
20803 </para>
20804 <literallayout class="monospaced">
20805 -oX 1225
20806 </literallayout>
20807 <para>
20808 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
20809 whereas
20810 </para>
20811 <literallayout class="monospaced">
20812 -oX 192.168.34.5.1125
20813 </literallayout>
20814 <para>
20815 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
20816 (However, since <option>local_interfaces</option> now contains no items without ports, the
20817 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
20818 </para>
20819 </section>
20820 <section id="SECTsupobssmt">
20821 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
20822 <para>
20823 <indexterm role="concept">
20824 <primary>ssmtp protocol</primary>
20825 </indexterm>
20826 <indexterm role="concept">
20827 <primary>smtps protocol</primary>
20828 </indexterm>
20829 <indexterm role="concept">
20830 <primary>SMTP</primary>
20831 <secondary>ssmtp protocol</secondary>
20832 </indexterm>
20833 <indexterm role="concept">
20834 <primary>SMTP</primary>
20835 <secondary>smtps protocol</secondary>
20836 </indexterm>
20837 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
20838 before the STARTTLS command was standardized for SMTP. Some legacy clients
20839 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
20840 list of port numbers or service names,
20841 connections to those ports must use SSMTP. The most
20842 common use of this option is expected to be
20843 </para>
20844 <literallayout class="monospaced">
20845 tls_on_connect_ports = 465
20846 </literallayout>
20847 <para>
20848 because 465 is the usual port number used by the legacy clients. There is also
20849 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
20850 this way when a daemon is started.
20851 </para>
20852 <para>
20853 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
20854 daemon to listen on those ports. You must still specify them in
20855 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
20856 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
20857 connections via the daemon.)
20858 </para>
20859 </section>
20860 <section id="SECID92">
20861 <title>IPv6 address scopes</title>
20862 <para>
20863 <indexterm role="concept">
20864 <primary>IPv6</primary>
20865 <secondary>address scopes</secondary>
20866 </indexterm>
20867 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
20868 can, in principle, have the same link-local IPv6 address on different
20869 interfaces. Thus, additional information is needed, over and above the IP
20870 address, to distinguish individual interfaces. A convention of using a
20871 percent sign followed by something (often the interface name) has been
20872 adopted in some cases, leading to addresses like this:
20873 </para>
20874 <literallayout class="monospaced">
20875 fe80::202:b3ff:fe03:45c1%eth0
20876 </literallayout>
20877 <para>
20878 To accommodate this usage, a percent sign followed by an arbitrary string is
20879 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
20880 to convert a textual IPv6 address for actual use. This function recognizes the
20881 percent convention in operating systems that support it, and it processes the
20882 address appropriately. Unfortunately, some older libraries have problems with
20883 <function>getaddrinfo()</function>. If
20884 </para>
20885 <literallayout class="monospaced">
20886 IPV6_USE_INET_PTON=yes
20887 </literallayout>
20888 <para>
20889 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
20890 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
20891 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
20892 function.) Of course, this means that the additional functionality of
20893 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
20894 </para>
20895 </section>
20896 <section id="SECID93">
20897 <title>Disabling IPv6</title>
20898 <para>
20899 <indexterm role="concept">
20900 <primary>IPv6</primary>
20901 <secondary>disabling</secondary>
20902 </indexterm>
20903 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
20904 run on a host whose kernel does not support IPv6. The binary will fall back to
20905 using IPv4, but it may waste resources looking up AAAA records, and trying to
20906 connect to IPv6 addresses, causing delays to mail delivery. If you set the
20907 <indexterm role="option">
20908 <primary><option>disable_ipv6</option></primary>
20909 </indexterm>
20910 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
20911 activities take place. AAAA records are never looked up, and any IPv6 addresses
20912 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
20913 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
20914 to handle IPv6 literal addresses.
20915 </para>
20916 <para>
20917 On the other hand, when IPv6 is in use, there may be times when you want to
20918 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
20919 option to globally suppress the lookup of AAAA records for specified domains,
20920 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
20921 IPv6 addresses in an individual router.
20922 </para>
20923 </section>
20924 <section id="SECID94">
20925 <title>Examples of starting a listening daemon</title>
20926 <para>
20927 The default case in an IPv6 environment is
20928 </para>
20929 <literallayout class="monospaced">
20930 daemon_smtp_ports = smtp
20931 local_interfaces = &lt;; ::0 ; 0.0.0.0
20932 </literallayout>
20933 <para>
20934 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
20935 Either one or two sockets may be used, depending on the characteristics of
20936 the TCP/IP stack. (This is complicated and messy; for more information,
20937 read the comments in the <filename>daemon.c</filename> source file.)
20938 </para>
20939 <para>
20940 To specify listening on ports 25 and 26 on all interfaces:
20941 </para>
20942 <literallayout class="monospaced">
20943 daemon_smtp_ports = 25 : 26
20944 </literallayout>
20945 <para>
20946 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
20947 </para>
20948 <literallayout class="monospaced">
20949 local_interfaces = &lt;; ::0.25     ; ::0.26 \
20950                       0.0.0.0.25 ; 0.0.0.0.26
20951 </literallayout>
20952 <para>
20953 To listen on the default port on all IPv4 interfaces, and on port 26 on the
20954 IPv4 loopback address only:
20955 </para>
20956 <literallayout class="monospaced">
20957 local_interfaces = 0.0.0.0 : 127.0.0.1.26
20958 </literallayout>
20959 <para>
20960 To specify listening on the default port on specific interfaces only:
20961 </para>
20962 <literallayout class="monospaced">
20963 local_interfaces = 10.0.0.67 : 192.168.34.67
20964 </literallayout>
20965 <para>
20966 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
20967 </para>
20968 </section>
20969 <section id="SECTreclocipadd">
20970 <title>Recognizing the local host</title>
20971 <para>
20972 The <option>local_interfaces</option> option is also used when Exim needs to determine
20973 whether or not an IP address refers to the local host. That is, the IP
20974 addresses of all the interfaces on which a daemon is listening are always
20975 treated as local.
20976 </para>
20977 <para>
20978 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
20979 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
20980 available interfaces from the operating system, and extracts the relevant
20981 (that is, IPv4 or IPv6) addresses to use for checking.
20982 </para>
20983 <para>
20984 Some systems set up large numbers of virtual interfaces in order to provide
20985 many virtual web servers. In this situation, you may want to listen for
20986 email on only a few of the available interfaces, but nevertheless treat all
20987 interfaces as local when routing. You can do this by setting
20988 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
20989 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
20990 used for listening. Consider this example:
20991 </para>
20992 <literallayout class="monospaced">
20993 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
20994                       192.168.53.235 ; \
20995                       3ffe:2101:12:1:a00:20ff:fe86:a061
20996
20997 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
20998 </literallayout>
20999 <para>
21000 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
21001 address, but all available interface addresses are treated as local when
21002 Exim is routing.
21003 </para>
21004 <para>
21005 In some environments the local host name may be in an MX list, but with an IP
21006 address that is not assigned to any local interface. In other cases it may be
21007 desirable to treat other host names as if they referred to the local host. Both
21008 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
21009 This contains host names rather than IP addresses. When a host is referenced
21010 during routing, either via an MX record or directly, it is treated as the local
21011 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
21012 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
21013 </para>
21014 </section>
21015 <section id="SECID95">
21016 <title>Delivering to a remote host</title>
21017 <para>
21018 Delivery to a remote host is handled by the smtp transport. By default, it
21019 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
21020 there is more than one) when connecting to a remote host. However, the
21021 <option>interface</option> option can be set to specify which interface is used. See the
21022 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
21023 details.
21024 </para>
21025 </section>
21026 </chapter>
21027
21028 <chapter id="CHAPmainconfig">
21029 <title>Main configuration</title>
21030 <para>
21031 <indexterm role="concept" id="IIDconfima" class="startofrange">
21032 <primary>configuration file</primary>
21033 <secondary>main section</secondary>
21034 </indexterm>
21035 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
21036 <primary>main configuration</primary>
21037 </indexterm>
21038 The first part of the run time configuration file contains three types of item:
21039 </para>
21040 <itemizedlist>
21041 <listitem>
21042 <para>
21043 Macro definitions: These lines start with an upper case letter. See section
21044 <xref linkend="SECTmacrodefs"/> for details of macro processing.
21045 </para>
21046 </listitem>
21047 <listitem>
21048 <para>
21049 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
21050 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
21051 section <xref linkend="SECTnamedlists"/>.
21052 </para>
21053 </listitem>
21054 <listitem>
21055 <para>
21056 Main configuration settings: Each setting occupies one line of the file
21057 (with possible continuations). If any setting is preceded by the word
21058 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
21059 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
21060 settings.
21061 </para>
21062 </listitem>
21063 </itemizedlist>
21064 <para>
21065 This chapter specifies all the main configuration options, along with their
21066 types and default values. For ease of finding a particular option, they appear
21067 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
21068 are now so many options, they are first listed briefly in functional groups, as
21069 an aid to finding the name of the option you are looking for. Some options are
21070 listed in more than one group.
21071 </para>
21072 <section id="SECID96">
21073 <title>Miscellaneous</title>
21074 <informaltable frame="none">
21075 <tgroup cols="2" colsep="0" rowsep="0">
21076 <colspec colwidth="196pt" align="left"/>
21077 <colspec colwidth="254pt" align="left"/>
21078 <tbody>
21079 <row>
21080 <entry><option>bi_command</option></entry>
21081 <entry>to run for <option>-bi</option> command line option</entry>
21082 </row>
21083 <row>
21084 <entry><option>debug_store</option></entry>
21085 <entry>do extra internal checks</entry>
21086 </row>
21087 <row>
21088 <entry><option>disable_ipv6</option></entry>
21089 <entry>do no IPv6 processing</entry>
21090 </row>
21091 <row>
21092 <entry><option>keep_malformed</option></entry>
21093 <entry>for broken files &ndash; should not happen</entry>
21094 </row>
21095 <row>
21096 <entry><option>localhost_number</option></entry>
21097 <entry>for unique message ids in clusters</entry>
21098 </row>
21099 <row>
21100 <entry><option>message_body_newlines</option></entry>
21101 <entry>retain newlines in <varname>$message_body</varname></entry>
21102 </row>
21103 <row>
21104 <entry><option>message_body_visible</option></entry>
21105 <entry>how much to show in <varname>$message_body</varname></entry>
21106 </row>
21107 <row>
21108 <entry><option>mua_wrapper</option></entry>
21109 <entry>run in <quote>MUA wrapper</quote> mode</entry>
21110 </row>
21111 <row>
21112 <entry><option>print_topbitchars</option></entry>
21113 <entry>top-bit characters are printing</entry>
21114 </row>
21115 <row>
21116 <entry><option>timezone</option></entry>
21117 <entry>force time zone</entry>
21118 </row>
21119 </tbody>
21120 </tgroup>
21121 </informaltable>
21122 </section>
21123 <section id="SECID97">
21124 <title>Exim parameters</title>
21125 <informaltable frame="none">
21126 <tgroup cols="2" colsep="0" rowsep="0">
21127 <colspec colwidth="196pt" align="left"/>
21128 <colspec colwidth="254pt" align="left"/>
21129 <tbody>
21130 <row>
21131 <entry><option>exim_group</option></entry>
21132 <entry>override compiled-in value</entry>
21133 </row>
21134 <row>
21135 <entry><option>exim_path</option></entry>
21136 <entry>override compiled-in value</entry>
21137 </row>
21138 <row>
21139 <entry><option>exim_user</option></entry>
21140 <entry>override compiled-in value</entry>
21141 </row>
21142 <row>
21143 <entry><option>primary_hostname</option></entry>
21144 <entry>default from <function>uname()</function></entry>
21145 </row>
21146 <row>
21147 <entry><option>split_spool_directory</option></entry>
21148 <entry>use multiple directories</entry>
21149 </row>
21150 <row>
21151 <entry><option>spool_directory</option></entry>
21152 <entry>override compiled-in value</entry>
21153 </row>
21154 </tbody>
21155 </tgroup>
21156 </informaltable>
21157 </section>
21158 <section id="SECID98">
21159 <title>Privilege controls</title>
21160 <informaltable frame="none">
21161 <tgroup cols="2" colsep="0" rowsep="0">
21162 <colspec colwidth="196pt" align="left"/>
21163 <colspec colwidth="254pt" align="left"/>
21164 <tbody>
21165 <row>
21166 <entry><option>admin_groups</option></entry>
21167 <entry>groups that are Exim admin users</entry>
21168 </row>
21169 <row>
21170 <entry><option>deliver_drop_privilege</option></entry>
21171 <entry>drop root for delivery processes</entry>
21172 </row>
21173 <row>
21174 <entry><option>local_from_check</option></entry>
21175 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
21176 </row>
21177 <row>
21178 <entry><option>local_from_prefix</option></entry>
21179 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21180 </row>
21181 <row>
21182 <entry><option>local_from_suffix</option></entry>
21183 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
21184 </row>
21185 <row>
21186 <entry><option>local_sender_retain</option></entry>
21187 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
21188 </row>
21189 <row>
21190 <entry><option>never_users</option></entry>
21191 <entry>do not run deliveries as these</entry>
21192 </row>
21193 <row>
21194 <entry><option>prod_requires_admin</option></entry>
21195 <entry>forced delivery requires admin user</entry>
21196 </row>
21197 <row>
21198 <entry><option>queue_list_requires_admin</option></entry>
21199 <entry>queue listing requires admin user</entry>
21200 </row>
21201 <row>
21202 <entry><option>trusted_groups</option></entry>
21203 <entry>groups that are trusted</entry>
21204 </row>
21205 <row>
21206 <entry><option>trusted_users</option></entry>
21207 <entry>users that are trusted</entry>
21208 </row>
21209 </tbody>
21210 </tgroup>
21211 </informaltable>
21212 </section>
21213 <section id="SECID99">
21214 <title>Logging</title>
21215 <informaltable frame="none">
21216 <tgroup cols="2" colsep="0" rowsep="0">
21217 <colspec colwidth="196pt" align="left"/>
21218 <colspec colwidth="254pt" align="left"/>
21219 <tbody>
21220 <row>
21221 <entry><option>event_action</option></entry>
21222 <entry>custom logging</entry>
21223 </row>
21224 <row>
21225 <entry><option>hosts_connection_nolog</option></entry>
21226 <entry>exemption from connect logging</entry>
21227 </row>
21228 <row>
21229 <entry><option>log_file_path</option></entry>
21230 <entry>override compiled-in value</entry>
21231 </row>
21232 <row>
21233 <entry><option>log_selector</option></entry>
21234 <entry>set/unset optional logging</entry>
21235 </row>
21236 <row>
21237 <entry><option>log_timezone</option></entry>
21238 <entry>add timezone to log lines</entry>
21239 </row>
21240 <row>
21241 <entry><option>message_logs</option></entry>
21242 <entry>create per-message logs</entry>
21243 </row>
21244 <row>
21245 <entry><option>preserve_message_logs</option></entry>
21246 <entry>after message completion</entry>
21247 </row>
21248 <row>
21249 <entry><option>process_log_path</option></entry>
21250 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
21251 </row>
21252 <row>
21253 <entry><option>slow_lookup_log</option></entry>
21254 <entry>control logging of slow DNS lookups</entry>
21255 </row>
21256 <row>
21257 <entry><option>syslog_duplication</option></entry>
21258 <entry>controls duplicate log lines on syslog</entry>
21259 </row>
21260 <row>
21261 <entry><option>syslog_facility</option></entry>
21262 <entry>set syslog <quote>facility</quote> field</entry>
21263 </row>
21264 <row>
21265 <entry><option>syslog_pid</option></entry>
21266 <entry>pid in syslog lines</entry>
21267 </row>
21268 <row>
21269 <entry><option>syslog_processname</option></entry>
21270 <entry>set syslog <quote>ident</quote> field</entry>
21271 </row>
21272 <row>
21273 <entry><option>syslog_timestamp</option></entry>
21274 <entry>timestamp syslog lines</entry>
21275 </row>
21276 <row>
21277 <entry><option>write_rejectlog</option></entry>
21278 <entry>control use of message log</entry>
21279 </row>
21280 </tbody>
21281 </tgroup>
21282 </informaltable>
21283 </section>
21284 <section id="SECID100">
21285 <title>Frozen messages</title>
21286 <informaltable frame="none">
21287 <tgroup cols="2" colsep="0" rowsep="0">
21288 <colspec colwidth="196pt" align="left"/>
21289 <colspec colwidth="254pt" align="left"/>
21290 <tbody>
21291 <row>
21292 <entry><option>auto_thaw</option></entry>
21293 <entry>sets time for retrying frozen messages</entry>
21294 </row>
21295 <row>
21296 <entry><option>freeze_tell</option></entry>
21297 <entry>send message when freezing</entry>
21298 </row>
21299 <row>
21300 <entry><option>move_frozen_messages</option></entry>
21301 <entry>to another directory</entry>
21302 </row>
21303 <row>
21304 <entry><option>timeout_frozen_after</option></entry>
21305 <entry>keep frozen messages only so long</entry>
21306 </row>
21307 </tbody>
21308 </tgroup>
21309 </informaltable>
21310 </section>
21311 <section id="SECID101">
21312 <title>Data lookups</title>
21313 <informaltable frame="none">
21314 <tgroup cols="2" colsep="0" rowsep="0">
21315 <colspec colwidth="196pt" align="left"/>
21316 <colspec colwidth="254pt" align="left"/>
21317 <tbody>
21318 <row>
21319 <entry><option>ibase_servers</option></entry>
21320 <entry>InterBase servers</entry>
21321 </row>
21322 <row>
21323 <entry><option>ldap_ca_cert_dir</option></entry>
21324 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
21325 </row>
21326 <row>
21327 <entry><option>ldap_ca_cert_file</option></entry>
21328 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
21329 </row>
21330 <row>
21331 <entry><option>ldap_cert_file</option></entry>
21332 <entry>client cert file for LDAP</entry>
21333 </row>
21334 <row>
21335 <entry><option>ldap_cert_key</option></entry>
21336 <entry>client key file for LDAP</entry>
21337 </row>
21338 <row>
21339 <entry><option>ldap_cipher_suite</option></entry>
21340 <entry>TLS negotiation preference control</entry>
21341 </row>
21342 <row>
21343 <entry><option>ldap_default_servers</option></entry>
21344 <entry>used if no server in query</entry>
21345 </row>
21346 <row>
21347 <entry><option>ldap_require_cert</option></entry>
21348 <entry>action to take without LDAP server cert</entry>
21349 </row>
21350 <row>
21351 <entry><option>ldap_start_tls</option></entry>
21352 <entry>require TLS within LDAP</entry>
21353 </row>
21354 <row>
21355 <entry><option>ldap_version</option></entry>
21356 <entry>set protocol version</entry>
21357 </row>
21358 <row>
21359 <entry><option>lookup_open_max</option></entry>
21360 <entry>lookup files held open</entry>
21361 </row>
21362 <row>
21363 <entry><option>mysql_servers</option></entry>
21364 <entry>default MySQL servers</entry>
21365 </row>
21366 <row>
21367 <entry><option>oracle_servers</option></entry>
21368 <entry>Oracle servers</entry>
21369 </row>
21370 <row>
21371 <entry><option>pgsql_servers</option></entry>
21372 <entry>default PostgreSQL servers</entry>
21373 </row>
21374 <row>
21375 <entry><option>sqlite_lock_timeout</option></entry>
21376 <entry>as it says</entry>
21377 </row>
21378 </tbody>
21379 </tgroup>
21380 </informaltable>
21381 </section>
21382 <section id="SECID102">
21383 <title>Message ids</title>
21384 <informaltable frame="none">
21385 <tgroup cols="2" colsep="0" rowsep="0">
21386 <colspec colwidth="196pt" align="left"/>
21387 <colspec colwidth="254pt" align="left"/>
21388 <tbody>
21389 <row>
21390 <entry><option>message_id_header_domain</option></entry>
21391 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
21392 </row>
21393 <row>
21394 <entry><option>message_id_header_text</option></entry>
21395 <entry>ditto</entry>
21396 </row>
21397 </tbody>
21398 </tgroup>
21399 </informaltable>
21400 </section>
21401 <section id="SECID103">
21402 <title>Embedded Perl Startup</title>
21403 <informaltable frame="none">
21404 <tgroup cols="2" colsep="0" rowsep="0">
21405 <colspec colwidth="196pt" align="left"/>
21406 <colspec colwidth="254pt" align="left"/>
21407 <tbody>
21408 <row>
21409 <entry><option>perl_at_start</option></entry>
21410 <entry>always start the interpreter</entry>
21411 </row>
21412 <row>
21413 <entry><option>perl_startup</option></entry>
21414 <entry>code to obey when starting Perl</entry>
21415 </row>
21416 <row>
21417 <entry><option>perl_taintmode</option></entry>
21418 <entry>enable taint mode in Perl</entry>
21419 </row>
21420 </tbody>
21421 </tgroup>
21422 </informaltable>
21423 </section>
21424 <section id="SECID104">
21425 <title>Daemon</title>
21426 <informaltable frame="none">
21427 <tgroup cols="2" colsep="0" rowsep="0">
21428 <colspec colwidth="196pt" align="left"/>
21429 <colspec colwidth="254pt" align="left"/>
21430 <tbody>
21431 <row>
21432 <entry><option>daemon_smtp_ports</option></entry>
21433 <entry>default ports</entry>
21434 </row>
21435 <row>
21436 <entry><option>daemon_startup_retries</option></entry>
21437 <entry>number of times to retry</entry>
21438 </row>
21439 <row>
21440 <entry><option>daemon_startup_sleep</option></entry>
21441 <entry>time to sleep between tries</entry>
21442 </row>
21443 <row>
21444 <entry><option>extra_local_interfaces</option></entry>
21445 <entry>not necessarily listened on</entry>
21446 </row>
21447 <row>
21448 <entry><option>local_interfaces</option></entry>
21449 <entry>on which to listen, with optional ports</entry>
21450 </row>
21451 <row>
21452 <entry><option>pid_file_path</option></entry>
21453 <entry>override compiled-in value</entry>
21454 </row>
21455 <row>
21456 <entry><option>queue_run_max</option></entry>
21457 <entry>maximum simultaneous queue runners</entry>
21458 </row>
21459 </tbody>
21460 </tgroup>
21461 </informaltable>
21462 </section>
21463 <section id="SECID105">
21464 <title>Resource control</title>
21465 <informaltable frame="none">
21466 <tgroup cols="2" colsep="0" rowsep="0">
21467 <colspec colwidth="196pt" align="left"/>
21468 <colspec colwidth="254pt" align="left"/>
21469 <tbody>
21470 <row>
21471 <entry><option>check_log_inodes</option></entry>
21472 <entry>before accepting a message</entry>
21473 </row>
21474 <row>
21475 <entry><option>check_log_space</option></entry>
21476 <entry>before accepting a message</entry>
21477 </row>
21478 <row>
21479 <entry><option>check_spool_inodes</option></entry>
21480 <entry>before accepting a message</entry>
21481 </row>
21482 <row>
21483 <entry><option>check_spool_space</option></entry>
21484 <entry>before accepting a message</entry>
21485 </row>
21486 <row>
21487 <entry><option>deliver_queue_load_max</option></entry>
21488 <entry>no queue deliveries if load high</entry>
21489 </row>
21490 <row>
21491 <entry><option>queue_only_load</option></entry>
21492 <entry>queue incoming if load high</entry>
21493 </row>
21494 <row>
21495 <entry><option>queue_only_load_latch</option></entry>
21496 <entry>don&#x2019;t re-evaluate load for each message</entry>
21497 </row>
21498 <row>
21499 <entry><option>queue_run_max</option></entry>
21500 <entry>maximum simultaneous queue runners</entry>
21501 </row>
21502 <row>
21503 <entry><option>remote_max_parallel</option></entry>
21504 <entry>parallel SMTP delivery per message</entry>
21505 </row>
21506 <row>
21507 <entry><option>smtp_accept_max</option></entry>
21508 <entry>simultaneous incoming connections</entry>
21509 </row>
21510 <row>
21511 <entry><option>smtp_accept_max_nonmail</option></entry>
21512 <entry>non-mail commands</entry>
21513 </row>
21514 <row>
21515 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21516 <entry>hosts to which the limit applies</entry>
21517 </row>
21518 <row>
21519 <entry><option>smtp_accept_max_per_connection</option></entry>
21520 <entry>messages per connection</entry>
21521 </row>
21522 <row>
21523 <entry><option>smtp_accept_max_per_host</option></entry>
21524 <entry>connections from one host</entry>
21525 </row>
21526 <row>
21527 <entry><option>smtp_accept_queue</option></entry>
21528 <entry>queue mail if more connections</entry>
21529 </row>
21530 <row>
21531 <entry><option>smtp_accept_queue_per_connection</option></entry>
21532 <entry>queue if more messages per connection</entry>
21533 </row>
21534 <row>
21535 <entry><option>smtp_accept_reserve</option></entry>
21536 <entry>only reserve hosts if more connections</entry>
21537 </row>
21538 <row>
21539 <entry><option>smtp_check_spool_space</option></entry>
21540 <entry>from SIZE on MAIL command</entry>
21541 </row>
21542 <row>
21543 <entry><option>smtp_connect_backlog</option></entry>
21544 <entry>passed to TCP/IP stack</entry>
21545 </row>
21546 <row>
21547 <entry><option>smtp_load_reserve</option></entry>
21548 <entry>SMTP from reserved hosts if load high</entry>
21549 </row>
21550 <row>
21551 <entry><option>smtp_reserve_hosts</option></entry>
21552 <entry>these are the reserve hosts</entry>
21553 </row>
21554 </tbody>
21555 </tgroup>
21556 </informaltable>
21557 </section>
21558 <section id="SECID106">
21559 <title>Policy controls</title>
21560 <informaltable frame="none">
21561 <tgroup cols="2" colsep="0" rowsep="0">
21562 <colspec colwidth="196pt" align="left"/>
21563 <colspec colwidth="254pt" align="left"/>
21564 <tbody>
21565 <row>
21566 <entry><option>acl_not_smtp</option></entry>
21567 <entry>ACL for non-SMTP messages</entry>
21568 </row>
21569 <row>
21570 <entry><option>acl_not_smtp_mime</option></entry>
21571 <entry>ACL for non-SMTP MIME parts</entry>
21572 </row>
21573 <row>
21574 <entry><option>acl_not_smtp_start</option></entry>
21575 <entry>ACL for start of non-SMTP message</entry>
21576 </row>
21577 <row>
21578 <entry><option>acl_smtp_auth</option></entry>
21579 <entry>ACL for AUTH</entry>
21580 </row>
21581 <row>
21582 <entry><option>acl_smtp_connect</option></entry>
21583 <entry>ACL for connection</entry>
21584 </row>
21585 <row>
21586 <entry><option>acl_smtp_data</option></entry>
21587 <entry>ACL for DATA</entry>
21588 </row>
21589 <row>
21590 <entry><option>acl_smtp_data_prdr</option></entry>
21591 <entry>ACL for DATA, per-recipient</entry>
21592 </row>
21593 <row>
21594 <entry><option>acl_smtp_dkim</option></entry>
21595 <entry>ACL for DKIM verification</entry>
21596 </row>
21597 <row>
21598 <entry><option>acl_smtp_etrn</option></entry>
21599 <entry>ACL for ETRN</entry>
21600 </row>
21601 <row>
21602 <entry><option>acl_smtp_expn</option></entry>
21603 <entry>ACL for EXPN</entry>
21604 </row>
21605 <row>
21606 <entry><option>acl_smtp_helo</option></entry>
21607 <entry>ACL for EHLO or HELO</entry>
21608 </row>
21609 <row>
21610 <entry><option>acl_smtp_mail</option></entry>
21611 <entry>ACL for MAIL</entry>
21612 </row>
21613 <row>
21614 <entry><option>acl_smtp_mailauth</option></entry>
21615 <entry>ACL for AUTH on MAIL command</entry>
21616 </row>
21617 <row>
21618 <entry><option>acl_smtp_mime</option></entry>
21619 <entry>ACL for MIME parts</entry>
21620 </row>
21621 <row>
21622 <entry><option>acl_smtp_notquit</option></entry>
21623 <entry>ACL for non-QUIT terminations</entry>
21624 </row>
21625 <row>
21626 <entry><option>acl_smtp_predata</option></entry>
21627 <entry>ACL for start of data</entry>
21628 </row>
21629 <row>
21630 <entry><option>acl_smtp_quit</option></entry>
21631 <entry>ACL for QUIT</entry>
21632 </row>
21633 <row>
21634 <entry><option>acl_smtp_rcpt</option></entry>
21635 <entry>ACL for RCPT</entry>
21636 </row>
21637 <row>
21638 <entry><option>acl_smtp_starttls</option></entry>
21639 <entry>ACL for STARTTLS</entry>
21640 </row>
21641 <row>
21642 <entry><option>acl_smtp_vrfy</option></entry>
21643 <entry>ACL for VRFY</entry>
21644 </row>
21645 <row>
21646 <entry><option>av_scanner</option></entry>
21647 <entry>specify virus scanner</entry>
21648 </row>
21649 <row>
21650 <entry><option>check_rfc2047_length</option></entry>
21651 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
21652 </row>
21653 <row>
21654 <entry><option>dns_csa_search_limit</option></entry>
21655 <entry>control CSA parent search depth</entry>
21656 </row>
21657 <row>
21658 <entry><option>dns_csa_use_reverse</option></entry>
21659 <entry>en/disable CSA IP reverse search</entry>
21660 </row>
21661 <row>
21662 <entry><option>header_maxsize</option></entry>
21663 <entry>total size of message header</entry>
21664 </row>
21665 <row>
21666 <entry><option>header_line_maxsize</option></entry>
21667 <entry>individual header line limit</entry>
21668 </row>
21669 <row>
21670 <entry><option>helo_accept_junk_hosts</option></entry>
21671 <entry>allow syntactic junk from these hosts</entry>
21672 </row>
21673 <row>
21674 <entry><option>helo_allow_chars</option></entry>
21675 <entry>allow illegal chars in HELO names</entry>
21676 </row>
21677 <row>
21678 <entry><option>helo_lookup_domains</option></entry>
21679 <entry>lookup hostname for these HELO names</entry>
21680 </row>
21681 <row>
21682 <entry><option>helo_try_verify_hosts</option></entry>
21683 <entry>HELO soft-checked for these hosts</entry>
21684 </row>
21685 <row>
21686 <entry><option>helo_verify_hosts</option></entry>
21687 <entry>HELO hard-checked for these hosts</entry>
21688 </row>
21689 <row>
21690 <entry><option>host_lookup</option></entry>
21691 <entry>host name looked up for these hosts</entry>
21692 </row>
21693 <row>
21694 <entry><option>host_lookup_order</option></entry>
21695 <entry>order of DNS and local name lookups</entry>
21696 </row>
21697 <row>
21698 <entry><option>hosts_proxy</option></entry>
21699 <entry>use proxy protocol for these hosts</entry>
21700 </row>
21701 <row>
21702 <entry><option>host_reject_connection</option></entry>
21703 <entry>reject connection from these hosts</entry>
21704 </row>
21705 <row>
21706 <entry><option>hosts_treat_as_local</option></entry>
21707 <entry>useful in some cluster configurations</entry>
21708 </row>
21709 <row>
21710 <entry><option>local_scan_timeout</option></entry>
21711 <entry>timeout for <function>local_scan()</function></entry>
21712 </row>
21713 <row>
21714 <entry><option>message_size_limit</option></entry>
21715 <entry>for all messages</entry>
21716 </row>
21717 <row>
21718 <entry><option>percent_hack_domains</option></entry>
21719 <entry>recognize %-hack for these domains</entry>
21720 </row>
21721 <row>
21722 <entry><option>spamd_address</option></entry>
21723 <entry>set interface to SpamAssassin</entry>
21724 </row>
21725 <row>
21726 <entry><option>strict_acl_vars</option></entry>
21727 <entry>object to unset ACL variables</entry>
21728 </row>
21729 </tbody>
21730 </tgroup>
21731 </informaltable>
21732 </section>
21733 <section id="SECID107">
21734 <title>Callout cache</title>
21735 <informaltable frame="none">
21736 <tgroup cols="2" colsep="0" rowsep="0">
21737 <colspec colwidth="196pt" align="left"/>
21738 <colspec colwidth="254pt" align="left"/>
21739 <tbody>
21740 <row>
21741 <entry><option>callout_domain_negative_expire</option></entry>
21742 <entry>timeout for negative domain cache item</entry>
21743 </row>
21744 <row>
21745 <entry><option>callout_domain_positive_expire</option></entry>
21746 <entry>timeout for positive domain cache item</entry>
21747 </row>
21748 <row>
21749 <entry><option>callout_negative_expire</option></entry>
21750 <entry>timeout for negative address cache item</entry>
21751 </row>
21752 <row>
21753 <entry><option>callout_positive_expire</option></entry>
21754 <entry>timeout for positive address cache item</entry>
21755 </row>
21756 <row>
21757 <entry><option>callout_random_local_part</option></entry>
21758 <entry>string to use for <quote>random</quote> testing</entry>
21759 </row>
21760 </tbody>
21761 </tgroup>
21762 </informaltable>
21763 </section>
21764 <section id="SECID108">
21765 <title>TLS</title>
21766 <informaltable frame="none">
21767 <tgroup cols="2" colsep="0" rowsep="0">
21768 <colspec colwidth="196pt" align="left"/>
21769 <colspec colwidth="254pt" align="left"/>
21770 <tbody>
21771 <row>
21772 <entry><option>gnutls_compat_mode</option></entry>
21773 <entry>use GnuTLS compatibility mode</entry>
21774 </row>
21775 <row>
21776 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
21777 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
21778 </row>
21779 <row>
21780 <entry><option>openssl_options</option></entry>
21781 <entry>adjust OpenSSL compatibility options</entry>
21782 </row>
21783 <row>
21784 <entry><option>tls_advertise_hosts</option></entry>
21785 <entry>advertise TLS to these hosts</entry>
21786 </row>
21787 <row>
21788 <entry><option>tls_certificate</option></entry>
21789 <entry>location of server certificate</entry>
21790 </row>
21791 <row>
21792 <entry><option>tls_crl</option></entry>
21793 <entry>certificate revocation list</entry>
21794 </row>
21795 <row>
21796 <entry><option>tls_dh_max_bits</option></entry>
21797 <entry>clamp D-H bit count suggestion</entry>
21798 </row>
21799 <row>
21800 <entry><option>tls_dhparam</option></entry>
21801 <entry>DH parameters for server</entry>
21802 </row>
21803 <row>
21804 <entry><option>tls_eccurve</option></entry>
21805 <entry>EC curve selection for server</entry>
21806 </row>
21807 <row>
21808 <entry><option>tls_ocsp_file</option></entry>
21809 <entry>location of server certificate status proof</entry>
21810 </row>
21811 <row>
21812 <entry><option>tls_on_connect_ports</option></entry>
21813 <entry>specify SSMTP (SMTPS) ports</entry>
21814 </row>
21815 <row>
21816 <entry><option>tls_privatekey</option></entry>
21817 <entry>location of server private key</entry>
21818 </row>
21819 <row>
21820 <entry><option>tls_remember_esmtp</option></entry>
21821 <entry>don&#x2019;t reset after starting TLS</entry>
21822 </row>
21823 <row>
21824 <entry><option>tls_require_ciphers</option></entry>
21825 <entry>specify acceptable ciphers</entry>
21826 </row>
21827 <row>
21828 <entry><option>tls_try_verify_hosts</option></entry>
21829 <entry>try to verify client certificate</entry>
21830 </row>
21831 <row>
21832 <entry><option>tls_verify_certificates</option></entry>
21833 <entry>expected client certificates</entry>
21834 </row>
21835 <row>
21836 <entry><option>tls_verify_hosts</option></entry>
21837 <entry>insist on client certificate verify</entry>
21838 </row>
21839 </tbody>
21840 </tgroup>
21841 </informaltable>
21842 </section>
21843 <section id="SECID109">
21844 <title>Local user handling</title>
21845 <informaltable frame="none">
21846 <tgroup cols="2" colsep="0" rowsep="0">
21847 <colspec colwidth="196pt" align="left"/>
21848 <colspec colwidth="254pt" align="left"/>
21849 <tbody>
21850 <row>
21851 <entry><option>finduser_retries</option></entry>
21852 <entry>useful in NIS environments</entry>
21853 </row>
21854 <row>
21855 <entry><option>gecos_name</option></entry>
21856 <entry>used when creating <emphasis>Sender:</emphasis></entry>
21857 </row>
21858 <row>
21859 <entry><option>gecos_pattern</option></entry>
21860 <entry>ditto</entry>
21861 </row>
21862 <row>
21863 <entry><option>max_username_length</option></entry>
21864 <entry>for systems that truncate</entry>
21865 </row>
21866 <row>
21867 <entry><option>unknown_login</option></entry>
21868 <entry>used when no login name found</entry>
21869 </row>
21870 <row>
21871 <entry><option>unknown_username</option></entry>
21872 <entry>ditto</entry>
21873 </row>
21874 <row>
21875 <entry><option>uucp_from_pattern</option></entry>
21876 <entry>for recognizing <quote>From </quote> lines</entry>
21877 </row>
21878 <row>
21879 <entry><option>uucp_from_sender</option></entry>
21880 <entry>ditto</entry>
21881 </row>
21882 </tbody>
21883 </tgroup>
21884 </informaltable>
21885 </section>
21886 <section id="SECID110">
21887 <title>All incoming messages (SMTP and non-SMTP)</title>
21888 <informaltable frame="none">
21889 <tgroup cols="2" colsep="0" rowsep="0">
21890 <colspec colwidth="196pt" align="left"/>
21891 <colspec colwidth="254pt" align="left"/>
21892 <tbody>
21893 <row>
21894 <entry><option>header_maxsize</option></entry>
21895 <entry>total size of message header</entry>
21896 </row>
21897 <row>
21898 <entry><option>header_line_maxsize</option></entry>
21899 <entry>individual header line limit</entry>
21900 </row>
21901 <row>
21902 <entry><option>message_size_limit</option></entry>
21903 <entry>applies to all messages</entry>
21904 </row>
21905 <row>
21906 <entry><option>percent_hack_domains</option></entry>
21907 <entry>recognize %-hack for these domains</entry>
21908 </row>
21909 <row>
21910 <entry><option>received_header_text</option></entry>
21911 <entry>expanded to make <emphasis>Received:</emphasis></entry>
21912 </row>
21913 <row>
21914 <entry><option>received_headers_max</option></entry>
21915 <entry>for mail loop detection</entry>
21916 </row>
21917 <row>
21918 <entry><option>recipients_max</option></entry>
21919 <entry>limit per message</entry>
21920 </row>
21921 <row>
21922 <entry><option>recipients_max_reject</option></entry>
21923 <entry>permanently reject excess recipients</entry>
21924 </row>
21925 </tbody>
21926 </tgroup>
21927 </informaltable>
21928 </section>
21929 <section id="SECID111">
21930 <title>Non-SMTP incoming messages</title>
21931 <informaltable frame="none">
21932 <tgroup cols="2" colsep="0" rowsep="0">
21933 <colspec colwidth="196pt" align="left"/>
21934 <colspec colwidth="254pt" align="left"/>
21935 <tbody>
21936 <row>
21937 <entry><option>receive_timeout</option></entry>
21938 <entry>for non-SMTP messages</entry>
21939 </row>
21940 </tbody>
21941 </tgroup>
21942 </informaltable>
21943 </section>
21944 <section id="SECID112">
21945 <title>Incoming SMTP messages</title>
21946 <para>
21947 See also the <emphasis>Policy controls</emphasis> section above.
21948 </para>
21949 <informaltable frame="none">
21950 <tgroup cols="2" colsep="0" rowsep="0">
21951 <colspec colwidth="196pt" align="left"/>
21952 <colspec colwidth="254pt" align="left"/>
21953 <tbody>
21954 <row>
21955 <entry><option>dkim_verify_signers</option></entry>
21956 <entry>DKIM domain for which DKIM ACL is run</entry>
21957 </row>
21958 <row>
21959 <entry><option>host_lookup</option></entry>
21960 <entry>host name looked up for these hosts</entry>
21961 </row>
21962 <row>
21963 <entry><option>host_lookup_order</option></entry>
21964 <entry>order of DNS and local name lookups</entry>
21965 </row>
21966 <row>
21967 <entry><option>recipient_unqualified_hosts</option></entry>
21968 <entry>may send unqualified recipients</entry>
21969 </row>
21970 <row>
21971 <entry><option>rfc1413_hosts</option></entry>
21972 <entry>make ident calls to these hosts</entry>
21973 </row>
21974 <row>
21975 <entry><option>rfc1413_query_timeout</option></entry>
21976 <entry>zero disables ident calls</entry>
21977 </row>
21978 <row>
21979 <entry><option>sender_unqualified_hosts</option></entry>
21980 <entry>may send unqualified senders</entry>
21981 </row>
21982 <row>
21983 <entry><option>smtp_accept_keepalive</option></entry>
21984 <entry>some TCP/IP magic</entry>
21985 </row>
21986 <row>
21987 <entry><option>smtp_accept_max</option></entry>
21988 <entry>simultaneous incoming connections</entry>
21989 </row>
21990 <row>
21991 <entry><option>smtp_accept_max_nonmail</option></entry>
21992 <entry>non-mail commands</entry>
21993 </row>
21994 <row>
21995 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
21996 <entry>hosts to which the limit applies</entry>
21997 </row>
21998 <row>
21999 <entry><option>smtp_accept_max_per_connection</option></entry>
22000 <entry>messages per connection</entry>
22001 </row>
22002 <row>
22003 <entry><option>smtp_accept_max_per_host</option></entry>
22004 <entry>connections from one host</entry>
22005 </row>
22006 <row>
22007 <entry><option>smtp_accept_queue</option></entry>
22008 <entry>queue mail if more connections</entry>
22009 </row>
22010 <row>
22011 <entry><option>smtp_accept_queue_per_connection</option></entry>
22012 <entry>queue if more messages per connection</entry>
22013 </row>
22014 <row>
22015 <entry><option>smtp_accept_reserve</option></entry>
22016 <entry>only reserve hosts if more connections</entry>
22017 </row>
22018 <row>
22019 <entry><option>smtp_active_hostname</option></entry>
22020 <entry>host name to use in messages</entry>
22021 </row>
22022 <row>
22023 <entry><option>smtp_banner</option></entry>
22024 <entry>text for welcome banner</entry>
22025 </row>
22026 <row>
22027 <entry><option>smtp_check_spool_space</option></entry>
22028 <entry>from SIZE on MAIL command</entry>
22029 </row>
22030 <row>
22031 <entry><option>smtp_connect_backlog</option></entry>
22032 <entry>passed to TCP/IP stack</entry>
22033 </row>
22034 <row>
22035 <entry><option>smtp_enforce_sync</option></entry>
22036 <entry>of SMTP command/responses</entry>
22037 </row>
22038 <row>
22039 <entry><option>smtp_etrn_command</option></entry>
22040 <entry>what to run for ETRN</entry>
22041 </row>
22042 <row>
22043 <entry><option>smtp_etrn_serialize</option></entry>
22044 <entry>only one at once</entry>
22045 </row>
22046 <row>
22047 <entry><option>smtp_load_reserve</option></entry>
22048 <entry>only reserve hosts if this load</entry>
22049 </row>
22050 <row>
22051 <entry><option>smtp_max_unknown_commands</option></entry>
22052 <entry>before dropping connection</entry>
22053 </row>
22054 <row>
22055 <entry><option>smtp_ratelimit_hosts</option></entry>
22056 <entry>apply ratelimiting to these hosts</entry>
22057 </row>
22058 <row>
22059 <entry><option>smtp_ratelimit_mail</option></entry>
22060 <entry>ratelimit for MAIL commands</entry>
22061 </row>
22062 <row>
22063 <entry><option>smtp_ratelimit_rcpt</option></entry>
22064 <entry>ratelimit for RCPT commands</entry>
22065 </row>
22066 <row>
22067 <entry><option>smtp_receive_timeout</option></entry>
22068 <entry>per command or data line</entry>
22069 </row>
22070 <row>
22071 <entry><option>smtp_reserve_hosts</option></entry>
22072 <entry>these are the reserve hosts</entry>
22073 </row>
22074 <row>
22075 <entry><option>smtp_return_error_details</option></entry>
22076 <entry>give detail on rejections</entry>
22077 </row>
22078 </tbody>
22079 </tgroup>
22080 </informaltable>
22081 </section>
22082 <section id="SECID113">
22083 <title>SMTP extensions</title>
22084 <informaltable frame="none">
22085 <tgroup cols="2" colsep="0" rowsep="0">
22086 <colspec colwidth="196pt" align="left"/>
22087 <colspec colwidth="254pt" align="left"/>
22088 <tbody>
22089 <row>
22090 <entry><option>accept_8bitmime</option></entry>
22091 <entry>advertise 8BITMIME</entry>
22092 </row>
22093 <row>
22094 <entry><option>auth_advertise_hosts</option></entry>
22095 <entry>advertise AUTH to these hosts</entry>
22096 </row>
22097 <row>
22098 <entry><option>chunking_advertise_hosts</option></entry>
22099 <entry>advertise CHUNKING to these hosts</entry>
22100 </row>
22101 <row>
22102 <entry><option>dsn_advertise_hosts</option></entry>
22103 <entry>advertise DSN extensions to these hosts</entry>
22104 </row>
22105 <row>
22106 <entry><option>ignore_fromline_hosts</option></entry>
22107 <entry>allow <quote>From </quote> from these hosts</entry>
22108 </row>
22109 <row>
22110 <entry><option>ignore_fromline_local</option></entry>
22111 <entry>allow <quote>From </quote> from local SMTP</entry>
22112 </row>
22113 <row>
22114 <entry><option>pipelining_advertise_hosts</option></entry>
22115 <entry>advertise pipelining to these hosts</entry>
22116 </row>
22117 <row>
22118 <entry><option>prdr_enable</option></entry>
22119 <entry>advertise PRDR to all hosts</entry>
22120 </row>
22121 <row>
22122 <entry><option>smtputf8_advertise_hosts</option></entry>
22123 <entry>advertise SMTPUTF8 to these hosts</entry>
22124 </row>
22125 <row>
22126 <entry><option>tls_advertise_hosts</option></entry>
22127 <entry>advertise TLS to these hosts</entry>
22128 </row>
22129 </tbody>
22130 </tgroup>
22131 </informaltable>
22132 </section>
22133 <section id="SECID114">
22134 <title>Processing messages</title>
22135 <informaltable frame="none">
22136 <tgroup cols="2" colsep="0" rowsep="0">
22137 <colspec colwidth="196pt" align="left"/>
22138 <colspec colwidth="254pt" align="left"/>
22139 <tbody>
22140 <row>
22141 <entry><option>allow_domain_literals</option></entry>
22142 <entry>recognize domain literal syntax</entry>
22143 </row>
22144 <row>
22145 <entry><option>allow_mx_to_ip</option></entry>
22146 <entry>allow MX to point to IP address</entry>
22147 </row>
22148 <row>
22149 <entry><option>allow_utf8_domains</option></entry>
22150 <entry>in addresses</entry>
22151 </row>
22152 <row>
22153 <entry><option>check_rfc2047_length</option></entry>
22154 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
22155 </row>
22156 <row>
22157 <entry><option>delivery_date_remove</option></entry>
22158 <entry>from incoming messages</entry>
22159 </row>
22160 <row>
22161 <entry><option>envelope_to_remove</option></entry>
22162 <entry>from incoming messages</entry>
22163 </row>
22164 <row>
22165 <entry><option>extract_addresses_remove_arguments</option></entry>
22166 <entry>affects <option>-t</option> processing</entry>
22167 </row>
22168 <row>
22169 <entry><option>headers_charset</option></entry>
22170 <entry>default for translations</entry>
22171 </row>
22172 <row>
22173 <entry><option>qualify_domain</option></entry>
22174 <entry>default for senders</entry>
22175 </row>
22176 <row>
22177 <entry><option>qualify_recipient</option></entry>
22178 <entry>default for recipients</entry>
22179 </row>
22180 <row>
22181 <entry><option>return_path_remove</option></entry>
22182 <entry>from incoming messages</entry>
22183 </row>
22184 <row>
22185 <entry><option>strip_excess_angle_brackets</option></entry>
22186 <entry>in addresses</entry>
22187 </row>
22188 <row>
22189 <entry><option>strip_trailing_dot</option></entry>
22190 <entry>at end of addresses</entry>
22191 </row>
22192 <row>
22193 <entry><option>untrusted_set_sender</option></entry>
22194 <entry>untrusted can set envelope sender</entry>
22195 </row>
22196 </tbody>
22197 </tgroup>
22198 </informaltable>
22199 </section>
22200 <section id="SECID115">
22201 <title>System filter</title>
22202 <informaltable frame="none">
22203 <tgroup cols="2" colsep="0" rowsep="0">
22204 <colspec colwidth="196pt" align="left"/>
22205 <colspec colwidth="254pt" align="left"/>
22206 <tbody>
22207 <row>
22208 <entry><option>system_filter</option></entry>
22209 <entry>locate system filter</entry>
22210 </row>
22211 <row>
22212 <entry><option>system_filter_directory_transport</option></entry>
22213 <entry>transport for delivery to a directory</entry>
22214 </row>
22215 <row>
22216 <entry><option>system_filter_file_transport</option></entry>
22217 <entry>transport for delivery to a file</entry>
22218 </row>
22219 <row>
22220 <entry><option>system_filter_group</option></entry>
22221 <entry>group for filter running</entry>
22222 </row>
22223 <row>
22224 <entry><option>system_filter_pipe_transport</option></entry>
22225 <entry>transport for delivery to a pipe</entry>
22226 </row>
22227 <row>
22228 <entry><option>system_filter_reply_transport</option></entry>
22229 <entry>transport for autoreply delivery</entry>
22230 </row>
22231 <row>
22232 <entry><option>system_filter_user</option></entry>
22233 <entry>user for filter running</entry>
22234 </row>
22235 </tbody>
22236 </tgroup>
22237 </informaltable>
22238 </section>
22239 <section id="SECID116">
22240 <title>Routing and delivery</title>
22241 <informaltable frame="none">
22242 <tgroup cols="2" colsep="0" rowsep="0">
22243 <colspec colwidth="196pt" align="left"/>
22244 <colspec colwidth="254pt" align="left"/>
22245 <tbody>
22246 <row>
22247 <entry><option>disable_ipv6</option></entry>
22248 <entry>do no IPv6 processing</entry>
22249 </row>
22250 <row>
22251 <entry><option>dns_again_means_nonexist</option></entry>
22252 <entry>for broken domains</entry>
22253 </row>
22254 <row>
22255 <entry><option>dns_check_names_pattern</option></entry>
22256 <entry>pre-DNS syntax check</entry>
22257 </row>
22258 <row>
22259 <entry><option>dns_dnssec_ok</option></entry>
22260 <entry>parameter for resolver</entry>
22261 </row>
22262 <row>
22263 <entry><option>dns_ipv4_lookup</option></entry>
22264 <entry>only v4 lookup for these domains</entry>
22265 </row>
22266 <row>
22267 <entry><option>dns_retrans</option></entry>
22268 <entry>parameter for resolver</entry>
22269 </row>
22270 <row>
22271 <entry><option>dns_retry</option></entry>
22272 <entry>parameter for resolver</entry>
22273 </row>
22274 <row>
22275 <entry><option>dns_trust_aa</option></entry>
22276 <entry>DNS zones trusted as authentic</entry>
22277 </row>
22278 <row>
22279 <entry><option>dns_use_edns0</option></entry>
22280 <entry>parameter for resolver</entry>
22281 </row>
22282 <row>
22283 <entry><option>hold_domains</option></entry>
22284 <entry>hold delivery for these domains</entry>
22285 </row>
22286 <row>
22287 <entry><option>local_interfaces</option></entry>
22288 <entry>for routing checks</entry>
22289 </row>
22290 <row>
22291 <entry><option>queue_domains</option></entry>
22292 <entry>no immediate delivery for these</entry>
22293 </row>
22294 <row>
22295 <entry><option>queue_only</option></entry>
22296 <entry>no immediate delivery at all</entry>
22297 </row>
22298 <row>
22299 <entry><option>queue_only_file</option></entry>
22300 <entry>no immediate delivery if file exists</entry>
22301 </row>
22302 <row>
22303 <entry><option>queue_only_load</option></entry>
22304 <entry>no immediate delivery if load is high</entry>
22305 </row>
22306 <row>
22307 <entry><option>queue_only_load_latch</option></entry>
22308 <entry>don&#x2019;t re-evaluate load for each message</entry>
22309 </row>
22310 <row>
22311 <entry><option>queue_only_override</option></entry>
22312 <entry>allow command line to override</entry>
22313 </row>
22314 <row>
22315 <entry><option>queue_run_in_order</option></entry>
22316 <entry>order of arrival</entry>
22317 </row>
22318 <row>
22319 <entry><option>queue_run_max</option></entry>
22320 <entry>of simultaneous queue runners</entry>
22321 </row>
22322 <row>
22323 <entry><option>queue_smtp_domains</option></entry>
22324 <entry>no immediate SMTP delivery for these</entry>
22325 </row>
22326 <row>
22327 <entry><option>remote_max_parallel</option></entry>
22328 <entry>parallel SMTP delivery per message</entry>
22329 </row>
22330 <row>
22331 <entry><option>remote_sort_domains</option></entry>
22332 <entry>order of remote deliveries</entry>
22333 </row>
22334 <row>
22335 <entry><option>retry_data_expire</option></entry>
22336 <entry>timeout for retry data</entry>
22337 </row>
22338 <row>
22339 <entry><option>retry_interval_max</option></entry>
22340 <entry>safety net for retry rules</entry>
22341 </row>
22342 </tbody>
22343 </tgroup>
22344 </informaltable>
22345 </section>
22346 <section id="SECID117">
22347 <title>Bounce and warning messages</title>
22348 <informaltable frame="none">
22349 <tgroup cols="2" colsep="0" rowsep="0">
22350 <colspec colwidth="196pt" align="left"/>
22351 <colspec colwidth="254pt" align="left"/>
22352 <tbody>
22353 <row>
22354 <entry><option>bounce_message_file</option></entry>
22355 <entry>content of bounce</entry>
22356 </row>
22357 <row>
22358 <entry><option>bounce_message_text</option></entry>
22359 <entry>content of bounce</entry>
22360 </row>
22361 <row>
22362 <entry><option>bounce_return_body</option></entry>
22363 <entry>include body if returning message</entry>
22364 </row>
22365 <row>
22366 <entry><option>bounce_return_linesize_limit</option></entry>
22367 <entry>limit on returned message line length</entry>
22368 </row>
22369 <row>
22370 <entry><option>bounce_return_message</option></entry>
22371 <entry>include original message in bounce</entry>
22372 </row>
22373 <row>
22374 <entry><option>bounce_return_size_limit</option></entry>
22375 <entry>limit on returned message</entry>
22376 </row>
22377 <row>
22378 <entry><option>bounce_sender_authentication</option></entry>
22379 <entry>send authenticated sender with bounce</entry>
22380 </row>
22381 <row>
22382 <entry><option>dsn_from</option></entry>
22383 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
22384 </row>
22385 <row>
22386 <entry><option>errors_copy</option></entry>
22387 <entry>copy bounce messages</entry>
22388 </row>
22389 <row>
22390 <entry><option>errors_reply_to</option></entry>
22391 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
22392 </row>
22393 <row>
22394 <entry><option>delay_warning</option></entry>
22395 <entry>time schedule</entry>
22396 </row>
22397 <row>
22398 <entry><option>delay_warning_condition</option></entry>
22399 <entry>condition for warning messages</entry>
22400 </row>
22401 <row>
22402 <entry><option>ignore_bounce_errors_after</option></entry>
22403 <entry>discard undeliverable bounces</entry>
22404 </row>
22405 <row>
22406 <entry><option>smtp_return_error_details</option></entry>
22407 <entry>give detail on rejections</entry>
22408 </row>
22409 <row>
22410 <entry><option>warn_message_file</option></entry>
22411 <entry>content of warning message</entry>
22412 </row>
22413 </tbody>
22414 </tgroup>
22415 </informaltable>
22416 </section>
22417 <section id="SECTalomo">
22418 <title>Alphabetical list of main options</title>
22419 <para>
22420 Those options that undergo string expansion before use are marked with
22421 &dagger;.
22422 </para>
22423 <para>
22424 <indexterm role="option">
22425 <primary><option>accept_8bitmime</option></primary>
22426 </indexterm>
22427 </para>
22428 <informaltable frame="all">
22429 <tgroup cols="4" colsep="0" rowsep="0">
22430 <colspec colwidth="8*" align="left"/>
22431 <colspec colwidth="6*" align="center"/>
22432 <colspec colwidth="6*" align="center"/>
22433 <colspec colwidth="6*" align="right"/>
22434 <tbody>
22435 <row>
22436 <entry><option>accept_8bitmime</option></entry>
22437 <entry>Use: <emphasis>main</emphasis></entry>
22438 <entry>Type: <emphasis>boolean</emphasis></entry>
22439 <entry>Default: <emphasis>true</emphasis></entry>
22440 </row>
22441 </tbody>
22442 </tgroup>
22443 </informaltable>
22444 <para>
22445 <indexterm role="concept">
22446 <primary>8BITMIME</primary>
22447 </indexterm>
22448 <indexterm role="concept">
22449 <primary>8-bit characters</primary>
22450 </indexterm>
22451 <indexterm role="concept">
22452 <primary>log</primary>
22453 <secondary>selectors</secondary>
22454 </indexterm>
22455 <indexterm role="concept">
22456 <primary>log</primary>
22457 <secondary>8BITMIME</secondary>
22458 </indexterm>
22459 This option causes Exim to send 8BITMIME in its response to an SMTP
22460 EHLO command, and to accept the BODY= parameter on MAIL commands.
22461 However, though Exim is 8-bit clean, it is not a protocol converter, and it
22462 takes no steps to do anything special with messages received by this route.
22463 </para>
22464 <para>
22465 Historically Exim kept this option off by default, but the maintainers
22466 feel that in today&#x2019;s Internet, this causes more problems than it solves.
22467 It now defaults to true.
22468 A more detailed analysis of the issues is provided by Dan Bernstein:
22469 </para>
22470 <literallayout>
22471 <emphasis role="bold"><ulink url="http://cr.yp.to/smtp/8bitmime.html">http://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
22472 </literallayout>
22473 <para>
22474 To log received 8BITMIME status use
22475 </para>
22476 <literallayout class="monospaced">
22477 log_selector = +8bitmime
22478 </literallayout>
22479 <para>
22480 <indexterm role="option">
22481 <primary><option>acl_not_smtp</option></primary>
22482 </indexterm>
22483 </para>
22484 <informaltable frame="all">
22485 <tgroup cols="4" colsep="0" rowsep="0">
22486 <colspec colwidth="8*" align="left"/>
22487 <colspec colwidth="6*" align="center"/>
22488 <colspec colwidth="6*" align="center"/>
22489 <colspec colwidth="6*" align="right"/>
22490 <tbody>
22491 <row>
22492 <entry><option>acl_not_smtp</option></entry>
22493 <entry>Use: <emphasis>main</emphasis></entry>
22494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22495 <entry>Default: <emphasis>unset</emphasis></entry>
22496 </row>
22497 </tbody>
22498 </tgroup>
22499 </informaltable>
22500 <para>
22501 <indexterm role="concept">
22502 <primary>access control lists (ACLs)</primary>
22503 <secondary>for non-SMTP messages</secondary>
22504 </indexterm>
22505 <indexterm role="concept">
22506 <primary>non-SMTP messages</primary>
22507 <secondary>ACLs for</secondary>
22508 </indexterm>
22509 This option defines the ACL that is run when a non-SMTP message has been
22510 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
22511 further details.
22512 </para>
22513 <para>
22514 <indexterm role="option">
22515 <primary><option>acl_not_smtp_mime</option></primary>
22516 </indexterm>
22517 </para>
22518 <informaltable frame="all">
22519 <tgroup cols="4" colsep="0" rowsep="0">
22520 <colspec colwidth="8*" align="left"/>
22521 <colspec colwidth="6*" align="center"/>
22522 <colspec colwidth="6*" align="center"/>
22523 <colspec colwidth="6*" align="right"/>
22524 <tbody>
22525 <row>
22526 <entry><option>acl_not_smtp_mime</option></entry>
22527 <entry>Use: <emphasis>main</emphasis></entry>
22528 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22529 <entry>Default: <emphasis>unset</emphasis></entry>
22530 </row>
22531 </tbody>
22532 </tgroup>
22533 </informaltable>
22534 <para>
22535 This option defines the ACL that is run for individual MIME parts of non-SMTP
22536 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
22537 SMTP messages.
22538 </para>
22539 <para>
22540 <indexterm role="option">
22541 <primary><option>acl_not_smtp_start</option></primary>
22542 </indexterm>
22543 </para>
22544 <informaltable frame="all">
22545 <tgroup cols="4" colsep="0" rowsep="0">
22546 <colspec colwidth="8*" align="left"/>
22547 <colspec colwidth="6*" align="center"/>
22548 <colspec colwidth="6*" align="center"/>
22549 <colspec colwidth="6*" align="right"/>
22550 <tbody>
22551 <row>
22552 <entry><option>acl_not_smtp_start</option></entry>
22553 <entry>Use: <emphasis>main</emphasis></entry>
22554 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22555 <entry>Default: <emphasis>unset</emphasis></entry>
22556 </row>
22557 </tbody>
22558 </tgroup>
22559 </informaltable>
22560 <para>
22561 <indexterm role="concept">
22562 <primary>access control lists (ACLs)</primary>
22563 <secondary>at start of non-SMTP message</secondary>
22564 </indexterm>
22565 <indexterm role="concept">
22566 <primary>non-SMTP messages</primary>
22567 <secondary>ACLs for</secondary>
22568 </indexterm>
22569 This option defines the ACL that is run before Exim starts reading a
22570 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
22571 </para>
22572 <para>
22573 <indexterm role="option">
22574 <primary><option>acl_smtp_auth</option></primary>
22575 </indexterm>
22576 </para>
22577 <informaltable frame="all">
22578 <tgroup cols="4" colsep="0" rowsep="0">
22579 <colspec colwidth="8*" align="left"/>
22580 <colspec colwidth="6*" align="center"/>
22581 <colspec colwidth="6*" align="center"/>
22582 <colspec colwidth="6*" align="right"/>
22583 <tbody>
22584 <row>
22585 <entry><option>acl_smtp_auth</option></entry>
22586 <entry>Use: <emphasis>main</emphasis></entry>
22587 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22588 <entry>Default: <emphasis>unset</emphasis></entry>
22589 </row>
22590 </tbody>
22591 </tgroup>
22592 </informaltable>
22593 <para>
22594 <indexterm role="concept">
22595 <primary>access control lists (ACLs)</primary>
22596 <secondary>setting up for SMTP commands</secondary>
22597 </indexterm>
22598 <indexterm role="concept">
22599 <primary>AUTH</primary>
22600 <secondary>ACL for</secondary>
22601 </indexterm>
22602 This option defines the ACL that is run when an SMTP AUTH command is
22603 received. See chapter <xref linkend="CHAPACL"/> for further details.
22604 </para>
22605 <para>
22606 <indexterm role="option">
22607 <primary><option>acl_smtp_connect</option></primary>
22608 </indexterm>
22609 </para>
22610 <informaltable frame="all">
22611 <tgroup cols="4" colsep="0" rowsep="0">
22612 <colspec colwidth="8*" align="left"/>
22613 <colspec colwidth="6*" align="center"/>
22614 <colspec colwidth="6*" align="center"/>
22615 <colspec colwidth="6*" align="right"/>
22616 <tbody>
22617 <row>
22618 <entry><option>acl_smtp_connect</option></entry>
22619 <entry>Use: <emphasis>main</emphasis></entry>
22620 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22621 <entry>Default: <emphasis>unset</emphasis></entry>
22622 </row>
22623 </tbody>
22624 </tgroup>
22625 </informaltable>
22626 <para>
22627 <indexterm role="concept">
22628 <primary>access control lists (ACLs)</primary>
22629 <secondary>on SMTP connection</secondary>
22630 </indexterm>
22631 This option defines the ACL that is run when an SMTP connection is received.
22632 See chapter <xref linkend="CHAPACL"/> for further details.
22633 </para>
22634 <para>
22635 <indexterm role="option">
22636 <primary><option>acl_smtp_data</option></primary>
22637 </indexterm>
22638 </para>
22639 <informaltable frame="all">
22640 <tgroup cols="4" colsep="0" rowsep="0">
22641 <colspec colwidth="8*" align="left"/>
22642 <colspec colwidth="6*" align="center"/>
22643 <colspec colwidth="6*" align="center"/>
22644 <colspec colwidth="6*" align="right"/>
22645 <tbody>
22646 <row>
22647 <entry><option>acl_smtp_data</option></entry>
22648 <entry>Use: <emphasis>main</emphasis></entry>
22649 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22650 <entry>Default: <emphasis>unset</emphasis></entry>
22651 </row>
22652 </tbody>
22653 </tgroup>
22654 </informaltable>
22655 <para>
22656 <indexterm role="concept">
22657 <primary>DATA</primary>
22658 <secondary>ACL for</secondary>
22659 </indexterm>
22660 This option defines the ACL that is run after an SMTP DATA command has been
22661 processed and the message itself has been received, but before the final
22662 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22663 </para>
22664 <para>
22665 <indexterm role="option">
22666 <primary><option>acl_smtp_data_prdr</option></primary>
22667 </indexterm>
22668 </para>
22669 <informaltable frame="all">
22670 <tgroup cols="4" colsep="0" rowsep="0">
22671 <colspec colwidth="8*" align="left"/>
22672 <colspec colwidth="6*" align="center"/>
22673 <colspec colwidth="6*" align="center"/>
22674 <colspec colwidth="6*" align="right"/>
22675 <tbody>
22676 <row>
22677 <entry><option>acl_smtp_data_prdr</option></entry>
22678 <entry>Use: <emphasis>main</emphasis></entry>
22679 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22680 <entry>Default: <emphasis>accept</emphasis></entry>
22681 </row>
22682 </tbody>
22683 </tgroup>
22684 </informaltable>
22685 <para>
22686 <indexterm role="concept">
22687 <primary>PRDR</primary>
22688 <secondary>ACL for</secondary>
22689 </indexterm>
22690 <indexterm role="concept">
22691 <primary>DATA</primary>
22692 <secondary>PRDR ACL for</secondary>
22693 </indexterm>
22694 <indexterm role="concept">
22695 <primary>access control lists (ACLs)</primary>
22696 <secondary>PRDR-related</secondary>
22697 </indexterm>
22698 <indexterm role="concept">
22699 <primary>access control lists (ACLs)</primary>
22700 <secondary>per-user data processing</secondary>
22701 </indexterm>
22702 This option defines the ACL that,
22703 if the PRDR feature has been negotiated,
22704 is run for each recipient after an SMTP DATA command has been
22705 processed and the message itself has been received, but before the
22706 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
22707 </para>
22708 <para>
22709 <indexterm role="option">
22710 <primary><option>acl_smtp_dkim</option></primary>
22711 </indexterm>
22712 </para>
22713 <informaltable frame="all">
22714 <tgroup cols="4" colsep="0" rowsep="0">
22715 <colspec colwidth="8*" align="left"/>
22716 <colspec colwidth="6*" align="center"/>
22717 <colspec colwidth="6*" align="center"/>
22718 <colspec colwidth="6*" align="right"/>
22719 <tbody>
22720 <row>
22721 <entry><option>acl_smtp_dkim</option></entry>
22722 <entry>Use: <emphasis>main</emphasis></entry>
22723 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22724 <entry>Default: <emphasis>unset</emphasis></entry>
22725 </row>
22726 </tbody>
22727 </tgroup>
22728 </informaltable>
22729 <para>
22730 <indexterm role="concept">
22731 <primary>DKIM</primary>
22732 <secondary>ACL for</secondary>
22733 </indexterm>
22734 This option defines the ACL that is run for each DKIM signature
22735 (by default, or as specified in the dkim_verify_signers option)
22736 of a received message.
22737 See chapter <xref linkend="CHAPdkim"/> for further details.
22738 </para>
22739 <para>
22740 <indexterm role="option">
22741 <primary><option>acl_smtp_etrn</option></primary>
22742 </indexterm>
22743 </para>
22744 <informaltable frame="all">
22745 <tgroup cols="4" colsep="0" rowsep="0">
22746 <colspec colwidth="8*" align="left"/>
22747 <colspec colwidth="6*" align="center"/>
22748 <colspec colwidth="6*" align="center"/>
22749 <colspec colwidth="6*" align="right"/>
22750 <tbody>
22751 <row>
22752 <entry><option>acl_smtp_etrn</option></entry>
22753 <entry>Use: <emphasis>main</emphasis></entry>
22754 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22755 <entry>Default: <emphasis>unset</emphasis></entry>
22756 </row>
22757 </tbody>
22758 </tgroup>
22759 </informaltable>
22760 <para>
22761 <indexterm role="concept">
22762 <primary>ETRN</primary>
22763 <secondary>ACL for</secondary>
22764 </indexterm>
22765 This option defines the ACL that is run when an SMTP ETRN command is
22766 received. See chapter <xref linkend="CHAPACL"/> for further details.
22767 </para>
22768 <para>
22769 <indexterm role="option">
22770 <primary><option>acl_smtp_expn</option></primary>
22771 </indexterm>
22772 </para>
22773 <informaltable frame="all">
22774 <tgroup cols="4" colsep="0" rowsep="0">
22775 <colspec colwidth="8*" align="left"/>
22776 <colspec colwidth="6*" align="center"/>
22777 <colspec colwidth="6*" align="center"/>
22778 <colspec colwidth="6*" align="right"/>
22779 <tbody>
22780 <row>
22781 <entry><option>acl_smtp_expn</option></entry>
22782 <entry>Use: <emphasis>main</emphasis></entry>
22783 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22784 <entry>Default: <emphasis>unset</emphasis></entry>
22785 </row>
22786 </tbody>
22787 </tgroup>
22788 </informaltable>
22789 <para>
22790 <indexterm role="concept">
22791 <primary>EXPN</primary>
22792 <secondary>ACL for</secondary>
22793 </indexterm>
22794 This option defines the ACL that is run when an SMTP EXPN command is
22795 received. See chapter <xref linkend="CHAPACL"/> for further details.
22796 </para>
22797 <para>
22798 <indexterm role="option">
22799 <primary><option>acl_smtp_helo</option></primary>
22800 </indexterm>
22801 </para>
22802 <informaltable frame="all">
22803 <tgroup cols="4" colsep="0" rowsep="0">
22804 <colspec colwidth="8*" align="left"/>
22805 <colspec colwidth="6*" align="center"/>
22806 <colspec colwidth="6*" align="center"/>
22807 <colspec colwidth="6*" align="right"/>
22808 <tbody>
22809 <row>
22810 <entry><option>acl_smtp_helo</option></entry>
22811 <entry>Use: <emphasis>main</emphasis></entry>
22812 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22813 <entry>Default: <emphasis>unset</emphasis></entry>
22814 </row>
22815 </tbody>
22816 </tgroup>
22817 </informaltable>
22818 <para>
22819 <indexterm role="concept">
22820 <primary>EHLO</primary>
22821 <secondary>ACL for</secondary>
22822 </indexterm>
22823 <indexterm role="concept">
22824 <primary>HELO</primary>
22825 <secondary>ACL for</secondary>
22826 </indexterm>
22827 This option defines the ACL that is run when an SMTP EHLO or HELO
22828 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
22829 </para>
22830 <para>
22831 <indexterm role="option">
22832 <primary><option>acl_smtp_mail</option></primary>
22833 </indexterm>
22834 </para>
22835 <informaltable frame="all">
22836 <tgroup cols="4" colsep="0" rowsep="0">
22837 <colspec colwidth="8*" align="left"/>
22838 <colspec colwidth="6*" align="center"/>
22839 <colspec colwidth="6*" align="center"/>
22840 <colspec colwidth="6*" align="right"/>
22841 <tbody>
22842 <row>
22843 <entry><option>acl_smtp_mail</option></entry>
22844 <entry>Use: <emphasis>main</emphasis></entry>
22845 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22846 <entry>Default: <emphasis>unset</emphasis></entry>
22847 </row>
22848 </tbody>
22849 </tgroup>
22850 </informaltable>
22851 <para>
22852 <indexterm role="concept">
22853 <primary>MAIL</primary>
22854 <secondary>ACL for</secondary>
22855 </indexterm>
22856 This option defines the ACL that is run when an SMTP MAIL command is
22857 received. See chapter <xref linkend="CHAPACL"/> for further details.
22858 </para>
22859 <para>
22860 <indexterm role="option">
22861 <primary><option>acl_smtp_mailauth</option></primary>
22862 </indexterm>
22863 </para>
22864 <informaltable frame="all">
22865 <tgroup cols="4" colsep="0" rowsep="0">
22866 <colspec colwidth="8*" align="left"/>
22867 <colspec colwidth="6*" align="center"/>
22868 <colspec colwidth="6*" align="center"/>
22869 <colspec colwidth="6*" align="right"/>
22870 <tbody>
22871 <row>
22872 <entry><option>acl_smtp_mailauth</option></entry>
22873 <entry>Use: <emphasis>main</emphasis></entry>
22874 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22875 <entry>Default: <emphasis>unset</emphasis></entry>
22876 </row>
22877 </tbody>
22878 </tgroup>
22879 </informaltable>
22880 <para>
22881 <indexterm role="concept">
22882 <primary>AUTH</primary>
22883 <secondary>on MAIL command</secondary>
22884 </indexterm>
22885 This option defines the ACL that is run when there is an AUTH parameter on
22886 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
22887 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
22888 </para>
22889 <para>
22890 <indexterm role="option">
22891 <primary><option>acl_smtp_mime</option></primary>
22892 </indexterm>
22893 </para>
22894 <informaltable frame="all">
22895 <tgroup cols="4" colsep="0" rowsep="0">
22896 <colspec colwidth="8*" align="left"/>
22897 <colspec colwidth="6*" align="center"/>
22898 <colspec colwidth="6*" align="center"/>
22899 <colspec colwidth="6*" align="right"/>
22900 <tbody>
22901 <row>
22902 <entry><option>acl_smtp_mime</option></entry>
22903 <entry>Use: <emphasis>main</emphasis></entry>
22904 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22905 <entry>Default: <emphasis>unset</emphasis></entry>
22906 </row>
22907 </tbody>
22908 </tgroup>
22909 </informaltable>
22910 <para>
22911 <indexterm role="concept">
22912 <primary>MIME content scanning</primary>
22913 <secondary>ACL for</secondary>
22914 </indexterm>
22915 This option is available when Exim is built with the content-scanning
22916 extension. It defines the ACL that is run for each MIME part in a message. See
22917 section <xref linkend="SECTscanmimepart"/> for details.
22918 </para>
22919 <para>
22920 <indexterm role="option">
22921 <primary><option>acl_smtp_notquit</option></primary>
22922 </indexterm>
22923 </para>
22924 <informaltable frame="all">
22925 <tgroup cols="4" colsep="0" rowsep="0">
22926 <colspec colwidth="8*" align="left"/>
22927 <colspec colwidth="6*" align="center"/>
22928 <colspec colwidth="6*" align="center"/>
22929 <colspec colwidth="6*" align="right"/>
22930 <tbody>
22931 <row>
22932 <entry><option>acl_smtp_notquit</option></entry>
22933 <entry>Use: <emphasis>main</emphasis></entry>
22934 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22935 <entry>Default: <emphasis>unset</emphasis></entry>
22936 </row>
22937 </tbody>
22938 </tgroup>
22939 </informaltable>
22940 <para>
22941 <indexterm role="concept">
22942 <primary>not-QUIT, ACL for</primary>
22943 </indexterm>
22944 This option defines the ACL that is run when an SMTP session
22945 ends without a QUIT command being received.
22946 See chapter <xref linkend="CHAPACL"/> for further details.
22947 </para>
22948 <para>
22949 <indexterm role="option">
22950 <primary><option>acl_smtp_predata</option></primary>
22951 </indexterm>
22952 </para>
22953 <informaltable frame="all">
22954 <tgroup cols="4" colsep="0" rowsep="0">
22955 <colspec colwidth="8*" align="left"/>
22956 <colspec colwidth="6*" align="center"/>
22957 <colspec colwidth="6*" align="center"/>
22958 <colspec colwidth="6*" align="right"/>
22959 <tbody>
22960 <row>
22961 <entry><option>acl_smtp_predata</option></entry>
22962 <entry>Use: <emphasis>main</emphasis></entry>
22963 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22964 <entry>Default: <emphasis>unset</emphasis></entry>
22965 </row>
22966 </tbody>
22967 </tgroup>
22968 </informaltable>
22969 <para>
22970 This option defines the ACL that is run when an SMTP DATA command is
22971 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
22972 further details.
22973 </para>
22974 <para>
22975 <indexterm role="option">
22976 <primary><option>acl_smtp_quit</option></primary>
22977 </indexterm>
22978 </para>
22979 <informaltable frame="all">
22980 <tgroup cols="4" colsep="0" rowsep="0">
22981 <colspec colwidth="8*" align="left"/>
22982 <colspec colwidth="6*" align="center"/>
22983 <colspec colwidth="6*" align="center"/>
22984 <colspec colwidth="6*" align="right"/>
22985 <tbody>
22986 <row>
22987 <entry><option>acl_smtp_quit</option></entry>
22988 <entry>Use: <emphasis>main</emphasis></entry>
22989 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22990 <entry>Default: <emphasis>unset</emphasis></entry>
22991 </row>
22992 </tbody>
22993 </tgroup>
22994 </informaltable>
22995 <para>
22996 <indexterm role="concept">
22997 <primary>QUIT, ACL for</primary>
22998 </indexterm>
22999 This option defines the ACL that is run when an SMTP QUIT command is
23000 received. See chapter <xref linkend="CHAPACL"/> for further details.
23001 </para>
23002 <para>
23003 <indexterm role="option">
23004 <primary><option>acl_smtp_rcpt</option></primary>
23005 </indexterm>
23006 </para>
23007 <informaltable frame="all">
23008 <tgroup cols="4" colsep="0" rowsep="0">
23009 <colspec colwidth="8*" align="left"/>
23010 <colspec colwidth="6*" align="center"/>
23011 <colspec colwidth="6*" align="center"/>
23012 <colspec colwidth="6*" align="right"/>
23013 <tbody>
23014 <row>
23015 <entry><option>acl_smtp_rcpt</option></entry>
23016 <entry>Use: <emphasis>main</emphasis></entry>
23017 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23018 <entry>Default: <emphasis>unset</emphasis></entry>
23019 </row>
23020 </tbody>
23021 </tgroup>
23022 </informaltable>
23023 <para>
23024 <indexterm role="concept">
23025 <primary>RCPT</primary>
23026 <secondary>ACL for</secondary>
23027 </indexterm>
23028 This option defines the ACL that is run when an SMTP RCPT command is
23029 received. See chapter <xref linkend="CHAPACL"/> for further details.
23030 </para>
23031 <para>
23032 <indexterm role="option">
23033 <primary><option>acl_smtp_starttls</option></primary>
23034 </indexterm>
23035 </para>
23036 <informaltable frame="all">
23037 <tgroup cols="4" colsep="0" rowsep="0">
23038 <colspec colwidth="8*" align="left"/>
23039 <colspec colwidth="6*" align="center"/>
23040 <colspec colwidth="6*" align="center"/>
23041 <colspec colwidth="6*" align="right"/>
23042 <tbody>
23043 <row>
23044 <entry><option>acl_smtp_starttls</option></entry>
23045 <entry>Use: <emphasis>main</emphasis></entry>
23046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23047 <entry>Default: <emphasis>unset</emphasis></entry>
23048 </row>
23049 </tbody>
23050 </tgroup>
23051 </informaltable>
23052 <para>
23053 <indexterm role="concept">
23054 <primary>STARTTLS, ACL for</primary>
23055 </indexterm>
23056 This option defines the ACL that is run when an SMTP STARTTLS command is
23057 received. See chapter <xref linkend="CHAPACL"/> for further details.
23058 </para>
23059 <para>
23060 <indexterm role="option">
23061 <primary><option>acl_smtp_vrfy</option></primary>
23062 </indexterm>
23063 </para>
23064 <informaltable frame="all">
23065 <tgroup cols="4" colsep="0" rowsep="0">
23066 <colspec colwidth="8*" align="left"/>
23067 <colspec colwidth="6*" align="center"/>
23068 <colspec colwidth="6*" align="center"/>
23069 <colspec colwidth="6*" align="right"/>
23070 <tbody>
23071 <row>
23072 <entry><option>acl_smtp_vrfy</option></entry>
23073 <entry>Use: <emphasis>main</emphasis></entry>
23074 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23075 <entry>Default: <emphasis>unset</emphasis></entry>
23076 </row>
23077 </tbody>
23078 </tgroup>
23079 </informaltable>
23080 <para>
23081 <indexterm role="concept">
23082 <primary>VRFY</primary>
23083 <secondary>ACL for</secondary>
23084 </indexterm>
23085 This option defines the ACL that is run when an SMTP VRFY command is
23086 received. See chapter <xref linkend="CHAPACL"/> for further details.
23087 </para>
23088 <para>
23089 <indexterm role="option">
23090 <primary><option>add_environment</option></primary>
23091 </indexterm>
23092 </para>
23093 <informaltable frame="all">
23094 <tgroup cols="4" colsep="0" rowsep="0">
23095 <colspec colwidth="8*" align="left"/>
23096 <colspec colwidth="6*" align="center"/>
23097 <colspec colwidth="6*" align="center"/>
23098 <colspec colwidth="6*" align="right"/>
23099 <tbody>
23100 <row>
23101 <entry><option>add_environment</option></entry>
23102 <entry>Use: <emphasis>main</emphasis></entry>
23103 <entry>Type: <emphasis>string list</emphasis></entry>
23104 <entry>Default: <emphasis>empty</emphasis></entry>
23105 </row>
23106 </tbody>
23107 </tgroup>
23108 </informaltable>
23109 <para>
23110 <indexterm role="concept">
23111 <primary>environment</primary>
23112 <secondary>set values</secondary>
23113 </indexterm>
23114 This option allows to set individual environment variables that the
23115 currently linked libraries and programs in child processes use.
23116 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
23117 </para>
23118 <para>
23119 <indexterm role="option">
23120 <primary><option>admin_groups</option></primary>
23121 </indexterm>
23122 </para>
23123 <informaltable frame="all">
23124 <tgroup cols="4" colsep="0" rowsep="0">
23125 <colspec colwidth="8*" align="left"/>
23126 <colspec colwidth="6*" align="center"/>
23127 <colspec colwidth="6*" align="center"/>
23128 <colspec colwidth="6*" align="right"/>
23129 <tbody>
23130 <row>
23131 <entry><option>admin_groups</option></entry>
23132 <entry>Use: <emphasis>main</emphasis></entry>
23133 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23134 <entry>Default: <emphasis>unset</emphasis></entry>
23135 </row>
23136 </tbody>
23137 </tgroup>
23138 </informaltable>
23139 <para>
23140 <indexterm role="concept">
23141 <primary>admin user</primary>
23142 </indexterm>
23143 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
23144 current group or any of the supplementary groups of an Exim caller is in this
23145 colon-separated list, the caller has admin privileges. If all your system
23146 programmers are in a specific group, for example, you can give them all Exim
23147 admin privileges by putting that group in <option>admin_groups</option>. However, this does
23148 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
23149 To permit this, you have to add individuals to the Exim group.
23150 </para>
23151 <para>
23152 <indexterm role="option">
23153 <primary><option>allow_domain_literals</option></primary>
23154 </indexterm>
23155 </para>
23156 <informaltable frame="all">
23157 <tgroup cols="4" colsep="0" rowsep="0">
23158 <colspec colwidth="8*" align="left"/>
23159 <colspec colwidth="6*" align="center"/>
23160 <colspec colwidth="6*" align="center"/>
23161 <colspec colwidth="6*" align="right"/>
23162 <tbody>
23163 <row>
23164 <entry><option>allow_domain_literals</option></entry>
23165 <entry>Use: <emphasis>main</emphasis></entry>
23166 <entry>Type: <emphasis>boolean</emphasis></entry>
23167 <entry>Default: <emphasis>false</emphasis></entry>
23168 </row>
23169 </tbody>
23170 </tgroup>
23171 </informaltable>
23172 <para>
23173 <indexterm role="concept">
23174 <primary>domain literal</primary>
23175 </indexterm>
23176 If this option is set, the RFC 2822 domain literal format is permitted in
23177 email addresses. The option is not set by default, because the domain literal
23178 format is not normally required these days, and few people know about it. It
23179 has, however, been exploited by mail abusers.
23180 </para>
23181 <para>
23182 Unfortunately, it seems that some DNS black list maintainers are using this
23183 format to report black listing to postmasters. If you want to accept messages
23184 addressed to your hosts by IP address, you need to set
23185 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
23186 domains (defined in the named domain list <option>local_domains</option> in the default
23187 configuration). This <quote>magic string</quote> matches the domain literal form of all
23188 the local host&#x2019;s IP addresses.
23189 </para>
23190 <para>
23191 <indexterm role="option">
23192 <primary><option>allow_mx_to_ip</option></primary>
23193 </indexterm>
23194 </para>
23195 <informaltable frame="all">
23196 <tgroup cols="4" colsep="0" rowsep="0">
23197 <colspec colwidth="8*" align="left"/>
23198 <colspec colwidth="6*" align="center"/>
23199 <colspec colwidth="6*" align="center"/>
23200 <colspec colwidth="6*" align="right"/>
23201 <tbody>
23202 <row>
23203 <entry><option>allow_mx_to_ip</option></entry>
23204 <entry>Use: <emphasis>main</emphasis></entry>
23205 <entry>Type: <emphasis>boolean</emphasis></entry>
23206 <entry>Default: <emphasis>false</emphasis></entry>
23207 </row>
23208 </tbody>
23209 </tgroup>
23210 </informaltable>
23211 <para>
23212 <indexterm role="concept">
23213 <primary>MX record</primary>
23214 <secondary>pointing to IP address</secondary>
23215 </indexterm>
23216 It appears that more and more DNS zone administrators are breaking the rules
23217 and putting domain names that look like IP addresses on the right hand side of
23218 MX records. Exim follows the rules and rejects this, giving an error message
23219 that explains the misconfiguration. However, some other MTAs support this
23220 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
23221 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
23222 recommended, except when you have no other choice.
23223 </para>
23224 <para>
23225 <indexterm role="option">
23226 <primary><option>allow_utf8_domains</option></primary>
23227 </indexterm>
23228 </para>
23229 <informaltable frame="all">
23230 <tgroup cols="4" colsep="0" rowsep="0">
23231 <colspec colwidth="8*" align="left"/>
23232 <colspec colwidth="6*" align="center"/>
23233 <colspec colwidth="6*" align="center"/>
23234 <colspec colwidth="6*" align="right"/>
23235 <tbody>
23236 <row>
23237 <entry><option>allow_utf8_domains</option></entry>
23238 <entry>Use: <emphasis>main</emphasis></entry>
23239 <entry>Type: <emphasis>boolean</emphasis></entry>
23240 <entry>Default: <emphasis>false</emphasis></entry>
23241 </row>
23242 </tbody>
23243 </tgroup>
23244 </informaltable>
23245 <para>
23246 <indexterm role="concept">
23247 <primary>domain</primary>
23248 <secondary>UTF-8 characters in</secondary>
23249 </indexterm>
23250 <indexterm role="concept">
23251 <primary>UTF-8</primary>
23252 <secondary>in domain name</secondary>
23253 </indexterm>
23254 Lots of discussion is going on about internationalized domain names. One
23255 camp is strongly in favour of just using UTF-8 characters, and it seems
23256 that at least two other MTAs permit this. This option allows Exim users to
23257 experiment if they wish.
23258 </para>
23259 <para>
23260 If it is set true, Exim&#x2019;s domain parsing function allows valid
23261 UTF-8 multicharacters to appear in domain name components, in addition to
23262 letters, digits, and hyphens. However, just setting this option is not
23263 enough; if you want to look up these domain names in the DNS, you must also
23264 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
23265 suitable setting is:
23266 </para>
23267 <literallayout class="monospaced">
23268 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
23269   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
23270 </literallayout>
23271 <para>
23272 Alternatively, you can just disable this feature by setting
23273 </para>
23274 <literallayout class="monospaced">
23275 dns_check_names_pattern =
23276 </literallayout>
23277 <para>
23278 That is, set the option to an empty string so that no check is done.
23279 </para>
23280 <para>
23281 <indexterm role="option">
23282 <primary><option>auth_advertise_hosts</option></primary>
23283 </indexterm>
23284 </para>
23285 <informaltable frame="all">
23286 <tgroup cols="4" colsep="0" rowsep="0">
23287 <colspec colwidth="8*" align="left"/>
23288 <colspec colwidth="6*" align="center"/>
23289 <colspec colwidth="6*" align="center"/>
23290 <colspec colwidth="6*" align="right"/>
23291 <tbody>
23292 <row>
23293 <entry><option>auth_advertise_hosts</option></entry>
23294 <entry>Use: <emphasis>main</emphasis></entry>
23295 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23296 <entry>Default: <emphasis>*</emphasis></entry>
23297 </row>
23298 </tbody>
23299 </tgroup>
23300 </informaltable>
23301 <para>
23302 <indexterm role="concept">
23303 <primary>authentication</primary>
23304 <secondary>advertising</secondary>
23305 </indexterm>
23306 <indexterm role="concept">
23307 <primary>AUTH</primary>
23308 <secondary>advertising</secondary>
23309 </indexterm>
23310 If any server authentication mechanisms are configured, Exim advertises them in
23311 response to an EHLO command only if the calling host matches this list.
23312 Otherwise, Exim does not advertise AUTH.
23313 Exim does not accept AUTH commands from clients to which it has not
23314 advertised the availability of AUTH. The advertising of individual
23315 authentication mechanisms can be controlled by the use of the
23316 <option>server_advertise_condition</option> generic authenticator option on the individual
23317 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
23318 </para>
23319 <para>
23320 Certain mail clients (for example, Netscape) require the user to provide a name
23321 and password for authentication if AUTH is advertised, even though it may
23322 not be needed (the host may accept messages from hosts on its local LAN without
23323 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
23324 to make these clients more friendly by excluding them from the set of hosts to
23325 which Exim advertises AUTH.
23326 </para>
23327 <para>
23328 <indexterm role="concept">
23329 <primary>AUTH</primary>
23330 <secondary>advertising when encrypted</secondary>
23331 </indexterm>
23332 If you want to advertise the availability of AUTH only when the connection
23333 is encrypted using TLS, you can make use of the fact that the value of this
23334 option is expanded, with a setting like this:
23335 </para>
23336 <literallayout class="monospaced">
23337 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
23338 </literallayout>
23339 <para>
23340 <indexterm role="variable">
23341 <primary><varname>$tls_in_cipher</varname></primary>
23342 </indexterm>
23343 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
23344 the expansion is empty, thus matching no hosts. Otherwise, the result of the
23345 expansion is *, which matches all hosts.
23346 </para>
23347 <para>
23348 <indexterm role="option">
23349 <primary><option>auto_thaw</option></primary>
23350 </indexterm>
23351 </para>
23352 <informaltable frame="all">
23353 <tgroup cols="4" colsep="0" rowsep="0">
23354 <colspec colwidth="8*" align="left"/>
23355 <colspec colwidth="6*" align="center"/>
23356 <colspec colwidth="6*" align="center"/>
23357 <colspec colwidth="6*" align="right"/>
23358 <tbody>
23359 <row>
23360 <entry><option>auto_thaw</option></entry>
23361 <entry>Use: <emphasis>main</emphasis></entry>
23362 <entry>Type: <emphasis>time</emphasis></entry>
23363 <entry>Default: <emphasis>0s</emphasis></entry>
23364 </row>
23365 </tbody>
23366 </tgroup>
23367 </informaltable>
23368 <para>
23369 <indexterm role="concept">
23370 <primary>thawing messages</primary>
23371 </indexterm>
23372 <indexterm role="concept">
23373 <primary>unfreezing messages</primary>
23374 </indexterm>
23375 If this option is set to a time greater than zero, a queue runner will try a
23376 new delivery attempt on any frozen message, other than a bounce message, if
23377 this much time has passed since it was frozen. This may result in the message
23378 being re-frozen if nothing has changed since the last attempt. It is a way of
23379 saying <quote>keep on trying, even though there are big problems</quote>.
23380 </para>
23381 <para>
23382 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
23383 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
23384 thought to be very useful any more, and its use should probably be avoided.
23385 </para>
23386 <para>
23387 <indexterm role="option">
23388 <primary><option>av_scanner</option></primary>
23389 </indexterm>
23390 </para>
23391 <informaltable frame="all">
23392 <tgroup cols="4" colsep="0" rowsep="0">
23393 <colspec colwidth="8*" align="left"/>
23394 <colspec colwidth="6*" align="center"/>
23395 <colspec colwidth="6*" align="center"/>
23396 <colspec colwidth="6*" align="right"/>
23397 <tbody>
23398 <row>
23399 <entry><option>av_scanner</option></entry>
23400 <entry>Use: <emphasis>main</emphasis></entry>
23401 <entry>Type: <emphasis>string</emphasis></entry>
23402 <entry>Default: <emphasis>see below</emphasis></entry>
23403 </row>
23404 </tbody>
23405 </tgroup>
23406 </informaltable>
23407 <para>
23408 This option is available if Exim is built with the content-scanning extension.
23409 It specifies which anti-virus scanner to use. The default value is:
23410 </para>
23411 <literallayout class="monospaced">
23412 sophie:/var/run/sophie
23413 </literallayout>
23414 <para>
23415 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
23416 before use. See section <xref linkend="SECTscanvirus"/> for further details.
23417 </para>
23418 <para>
23419 <indexterm role="option">
23420 <primary><option>bi_command</option></primary>
23421 </indexterm>
23422 </para>
23423 <informaltable frame="all">
23424 <tgroup cols="4" colsep="0" rowsep="0">
23425 <colspec colwidth="8*" align="left"/>
23426 <colspec colwidth="6*" align="center"/>
23427 <colspec colwidth="6*" align="center"/>
23428 <colspec colwidth="6*" align="right"/>
23429 <tbody>
23430 <row>
23431 <entry><option>bi_command</option></entry>
23432 <entry>Use: <emphasis>main</emphasis></entry>
23433 <entry>Type: <emphasis>string</emphasis></entry>
23434 <entry>Default: <emphasis>unset</emphasis></entry>
23435 </row>
23436 </tbody>
23437 </tgroup>
23438 </informaltable>
23439 <para>
23440 <indexterm role="option">
23441 <primary><option>-bi</option></primary>
23442 </indexterm>
23443 This option supplies the name of a command that is run when Exim is called with
23444 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
23445 just the command name, it is not a complete command line. If an argument is
23446 required, it must come from the <option>-oA</option> command line option.
23447 </para>
23448 <para>
23449 <indexterm role="option">
23450 <primary><option>bounce_message_file</option></primary>
23451 </indexterm>
23452 </para>
23453 <informaltable frame="all">
23454 <tgroup cols="4" colsep="0" rowsep="0">
23455 <colspec colwidth="8*" align="left"/>
23456 <colspec colwidth="6*" align="center"/>
23457 <colspec colwidth="6*" align="center"/>
23458 <colspec colwidth="6*" align="right"/>
23459 <tbody>
23460 <row>
23461 <entry><option>bounce_message_file</option></entry>
23462 <entry>Use: <emphasis>main</emphasis></entry>
23463 <entry>Type: <emphasis>string</emphasis></entry>
23464 <entry>Default: <emphasis>unset</emphasis></entry>
23465 </row>
23466 </tbody>
23467 </tgroup>
23468 </informaltable>
23469 <para>
23470 <indexterm role="concept">
23471 <primary>bounce message</primary>
23472 <secondary>customizing</secondary>
23473 </indexterm>
23474 <indexterm role="concept">
23475 <primary>customizing</primary>
23476 <secondary>bounce message</secondary>
23477 </indexterm>
23478 This option defines a template file containing paragraphs of text to be used
23479 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
23480 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
23481 </para>
23482 <para>
23483 <indexterm role="option">
23484 <primary><option>bounce_message_text</option></primary>
23485 </indexterm>
23486 </para>
23487 <informaltable frame="all">
23488 <tgroup cols="4" colsep="0" rowsep="0">
23489 <colspec colwidth="8*" align="left"/>
23490 <colspec colwidth="6*" align="center"/>
23491 <colspec colwidth="6*" align="center"/>
23492 <colspec colwidth="6*" align="right"/>
23493 <tbody>
23494 <row>
23495 <entry><option>bounce_message_text</option></entry>
23496 <entry>Use: <emphasis>main</emphasis></entry>
23497 <entry>Type: <emphasis>string</emphasis></entry>
23498 <entry>Default: <emphasis>unset</emphasis></entry>
23499 </row>
23500 </tbody>
23501 </tgroup>
23502 </informaltable>
23503 <para>
23504 When this option is set, its contents are included in the default bounce
23505 message immediately after <quote>This message was created automatically by mail
23506 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
23507 </para>
23508 <para>
23509 <indexterm role="option">
23510 <primary><option>bounce_return_body</option></primary>
23511 </indexterm>
23512 </para>
23513 <informaltable frame="all">
23514 <tgroup cols="4" colsep="0" rowsep="0">
23515 <colspec colwidth="8*" align="left"/>
23516 <colspec colwidth="6*" align="center"/>
23517 <colspec colwidth="6*" align="center"/>
23518 <colspec colwidth="6*" align="right"/>
23519 <tbody>
23520 <row>
23521 <entry><option>bounce_return_body</option></entry>
23522 <entry>Use: <emphasis>main</emphasis></entry>
23523 <entry>Type: <emphasis>boolean</emphasis></entry>
23524 <entry>Default: <emphasis>true</emphasis></entry>
23525 </row>
23526 </tbody>
23527 </tgroup>
23528 </informaltable>
23529 <para>
23530 <indexterm role="concept">
23531 <primary>bounce message</primary>
23532 <secondary>including body</secondary>
23533 </indexterm>
23534 This option controls whether the body of an incoming message is included in a
23535 bounce message when <option>bounce_return_message</option> is true. The default setting
23536 causes the entire message, both header and body, to be returned (subject to the
23537 value of <option>bounce_return_size_limit</option>). If this option is false, only the
23538 message header is included. In the case of a non-SMTP message containing an
23539 error that is detected during reception, only those header lines preceding the
23540 point at which the error was detected are returned.
23541 <indexterm role="concept">
23542 <primary>bounce message</primary>
23543 <secondary>including original</secondary>
23544 </indexterm>
23545 </para>
23546 <para>
23547 <indexterm role="option">
23548 <primary><option>bounce_return_linesize_limit</option></primary>
23549 </indexterm>
23550 </para>
23551 <informaltable frame="all">
23552 <tgroup cols="4" colsep="0" rowsep="0">
23553 <colspec colwidth="8*" align="left"/>
23554 <colspec colwidth="6*" align="center"/>
23555 <colspec colwidth="6*" align="center"/>
23556 <colspec colwidth="6*" align="right"/>
23557 <tbody>
23558 <row>
23559 <entry><option>bounce_return_linesize_limit</option></entry>
23560 <entry>Use: <emphasis>main</emphasis></entry>
23561 <entry>Type: <emphasis>integer</emphasis></entry>
23562 <entry>Default: <emphasis>998</emphasis></entry>
23563 </row>
23564 </tbody>
23565 </tgroup>
23566 </informaltable>
23567 <para>
23568 <indexterm role="concept">
23569 <primary>size</primary>
23570 <secondary>of bounce lines, limit</secondary>
23571 </indexterm>
23572 <indexterm role="concept">
23573 <primary>bounce message</primary>
23574 <secondary>line length limit</secondary>
23575 </indexterm>
23576 <indexterm role="concept">
23577 <primary>limit</primary>
23578 <secondary>bounce message line length</secondary>
23579 </indexterm>
23580 This option sets a limit in bytes on the line length of messages
23581 that are returned to senders due to delivery problems,
23582 when <option>bounce_return_message</option> is true.
23583 The default value corresponds to RFC limits.
23584 If the message being returned has lines longer than this value it is
23585 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
23586 </para>
23587 <para>
23588 The option also applies to bounces returned when an error is detected
23589 during reception of a message.
23590 In this case lines from the original are truncated.
23591 </para>
23592 <para>
23593 The option does not apply to messages generated by an <command>autoreply</command> transport.
23594 </para>
23595 <para>
23596 <indexterm role="option">
23597 <primary><option>bounce_return_message</option></primary>
23598 </indexterm>
23599 </para>
23600 <informaltable frame="all">
23601 <tgroup cols="4" colsep="0" rowsep="0">
23602 <colspec colwidth="8*" align="left"/>
23603 <colspec colwidth="6*" align="center"/>
23604 <colspec colwidth="6*" align="center"/>
23605 <colspec colwidth="6*" align="right"/>
23606 <tbody>
23607 <row>
23608 <entry><option>bounce_return_message</option></entry>
23609 <entry>Use: <emphasis>main</emphasis></entry>
23610 <entry>Type: <emphasis>boolean</emphasis></entry>
23611 <entry>Default: <emphasis>true</emphasis></entry>
23612 </row>
23613 </tbody>
23614 </tgroup>
23615 </informaltable>
23616 <para>
23617 If this option is set false, none of the original message is included in
23618 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
23619 <option>bounce_return_body</option>.
23620 </para>
23621 <para>
23622 <indexterm role="option">
23623 <primary><option>bounce_return_size_limit</option></primary>
23624 </indexterm>
23625 </para>
23626 <informaltable frame="all">
23627 <tgroup cols="4" colsep="0" rowsep="0">
23628 <colspec colwidth="8*" align="left"/>
23629 <colspec colwidth="6*" align="center"/>
23630 <colspec colwidth="6*" align="center"/>
23631 <colspec colwidth="6*" align="right"/>
23632 <tbody>
23633 <row>
23634 <entry><option>bounce_return_size_limit</option></entry>
23635 <entry>Use: <emphasis>main</emphasis></entry>
23636 <entry>Type: <emphasis>integer</emphasis></entry>
23637 <entry>Default: <emphasis>100K</emphasis></entry>
23638 </row>
23639 </tbody>
23640 </tgroup>
23641 </informaltable>
23642 <para>
23643 <indexterm role="concept">
23644 <primary>size</primary>
23645 <secondary>of bounce, limit</secondary>
23646 </indexterm>
23647 <indexterm role="concept">
23648 <primary>bounce message</primary>
23649 <secondary>size limit</secondary>
23650 </indexterm>
23651 <indexterm role="concept">
23652 <primary>limit</primary>
23653 <secondary>bounce message size</secondary>
23654 </indexterm>
23655 This option sets a limit in bytes on the size of messages that are returned to
23656 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
23657 limit should be less than the value of the global <option>message_size_limit</option> and of
23658 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
23659 that Exim generates. If this option is set to zero there is no limit.
23660 </para>
23661 <para>
23662 When the body of any message that is to be included in a bounce message is
23663 greater than the limit, it is truncated, and a comment pointing this out is
23664 added at the top. The actual cutoff may be greater than the value given, owing
23665 to the use of buffering for transferring the message in chunks (typically 8K in
23666 size). The idea is to save bandwidth on those undeliverable 15-megabyte
23667 messages.
23668 </para>
23669 <para>
23670 <indexterm role="option">
23671 <primary><option>bounce_sender_authentication</option></primary>
23672 </indexterm>
23673 </para>
23674 <informaltable frame="all">
23675 <tgroup cols="4" colsep="0" rowsep="0">
23676 <colspec colwidth="8*" align="left"/>
23677 <colspec colwidth="6*" align="center"/>
23678 <colspec colwidth="6*" align="center"/>
23679 <colspec colwidth="6*" align="right"/>
23680 <tbody>
23681 <row>
23682 <entry><option>bounce_sender_authentication</option></entry>
23683 <entry>Use: <emphasis>main</emphasis></entry>
23684 <entry>Type: <emphasis>string</emphasis></entry>
23685 <entry>Default: <emphasis>unset</emphasis></entry>
23686 </row>
23687 </tbody>
23688 </tgroup>
23689 </informaltable>
23690 <para>
23691 <indexterm role="concept">
23692 <primary>bounce message</primary>
23693 <secondary>sender authentication</secondary>
23694 </indexterm>
23695 <indexterm role="concept">
23696 <primary>authentication</primary>
23697 <secondary>bounce message</secondary>
23698 </indexterm>
23699 <indexterm role="concept">
23700 <primary>AUTH</primary>
23701 <secondary>on bounce message</secondary>
23702 </indexterm>
23703 This option provides an authenticated sender address that is sent with any
23704 bounce messages generated by Exim that are sent over an authenticated SMTP
23705 connection. A typical setting might be:
23706 </para>
23707 <literallayout class="monospaced">
23708 bounce_sender_authentication = mailer-daemon@my.domain.example
23709 </literallayout>
23710 <para>
23711 which would cause bounce messages to be sent using the SMTP command:
23712 </para>
23713 <literallayout class="monospaced">
23714 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
23715 </literallayout>
23716 <para>
23717 The value of <option>bounce_sender_authentication</option> must always be a complete email
23718 address.
23719 </para>
23720 <para>
23721 <indexterm role="option">
23722 <primary><option>callout_domain_negative_expire</option></primary>
23723 </indexterm>
23724 </para>
23725 <informaltable frame="all">
23726 <tgroup cols="4" colsep="0" rowsep="0">
23727 <colspec colwidth="8*" align="left"/>
23728 <colspec colwidth="6*" align="center"/>
23729 <colspec colwidth="6*" align="center"/>
23730 <colspec colwidth="6*" align="right"/>
23731 <tbody>
23732 <row>
23733 <entry><option>callout_domain_negative_expire</option></entry>
23734 <entry>Use: <emphasis>main</emphasis></entry>
23735 <entry>Type: <emphasis>time</emphasis></entry>
23736 <entry>Default: <emphasis>3h</emphasis></entry>
23737 </row>
23738 </tbody>
23739 </tgroup>
23740 </informaltable>
23741 <para>
23742 <indexterm role="concept">
23743 <primary>caching</primary>
23744 <secondary>callout timeouts</secondary>
23745 </indexterm>
23746 <indexterm role="concept">
23747 <primary>callout</primary>
23748 <secondary>caching timeouts</secondary>
23749 </indexterm>
23750 This option specifies the expiry time for negative callout cache data for a
23751 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23752 section <xref linkend="SECTcallvercache"/> for details of the caching.
23753 </para>
23754 <para>
23755 <indexterm role="option">
23756 <primary><option>callout_domain_positive_expire</option></primary>
23757 </indexterm>
23758 </para>
23759 <informaltable frame="all">
23760 <tgroup cols="4" colsep="0" rowsep="0">
23761 <colspec colwidth="8*" align="left"/>
23762 <colspec colwidth="6*" align="center"/>
23763 <colspec colwidth="6*" align="center"/>
23764 <colspec colwidth="6*" align="right"/>
23765 <tbody>
23766 <row>
23767 <entry><option>callout_domain_positive_expire</option></entry>
23768 <entry>Use: <emphasis>main</emphasis></entry>
23769 <entry>Type: <emphasis>time</emphasis></entry>
23770 <entry>Default: <emphasis>7d</emphasis></entry>
23771 </row>
23772 </tbody>
23773 </tgroup>
23774 </informaltable>
23775 <para>
23776 This option specifies the expiry time for positive callout cache data for a
23777 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23778 section <xref linkend="SECTcallvercache"/> for details of the caching.
23779 </para>
23780 <para>
23781 <indexterm role="option">
23782 <primary><option>callout_negative_expire</option></primary>
23783 </indexterm>
23784 </para>
23785 <informaltable frame="all">
23786 <tgroup cols="4" colsep="0" rowsep="0">
23787 <colspec colwidth="8*" align="left"/>
23788 <colspec colwidth="6*" align="center"/>
23789 <colspec colwidth="6*" align="center"/>
23790 <colspec colwidth="6*" align="right"/>
23791 <tbody>
23792 <row>
23793 <entry><option>callout_negative_expire</option></entry>
23794 <entry>Use: <emphasis>main</emphasis></entry>
23795 <entry>Type: <emphasis>time</emphasis></entry>
23796 <entry>Default: <emphasis>2h</emphasis></entry>
23797 </row>
23798 </tbody>
23799 </tgroup>
23800 </informaltable>
23801 <para>
23802 This option specifies the expiry time for negative callout cache data for an
23803 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23804 section <xref linkend="SECTcallvercache"/> for details of the caching.
23805 </para>
23806 <para>
23807 <indexterm role="option">
23808 <primary><option>callout_positive_expire</option></primary>
23809 </indexterm>
23810 </para>
23811 <informaltable frame="all">
23812 <tgroup cols="4" colsep="0" rowsep="0">
23813 <colspec colwidth="8*" align="left"/>
23814 <colspec colwidth="6*" align="center"/>
23815 <colspec colwidth="6*" align="center"/>
23816 <colspec colwidth="6*" align="right"/>
23817 <tbody>
23818 <row>
23819 <entry><option>callout_positive_expire</option></entry>
23820 <entry>Use: <emphasis>main</emphasis></entry>
23821 <entry>Type: <emphasis>time</emphasis></entry>
23822 <entry>Default: <emphasis>24h</emphasis></entry>
23823 </row>
23824 </tbody>
23825 </tgroup>
23826 </informaltable>
23827 <para>
23828 This option specifies the expiry time for positive callout cache data for an
23829 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
23830 section <xref linkend="SECTcallvercache"/> for details of the caching.
23831 </para>
23832 <para>
23833 <indexterm role="option">
23834 <primary><option>callout_random_local_part</option></primary>
23835 </indexterm>
23836 </para>
23837 <informaltable frame="all">
23838 <tgroup cols="4" colsep="0" rowsep="0">
23839 <colspec colwidth="8*" align="left"/>
23840 <colspec colwidth="6*" align="center"/>
23841 <colspec colwidth="6*" align="center"/>
23842 <colspec colwidth="6*" align="right"/>
23843 <tbody>
23844 <row>
23845 <entry><option>callout_random_local_part</option></entry>
23846 <entry>Use: <emphasis>main</emphasis></entry>
23847 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23848 <entry>Default: <emphasis>see below</emphasis></entry>
23849 </row>
23850 </tbody>
23851 </tgroup>
23852 </informaltable>
23853 <para>
23854 This option defines the <quote>random</quote> local part that can be used as part of
23855 callout verification. The default value is
23856 </para>
23857 <literallayout class="monospaced">
23858 $primary_hostname-$tod_epoch-testing
23859 </literallayout>
23860 <para>
23861 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
23862 </para>
23863 <para>
23864 <indexterm role="option">
23865 <primary><option>check_log_inodes</option></primary>
23866 </indexterm>
23867 </para>
23868 <informaltable frame="all">
23869 <tgroup cols="4" colsep="0" rowsep="0">
23870 <colspec colwidth="8*" align="left"/>
23871 <colspec colwidth="6*" align="center"/>
23872 <colspec colwidth="6*" align="center"/>
23873 <colspec colwidth="6*" align="right"/>
23874 <tbody>
23875 <row>
23876 <entry><option>check_log_inodes</option></entry>
23877 <entry>Use: <emphasis>main</emphasis></entry>
23878 <entry>Type: <emphasis>integer</emphasis></entry>
23879 <entry>Default: <emphasis>100</emphasis></entry>
23880 </row>
23881 </tbody>
23882 </tgroup>
23883 </informaltable>
23884 <para>
23885 See <option>check_spool_space</option> below.
23886 </para>
23887 <para>
23888 <indexterm role="option">
23889 <primary><option>check_log_space</option></primary>
23890 </indexterm>
23891 </para>
23892 <informaltable frame="all">
23893 <tgroup cols="4" colsep="0" rowsep="0">
23894 <colspec colwidth="8*" align="left"/>
23895 <colspec colwidth="6*" align="center"/>
23896 <colspec colwidth="6*" align="center"/>
23897 <colspec colwidth="6*" align="right"/>
23898 <tbody>
23899 <row>
23900 <entry><option>check_log_space</option></entry>
23901 <entry>Use: <emphasis>main</emphasis></entry>
23902 <entry>Type: <emphasis>integer</emphasis></entry>
23903 <entry>Default: <emphasis>10M</emphasis></entry>
23904 </row>
23905 </tbody>
23906 </tgroup>
23907 </informaltable>
23908 <para>
23909 See <option>check_spool_space</option> below.
23910 </para>
23911 <para>
23912 <indexterm role="option">
23913 <primary><option>check_rfc2047_length</option></primary>
23914 </indexterm>
23915 <indexterm role="concept">
23916 <primary>RFC 2047</primary>
23917 <secondary>disabling length check</secondary>
23918 </indexterm>
23919 <indexterm role="option">
23920 <primary><option>check_rfc2047_length</option></primary>
23921 </indexterm>
23922 </para>
23923 <informaltable frame="all">
23924 <tgroup cols="4" colsep="0" rowsep="0">
23925 <colspec colwidth="8*" align="left"/>
23926 <colspec colwidth="6*" align="center"/>
23927 <colspec colwidth="6*" align="center"/>
23928 <colspec colwidth="6*" align="right"/>
23929 <tbody>
23930 <row>
23931 <entry><option>check_rfc2047_length</option></entry>
23932 <entry>Use: <emphasis>main</emphasis></entry>
23933 <entry>Type: <emphasis>boolean</emphasis></entry>
23934 <entry>Default: <emphasis>true</emphasis></entry>
23935 </row>
23936 </tbody>
23937 </tgroup>
23938 </informaltable>
23939 <para>
23940 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
23941 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
23942 word; strings to be encoded that exceed this length are supposed to use
23943 multiple encoded words. By default, Exim does not recognize encoded words that
23944 exceed the maximum length. However, it seems that some software, in violation
23945 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
23946 set false, Exim recognizes encoded words of any length.
23947 </para>
23948 <para>
23949 <indexterm role="option">
23950 <primary><option>check_spool_inodes</option></primary>
23951 </indexterm>
23952 </para>
23953 <informaltable frame="all">
23954 <tgroup cols="4" colsep="0" rowsep="0">
23955 <colspec colwidth="8*" align="left"/>
23956 <colspec colwidth="6*" align="center"/>
23957 <colspec colwidth="6*" align="center"/>
23958 <colspec colwidth="6*" align="right"/>
23959 <tbody>
23960 <row>
23961 <entry><option>check_spool_inodes</option></entry>
23962 <entry>Use: <emphasis>main</emphasis></entry>
23963 <entry>Type: <emphasis>integer</emphasis></entry>
23964 <entry>Default: <emphasis>100</emphasis></entry>
23965 </row>
23966 </tbody>
23967 </tgroup>
23968 </informaltable>
23969 <para>
23970 See <option>check_spool_space</option> below.
23971 </para>
23972 <para>
23973 <indexterm role="option">
23974 <primary><option>check_spool_space</option></primary>
23975 </indexterm>
23976 </para>
23977 <informaltable frame="all">
23978 <tgroup cols="4" colsep="0" rowsep="0">
23979 <colspec colwidth="8*" align="left"/>
23980 <colspec colwidth="6*" align="center"/>
23981 <colspec colwidth="6*" align="center"/>
23982 <colspec colwidth="6*" align="right"/>
23983 <tbody>
23984 <row>
23985 <entry><option>check_spool_space</option></entry>
23986 <entry>Use: <emphasis>main</emphasis></entry>
23987 <entry>Type: <emphasis>integer</emphasis></entry>
23988 <entry>Default: <emphasis>10M</emphasis></entry>
23989 </row>
23990 </tbody>
23991 </tgroup>
23992 </informaltable>
23993 <para>
23994 <indexterm role="concept">
23995 <primary>checking disk space</primary>
23996 </indexterm>
23997 <indexterm role="concept">
23998 <primary>disk space, checking</primary>
23999 </indexterm>
24000 <indexterm role="concept">
24001 <primary>spool directory</primary>
24002 <secondary>checking space</secondary>
24003 </indexterm>
24004 The four <option>check_...</option> options allow for checking of disk resources before a
24005 message is accepted.
24006 </para>
24007 <para>
24008 <indexterm role="variable">
24009 <primary><varname>$log_inodes</varname></primary>
24010 </indexterm>
24011 <indexterm role="variable">
24012 <primary><varname>$log_space</varname></primary>
24013 </indexterm>
24014 <indexterm role="variable">
24015 <primary><varname>$spool_inodes</varname></primary>
24016 </indexterm>
24017 <indexterm role="variable">
24018 <primary><varname>$spool_space</varname></primary>
24019 </indexterm>
24020 When any of these options are nonzero, they apply to all incoming messages. If you
24021 want to apply different checks to different kinds of message, you can do so by
24022 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
24023 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
24024 </para>
24025 <para>
24026 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
24027 either value is greater than zero, for example:
24028 </para>
24029 <literallayout class="monospaced">
24030 check_spool_space = 100M
24031 check_spool_inodes = 100
24032 </literallayout>
24033 <para>
24034 The spool partition is the one that contains the directory defined by
24035 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
24036 transit.
24037 </para>
24038 <para>
24039 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
24040 files are written if either is greater than zero. These should be set only if
24041 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
24042 </para>
24043 <para>
24044 If there is less space or fewer inodes than requested, Exim refuses to accept
24045 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
24046 error response to the MAIL command. If ESMTP is in use and there was a
24047 SIZE parameter on the MAIL command, its value is added to the
24048 <option>check_spool_space</option> value, and the check is performed even if
24049 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
24050 </para>
24051 <para>
24052 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
24053 number of kilobytes (though specified in bytes).
24054 If a non-multiple of 1024 is specified, it is rounded up.
24055 </para>
24056 <para>
24057 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
24058 failure a message is written to stderr and Exim exits with a non-zero code, as
24059 it obviously cannot send an error message of any kind.
24060 </para>
24061 <para>
24062 There is a slight performance penalty for these checks.
24063 Versions of Exim preceding 4.88 had these disabled by default;
24064 high-rate installations confident they will never run out of resources
24065 may wish to deliberately disable them.
24066 </para>
24067 <para>
24068 <indexterm role="option">
24069 <primary><option>chunking_advertise_hosts</option></primary>
24070 </indexterm>
24071 </para>
24072 <informaltable frame="all">
24073 <tgroup cols="4" colsep="0" rowsep="0">
24074 <colspec colwidth="8*" align="left"/>
24075 <colspec colwidth="6*" align="center"/>
24076 <colspec colwidth="6*" align="center"/>
24077 <colspec colwidth="6*" align="right"/>
24078 <tbody>
24079 <row>
24080 <entry><option>chunking_advertise_hosts</option></entry>
24081 <entry>Use: <emphasis>main</emphasis></entry>
24082 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24083 <entry>Default: <emphasis>*</emphasis></entry>
24084 </row>
24085 </tbody>
24086 </tgroup>
24087 </informaltable>
24088 <para>
24089 <indexterm role="concept">
24090 <primary>CHUNKING</primary>
24091 <secondary>advertisement</secondary>
24092 </indexterm>
24093 <indexterm role="concept">
24094 <primary>RFC 3030</primary>
24095 <secondary>CHUNKING</secondary>
24096 </indexterm>
24097 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
24098 these hosts.
24099 Hosts may use the BDAT command as an alternate to DATA.
24100 </para>
24101 <para revisionflag="changed">
24102 <indexterm role="option">
24103 <primary><option>debug_store</option></primary>
24104 </indexterm>
24105 </para>
24106 <informaltable frame="all" revisionflag="changed">
24107 <tgroup cols="4" colsep="0" rowsep="0">
24108 <colspec colwidth="8*" align="left"/>
24109 <colspec colwidth="6*" align="center"/>
24110 <colspec colwidth="6*" align="center"/>
24111 <colspec colwidth="6*" align="right"/>
24112 <tbody>
24113 <row>
24114 <entry><option>debug_store</option></entry>
24115 <entry>Use: <emphasis>main</emphasis></entry>
24116 <entry>Type: <emphasis>boolean</emphasis></entry>
24117 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
24118 </row>
24119 </tbody>
24120 </tgroup>
24121 </informaltable>
24122 <para revisionflag="changed">
24123 <indexterm role="concept">
24124 <primary>debugging</primary>
24125 <secondary>memory corruption</secondary>
24126 </indexterm>
24127 <indexterm role="concept">
24128 <primary>memory</primary>
24129 <secondary>debugging</secondary>
24130 </indexterm>
24131 This option, when true, enables extra checking in Exim&#x2019;s internal memory
24132 management.  For use when a memory corruption issue is being investigated,
24133 it should normally be left as default.
24134 </para>
24135 <para>
24136 <indexterm role="option">
24137 <primary><option>daemon_smtp_ports</option></primary>
24138 </indexterm>
24139 </para>
24140 <informaltable frame="all">
24141 <tgroup cols="4" colsep="0" rowsep="0">
24142 <colspec colwidth="8*" align="left"/>
24143 <colspec colwidth="6*" align="center"/>
24144 <colspec colwidth="6*" align="center"/>
24145 <colspec colwidth="6*" align="right"/>
24146 <tbody>
24147 <row>
24148 <entry><option>daemon_smtp_ports</option></entry>
24149 <entry>Use: <emphasis>main</emphasis></entry>
24150 <entry>Type: <emphasis>string</emphasis></entry>
24151 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
24152 </row>
24153 </tbody>
24154 </tgroup>
24155 </informaltable>
24156 <para>
24157 <indexterm role="concept">
24158 <primary>port</primary>
24159 <secondary>for daemon</secondary>
24160 </indexterm>
24161 <indexterm role="concept">
24162 <primary>TCP/IP</primary>
24163 <secondary>setting listening ports</secondary>
24164 </indexterm>
24165 This option specifies one or more default SMTP ports on which the Exim daemon
24166 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
24167 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
24168 </para>
24169 <para>
24170 <indexterm role="option">
24171 <primary><option>daemon_startup_retries</option></primary>
24172 </indexterm>
24173 </para>
24174 <informaltable frame="all">
24175 <tgroup cols="4" colsep="0" rowsep="0">
24176 <colspec colwidth="8*" align="left"/>
24177 <colspec colwidth="6*" align="center"/>
24178 <colspec colwidth="6*" align="center"/>
24179 <colspec colwidth="6*" align="right"/>
24180 <tbody>
24181 <row>
24182 <entry><option>daemon_startup_retries</option></entry>
24183 <entry>Use: <emphasis>main</emphasis></entry>
24184 <entry>Type: <emphasis>integer</emphasis></entry>
24185 <entry>Default: <emphasis>9</emphasis></entry>
24186 </row>
24187 </tbody>
24188 </tgroup>
24189 </informaltable>
24190 <para>
24191 <indexterm role="concept">
24192 <primary>daemon startup, retrying</primary>
24193 </indexterm>
24194 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
24195 the daemon at startup when it cannot immediately bind a listening socket
24196 (typically because the socket is already in use): <option>daemon_startup_retries</option>
24197 defines the number of retries after the first failure, and
24198 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
24199 </para>
24200 <para>
24201 <indexterm role="option">
24202 <primary><option>daemon_startup_sleep</option></primary>
24203 </indexterm>
24204 </para>
24205 <informaltable frame="all">
24206 <tgroup cols="4" colsep="0" rowsep="0">
24207 <colspec colwidth="8*" align="left"/>
24208 <colspec colwidth="6*" align="center"/>
24209 <colspec colwidth="6*" align="center"/>
24210 <colspec colwidth="6*" align="right"/>
24211 <tbody>
24212 <row>
24213 <entry><option>daemon_startup_sleep</option></entry>
24214 <entry>Use: <emphasis>main</emphasis></entry>
24215 <entry>Type: <emphasis>time</emphasis></entry>
24216 <entry>Default: <emphasis>30s</emphasis></entry>
24217 </row>
24218 </tbody>
24219 </tgroup>
24220 </informaltable>
24221 <para>
24222 See <option>daemon_startup_retries</option>.
24223 </para>
24224 <para>
24225 <indexterm role="option">
24226 <primary><option>delay_warning</option></primary>
24227 </indexterm>
24228 </para>
24229 <informaltable frame="all">
24230 <tgroup cols="4" colsep="0" rowsep="0">
24231 <colspec colwidth="8*" align="left"/>
24232 <colspec colwidth="6*" align="center"/>
24233 <colspec colwidth="6*" align="center"/>
24234 <colspec colwidth="6*" align="right"/>
24235 <tbody>
24236 <row>
24237 <entry><option>delay_warning</option></entry>
24238 <entry>Use: <emphasis>main</emphasis></entry>
24239 <entry>Type: <emphasis>time list</emphasis></entry>
24240 <entry>Default: <emphasis>24h</emphasis></entry>
24241 </row>
24242 </tbody>
24243 </tgroup>
24244 </informaltable>
24245 <para>
24246 <indexterm role="concept">
24247 <primary>warning of delay</primary>
24248 </indexterm>
24249 <indexterm role="concept">
24250 <primary>delay warning, specifying</primary>
24251 </indexterm>
24252 <indexterm role="concept">
24253 <primary>queue</primary>
24254 <secondary>delay warning</secondary>
24255 </indexterm>
24256 When a message is delayed, Exim sends a warning message to the sender at
24257 intervals specified by this option. The data is a colon-separated list of times
24258 after which to send warning messages. If the value of the option is an empty
24259 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
24260 message has been on the queue for longer than the last time, the last interval
24261 between the times is used to compute subsequent warning times. For example,
24262 with
24263 </para>
24264 <literallayout class="monospaced">
24265 delay_warning = 4h:8h:24h
24266 </literallayout>
24267 <para>
24268 the first message is sent after 4 hours, the second after 8 hours, and
24269 the third one after 24 hours. After that, messages are sent every 16 hours,
24270 because that is the interval between the last two times on the list. If you set
24271 just one time, it specifies the repeat interval. For example, with:
24272 </para>
24273 <literallayout class="monospaced">
24274 delay_warning = 6h
24275 </literallayout>
24276 <para>
24277 messages are repeated every six hours. To stop warnings after a given time, set
24278 a very large time at the end of the list. For example:
24279 </para>
24280 <literallayout class="monospaced">
24281 delay_warning = 2h:12h:99d
24282 </literallayout>
24283 <para>
24284 Note that the option is only evaluated at the time a delivery attempt fails,
24285 which depends on retry and queue-runner configuration.
24286 Typically retries will be configured more frequently than warning messages.
24287 </para>
24288 <para>
24289 <indexterm role="option">
24290 <primary><option>delay_warning_condition</option></primary>
24291 </indexterm>
24292 </para>
24293 <informaltable frame="all">
24294 <tgroup cols="4" colsep="0" rowsep="0">
24295 <colspec colwidth="8*" align="left"/>
24296 <colspec colwidth="6*" align="center"/>
24297 <colspec colwidth="6*" align="center"/>
24298 <colspec colwidth="6*" align="right"/>
24299 <tbody>
24300 <row>
24301 <entry><option>delay_warning_condition</option></entry>
24302 <entry>Use: <emphasis>main</emphasis></entry>
24303 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24304 <entry>Default: <emphasis>see below</emphasis></entry>
24305 </row>
24306 </tbody>
24307 </tgroup>
24308 </informaltable>
24309 <para>
24310 <indexterm role="variable">
24311 <primary><varname>$domain</varname></primary>
24312 </indexterm>
24313 The string is expanded at the time a warning message might be sent. If all the
24314 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
24315 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
24316 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
24317 <quote>false</quote> (the comparison being done caselessly) then the warning message is
24318 not sent. The default is:
24319 </para>
24320 <literallayout class="monospaced">
24321 delay_warning_condition = ${if or {\
24322   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
24323   { match{$h_precedence:}{(?i)bulk|list|junk} }\
24324   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
24325   } {no}{yes}}
24326 </literallayout>
24327 <para>
24328 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
24329 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
24330 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
24331 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
24332 </para>
24333 <para>
24334 <indexterm role="option">
24335 <primary><option>deliver_drop_privilege</option></primary>
24336 </indexterm>
24337 </para>
24338 <informaltable frame="all">
24339 <tgroup cols="4" colsep="0" rowsep="0">
24340 <colspec colwidth="8*" align="left"/>
24341 <colspec colwidth="6*" align="center"/>
24342 <colspec colwidth="6*" align="center"/>
24343 <colspec colwidth="6*" align="right"/>
24344 <tbody>
24345 <row>
24346 <entry><option>deliver_drop_privilege</option></entry>
24347 <entry>Use: <emphasis>main</emphasis></entry>
24348 <entry>Type: <emphasis>boolean</emphasis></entry>
24349 <entry>Default: <emphasis>false</emphasis></entry>
24350 </row>
24351 </tbody>
24352 </tgroup>
24353 </informaltable>
24354 <para>
24355 <indexterm role="concept">
24356 <primary>unprivileged delivery</primary>
24357 </indexterm>
24358 <indexterm role="concept">
24359 <primary>delivery</primary>
24360 <secondary>unprivileged</secondary>
24361 </indexterm>
24362 If this option is set true, Exim drops its root privilege at the start of a
24363 delivery process, and runs as the Exim user throughout. This severely restricts
24364 the kinds of local delivery that are possible, but is viable in certain types
24365 of configuration. There is a discussion about the use of root privilege in
24366 chapter <xref linkend="CHAPsecurity"/>.
24367 </para>
24368 <para>
24369 <indexterm role="option">
24370 <primary><option>deliver_queue_load_max</option></primary>
24371 </indexterm>
24372 </para>
24373 <informaltable frame="all">
24374 <tgroup cols="4" colsep="0" rowsep="0">
24375 <colspec colwidth="8*" align="left"/>
24376 <colspec colwidth="6*" align="center"/>
24377 <colspec colwidth="6*" align="center"/>
24378 <colspec colwidth="6*" align="right"/>
24379 <tbody>
24380 <row>
24381 <entry><option>deliver_queue_load_max</option></entry>
24382 <entry>Use: <emphasis>main</emphasis></entry>
24383 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24384 <entry>Default: <emphasis>unset</emphasis></entry>
24385 </row>
24386 </tbody>
24387 </tgroup>
24388 </informaltable>
24389 <para>
24390 <indexterm role="concept">
24391 <primary>load average</primary>
24392 </indexterm>
24393 <indexterm role="concept">
24394 <primary>queue runner</primary>
24395 <secondary>abandoning</secondary>
24396 </indexterm>
24397 When this option is set, a queue run is abandoned if the system load average
24398 becomes greater than the value of the option. The option has no effect on
24399 ancient operating systems on which Exim cannot determine the load average.
24400 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
24401 </para>
24402 <para>
24403 <indexterm role="option">
24404 <primary><option>delivery_date_remove</option></primary>
24405 </indexterm>
24406 </para>
24407 <informaltable frame="all">
24408 <tgroup cols="4" colsep="0" rowsep="0">
24409 <colspec colwidth="8*" align="left"/>
24410 <colspec colwidth="6*" align="center"/>
24411 <colspec colwidth="6*" align="center"/>
24412 <colspec colwidth="6*" align="right"/>
24413 <tbody>
24414 <row>
24415 <entry><option>delivery_date_remove</option></entry>
24416 <entry>Use: <emphasis>main</emphasis></entry>
24417 <entry>Type: <emphasis>boolean</emphasis></entry>
24418 <entry>Default: <emphasis>true</emphasis></entry>
24419 </row>
24420 </tbody>
24421 </tgroup>
24422 </informaltable>
24423 <para>
24424 <indexterm role="concept">
24425 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
24426 </indexterm>
24427 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
24428 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
24429 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
24430 should not be present in incoming messages, and this option causes them to be
24431 removed at the time the message is received, to avoid any problems that might
24432 occur when a delivered message is subsequently sent on to some other recipient.
24433 </para>
24434 <para>
24435 <indexterm role="option">
24436 <primary><option>disable_fsync</option></primary>
24437 </indexterm>
24438 </para>
24439 <informaltable frame="all">
24440 <tgroup cols="4" colsep="0" rowsep="0">
24441 <colspec colwidth="8*" align="left"/>
24442 <colspec colwidth="6*" align="center"/>
24443 <colspec colwidth="6*" align="center"/>
24444 <colspec colwidth="6*" align="right"/>
24445 <tbody>
24446 <row>
24447 <entry><option>disable_fsync</option></entry>
24448 <entry>Use: <emphasis>main</emphasis></entry>
24449 <entry>Type: <emphasis>boolean</emphasis></entry>
24450 <entry>Default: <emphasis>false</emphasis></entry>
24451 </row>
24452 </tbody>
24453 </tgroup>
24454 </informaltable>
24455 <para>
24456 <indexterm role="concept">
24457 <primary><function>fsync()</function>, disabling</primary>
24458 </indexterm>
24459 This option is available only if Exim was built with the compile-time option
24460 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
24461 a runtime configuration generates an <quote>unknown option</quote> error. You should not
24462 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
24463 really, really, really understand what you are doing. <emphasis>No pre-compiled
24464 distributions of Exim should ever make this option available.</emphasis>
24465 </para>
24466 <para>
24467 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
24468 updated files&#x2019; data to be written to disc before continuing. Unexpected events
24469 such as crashes and power outages may cause data to be lost or scrambled.
24470 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
24471 </para>
24472 <para>
24473 <indexterm role="option">
24474 <primary><option>disable_ipv6</option></primary>
24475 </indexterm>
24476 </para>
24477 <informaltable frame="all">
24478 <tgroup cols="4" colsep="0" rowsep="0">
24479 <colspec colwidth="8*" align="left"/>
24480 <colspec colwidth="6*" align="center"/>
24481 <colspec colwidth="6*" align="center"/>
24482 <colspec colwidth="6*" align="right"/>
24483 <tbody>
24484 <row>
24485 <entry><option>disable_ipv6</option></entry>
24486 <entry>Use: <emphasis>main</emphasis></entry>
24487 <entry>Type: <emphasis>boolean</emphasis></entry>
24488 <entry>Default: <emphasis>false</emphasis></entry>
24489 </row>
24490 </tbody>
24491 </tgroup>
24492 </informaltable>
24493 <para>
24494 <indexterm role="concept">
24495 <primary>IPv6</primary>
24496 <secondary>disabling</secondary>
24497 </indexterm>
24498 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
24499 activities take place. AAAA records are never looked up, and any IPv6 addresses
24500 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
24501 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
24502 to handle IPv6 literal addresses.
24503 </para>
24504 <para>
24505 <indexterm role="option">
24506 <primary><option>dkim_verify_signers</option></primary>
24507 </indexterm>
24508 </para>
24509 <informaltable frame="all">
24510 <tgroup cols="4" colsep="0" rowsep="0">
24511 <colspec colwidth="8*" align="left"/>
24512 <colspec colwidth="6*" align="center"/>
24513 <colspec colwidth="6*" align="center"/>
24514 <colspec colwidth="6*" align="right"/>
24515 <tbody>
24516 <row>
24517 <entry><option>dkim_verify_signers</option></entry>
24518 <entry>Use: <emphasis>main</emphasis></entry>
24519 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24520 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
24521 </row>
24522 </tbody>
24523 </tgroup>
24524 </informaltable>
24525 <para>
24526 <indexterm role="concept">
24527 <primary>DKIM</primary>
24528 <secondary>controlling calls to the ACL</secondary>
24529 </indexterm>
24530 This option gives a list of DKIM domains for which the DKIM ACL is run.
24531 It is expanded after the message is received; by default it runs
24532 the ACL once for each signature in the message.
24533 See chapter <xref linkend="CHAPdkim"/>.
24534 </para>
24535 <para>
24536 <indexterm role="option">
24537 <primary><option>dns_again_means_nonexist</option></primary>
24538 </indexterm>
24539 </para>
24540 <informaltable frame="all">
24541 <tgroup cols="4" colsep="0" rowsep="0">
24542 <colspec colwidth="8*" align="left"/>
24543 <colspec colwidth="6*" align="center"/>
24544 <colspec colwidth="6*" align="center"/>
24545 <colspec colwidth="6*" align="right"/>
24546 <tbody>
24547 <row>
24548 <entry><option>dns_again_means_nonexist</option></entry>
24549 <entry>Use: <emphasis>main</emphasis></entry>
24550 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24551 <entry>Default: <emphasis>unset</emphasis></entry>
24552 </row>
24553 </tbody>
24554 </tgroup>
24555 </informaltable>
24556 <para>
24557 <indexterm role="concept">
24558 <primary>DNS</primary>
24559 <secondary><quote>try again</quote> response; overriding</secondary>
24560 </indexterm>
24561 DNS lookups give a <quote>try again</quote> response for the DNS errors
24562 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
24563 keep trying to deliver a message, or to give repeated temporary errors to
24564 incoming mail. Sometimes the effect is caused by a badly set up name server and
24565 may persist for a long time. If a domain which exhibits this problem matches
24566 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
24567 This option should be used with care. You can make it apply to reverse lookups
24568 by a setting such as this:
24569 </para>
24570 <literallayout class="monospaced">
24571 dns_again_means_nonexist = *.in-addr.arpa
24572 </literallayout>
24573 <para>
24574 This option applies to all DNS lookups that Exim does. It also applies when the
24575 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
24576 since these are most likely to be caused by DNS lookup problems. The
24577 <command>dnslookup</command> router has some options of its own for controlling what happens
24578 when lookups for MX or SRV records give temporary errors. These more specific
24579 options are applied after this global option.
24580 </para>
24581 <para>
24582 <indexterm role="option">
24583 <primary><option>dns_check_names_pattern</option></primary>
24584 </indexterm>
24585 </para>
24586 <informaltable frame="all">
24587 <tgroup cols="4" colsep="0" rowsep="0">
24588 <colspec colwidth="8*" align="left"/>
24589 <colspec colwidth="6*" align="center"/>
24590 <colspec colwidth="6*" align="center"/>
24591 <colspec colwidth="6*" align="right"/>
24592 <tbody>
24593 <row>
24594 <entry><option>dns_check_names_pattern</option></entry>
24595 <entry>Use: <emphasis>main</emphasis></entry>
24596 <entry>Type: <emphasis>string</emphasis></entry>
24597 <entry>Default: <emphasis>see below</emphasis></entry>
24598 </row>
24599 </tbody>
24600 </tgroup>
24601 </informaltable>
24602 <para>
24603 <indexterm role="concept">
24604 <primary>DNS</primary>
24605 <secondary>pre-check of name syntax</secondary>
24606 </indexterm>
24607 When this option is set to a non-empty string, it causes Exim to check domain
24608 names for characters that are not allowed in host names before handing them to
24609 the DNS resolver, because some resolvers give temporary errors for names that
24610 contain unusual characters. If a domain name contains any unwanted characters,
24611 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
24612 done by matching the domain name against a regular expression, which is the
24613 value of this option. The default pattern is
24614 </para>
24615 <literallayout class="monospaced">
24616 dns_check_names_pattern = \
24617   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
24618 </literallayout>
24619 <para>
24620 which permits only letters, digits, slashes, and hyphens in components, but
24621 they must start and end with a letter or digit. Slashes are not, in fact,
24622 permitted in host names, but they are found in certain NS records (which can be
24623 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
24624 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
24625 empty string.
24626 </para>
24627 <para>
24628 <indexterm role="option">
24629 <primary><option>dns_csa_search_limit</option></primary>
24630 </indexterm>
24631 </para>
24632 <informaltable frame="all">
24633 <tgroup cols="4" colsep="0" rowsep="0">
24634 <colspec colwidth="8*" align="left"/>
24635 <colspec colwidth="6*" align="center"/>
24636 <colspec colwidth="6*" align="center"/>
24637 <colspec colwidth="6*" align="right"/>
24638 <tbody>
24639 <row>
24640 <entry><option>dns_csa_search_limit</option></entry>
24641 <entry>Use: <emphasis>main</emphasis></entry>
24642 <entry>Type: <emphasis>integer</emphasis></entry>
24643 <entry>Default: <emphasis>5</emphasis></entry>
24644 </row>
24645 </tbody>
24646 </tgroup>
24647 </informaltable>
24648 <para>
24649 This option controls the depth of parental searching for CSA SRV records in the
24650 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
24651 </para>
24652 <para>
24653 <indexterm role="option">
24654 <primary><option>dns_csa_use_reverse</option></primary>
24655 </indexterm>
24656 </para>
24657 <informaltable frame="all">
24658 <tgroup cols="4" colsep="0" rowsep="0">
24659 <colspec colwidth="8*" align="left"/>
24660 <colspec colwidth="6*" align="center"/>
24661 <colspec colwidth="6*" align="center"/>
24662 <colspec colwidth="6*" align="right"/>
24663 <tbody>
24664 <row>
24665 <entry><option>dns_csa_use_reverse</option></entry>
24666 <entry>Use: <emphasis>main</emphasis></entry>
24667 <entry>Type: <emphasis>boolean</emphasis></entry>
24668 <entry>Default: <emphasis>true</emphasis></entry>
24669 </row>
24670 </tbody>
24671 </tgroup>
24672 </informaltable>
24673 <para>
24674 This option controls whether or not an IP address, given as a CSA domain, is
24675 reversed and looked up in the reverse DNS, as described in more detail in
24676 section <xref linkend="SECTverifyCSA"/>.
24677 </para>
24678 <para>
24679 <indexterm role="option">
24680 <primary><option>dns_dnssec_ok</option></primary>
24681 </indexterm>
24682 </para>
24683 <informaltable frame="all">
24684 <tgroup cols="4" colsep="0" rowsep="0">
24685 <colspec colwidth="8*" align="left"/>
24686 <colspec colwidth="6*" align="center"/>
24687 <colspec colwidth="6*" align="center"/>
24688 <colspec colwidth="6*" align="right"/>
24689 <tbody>
24690 <row>
24691 <entry><option>dns_dnssec_ok</option></entry>
24692 <entry>Use: <emphasis>main</emphasis></entry>
24693 <entry>Type: <emphasis>integer</emphasis></entry>
24694 <entry>Default: <emphasis>-1</emphasis></entry>
24695 </row>
24696 </tbody>
24697 </tgroup>
24698 </informaltable>
24699 <para>
24700 <indexterm role="concept">
24701 <primary>DNS</primary>
24702 <secondary>resolver options</secondary>
24703 </indexterm>
24704 <indexterm role="concept">
24705 <primary>DNS</primary>
24706 <secondary>DNSSEC</secondary>
24707 </indexterm>
24708 If this option is set to a non-negative number then Exim will initialise the
24709 DNS resolver library to either use or not use DNSSEC, overriding the system
24710 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
24711 </para>
24712 <para>
24713 If the resolver library does not support DNSSEC then this option has no effect.
24714 </para>
24715 <para>
24716 <indexterm role="option">
24717 <primary><option>dns_ipv4_lookup</option></primary>
24718 </indexterm>
24719 </para>
24720 <informaltable frame="all">
24721 <tgroup cols="4" colsep="0" rowsep="0">
24722 <colspec colwidth="8*" align="left"/>
24723 <colspec colwidth="6*" align="center"/>
24724 <colspec colwidth="6*" align="center"/>
24725 <colspec colwidth="6*" align="right"/>
24726 <tbody>
24727 <row>
24728 <entry><option>dns_ipv4_lookup</option></entry>
24729 <entry>Use: <emphasis>main</emphasis></entry>
24730 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24731 <entry>Default: <emphasis>unset</emphasis></entry>
24732 </row>
24733 </tbody>
24734 </tgroup>
24735 </informaltable>
24736 <para>
24737 <indexterm role="concept">
24738 <primary>IPv6</primary>
24739 <secondary>DNS lookup for AAAA records</secondary>
24740 </indexterm>
24741 <indexterm role="concept">
24742 <primary>DNS</primary>
24743 <secondary>IPv6 lookup for AAAA records</secondary>
24744 </indexterm>
24745 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
24746 looks for IPv6 address records (AAAA records) as well as IPv4 address records
24747 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
24748 domain matches this list.
24749 </para>
24750 <para>
24751 This is a fudge to help with name servers that give big delays or otherwise do
24752 not work for the AAAA record type. In due course, when the world&#x2019;s name
24753 servers have all been upgraded, there should be no need for this option.
24754 </para>
24755 <para>
24756 <indexterm role="option">
24757 <primary><option>dns_retrans</option></primary>
24758 </indexterm>
24759 </para>
24760 <informaltable frame="all">
24761 <tgroup cols="4" colsep="0" rowsep="0">
24762 <colspec colwidth="8*" align="left"/>
24763 <colspec colwidth="6*" align="center"/>
24764 <colspec colwidth="6*" align="center"/>
24765 <colspec colwidth="6*" align="right"/>
24766 <tbody>
24767 <row>
24768 <entry><option>dns_retrans</option></entry>
24769 <entry>Use: <emphasis>main</emphasis></entry>
24770 <entry>Type: <emphasis>time</emphasis></entry>
24771 <entry>Default: <emphasis>0s</emphasis></entry>
24772 </row>
24773 </tbody>
24774 </tgroup>
24775 </informaltable>
24776 <para>
24777 <indexterm role="concept">
24778 <primary>DNS</primary>
24779 <secondary>resolver options</secondary>
24780 </indexterm>
24781 <indexterm role="concept">
24782 <primary>timeout</primary>
24783 <secondary>dns lookup</secondary>
24784 </indexterm>
24785 <indexterm role="concept">
24786 <primary>DNS</primary>
24787 <secondary>timeout</secondary>
24788 </indexterm>
24789 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
24790 retransmission and retry parameters for DNS lookups. Values of zero (the
24791 defaults) leave the system default settings unchanged. The first value is the
24792 time between retries, and the second is the number of retries. It isn&#x2019;t
24793 totally clear exactly how these settings affect the total time a DNS lookup may
24794 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
24795 parameter values are available in the external resolver interface structure,
24796 but nowhere does it seem to describe how they are used or what you might want
24797 to set in them.
24798 See also the <option>slow_lookup_log</option> option.
24799 </para>
24800 <para>
24801 <indexterm role="option">
24802 <primary><option>dns_retry</option></primary>
24803 </indexterm>
24804 </para>
24805 <informaltable frame="all">
24806 <tgroup cols="4" colsep="0" rowsep="0">
24807 <colspec colwidth="8*" align="left"/>
24808 <colspec colwidth="6*" align="center"/>
24809 <colspec colwidth="6*" align="center"/>
24810 <colspec colwidth="6*" align="right"/>
24811 <tbody>
24812 <row>
24813 <entry><option>dns_retry</option></entry>
24814 <entry>Use: <emphasis>main</emphasis></entry>
24815 <entry>Type: <emphasis>integer</emphasis></entry>
24816 <entry>Default: <emphasis>0</emphasis></entry>
24817 </row>
24818 </tbody>
24819 </tgroup>
24820 </informaltable>
24821 <para>
24822 See <option>dns_retrans</option> above.
24823 </para>
24824 <para>
24825 <indexterm role="option">
24826 <primary><option>dns_trust_aa</option></primary>
24827 </indexterm>
24828 </para>
24829 <informaltable frame="all">
24830 <tgroup cols="4" colsep="0" rowsep="0">
24831 <colspec colwidth="8*" align="left"/>
24832 <colspec colwidth="6*" align="center"/>
24833 <colspec colwidth="6*" align="center"/>
24834 <colspec colwidth="6*" align="right"/>
24835 <tbody>
24836 <row>
24837 <entry><option>dns_trust_aa</option></entry>
24838 <entry>Use: <emphasis>main</emphasis></entry>
24839 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24840 <entry>Default: <emphasis>unset</emphasis></entry>
24841 </row>
24842 </tbody>
24843 </tgroup>
24844 </informaltable>
24845 <para>
24846 <indexterm role="concept">
24847 <primary>DNS</primary>
24848 <secondary>resolver options</secondary>
24849 </indexterm>
24850 <indexterm role="concept">
24851 <primary>DNS</primary>
24852 <secondary>DNSSEC</secondary>
24853 </indexterm>
24854 If this option is set then lookup results marked with the AA bit
24855 (Authoritative Answer) are trusted the same way as if they were
24856 DNSSEC-verified. The authority section&#x2019;s name of the answer must
24857 match with this expanded domain list.
24858 </para>
24859 <para>
24860 Use this option only if you talk directly to a resolver that is
24861 authoritative for some zones and does not set the AD (Authentic Data)
24862 bit in the answer. Some DNS servers may have an configuration option to
24863 mark the answers from their own zones as verified (they set the AD bit).
24864 Others do not have this option. It is considered as poor practice using
24865 a resolver that is an authoritative server for some zones.
24866 </para>
24867 <para>
24868 Use this option only if you really have to (e.g. if you want
24869 to use DANE for remote delivery to a server that is listed in the DNS
24870 zones that your resolver is authoritative for).
24871 </para>
24872 <para>
24873 If the DNS answer packet has the AA bit set and contains resource record
24874 in the answer section, the name of the first NS record appearing in the
24875 authority section is compared against the list. If the answer packet is
24876 authoritative but the answer section is empty, the name of the first SOA
24877 record in the authoritative section is used instead.
24878 </para>
24879 <para>
24880 <indexterm role="concept">
24881 <primary>DNS</primary>
24882 <secondary>resolver options</secondary>
24883 </indexterm>
24884 <indexterm role="option">
24885 <primary><option>dns_use_edns0</option></primary>
24886 </indexterm>
24887 </para>
24888 <informaltable frame="all">
24889 <tgroup cols="4" colsep="0" rowsep="0">
24890 <colspec colwidth="8*" align="left"/>
24891 <colspec colwidth="6*" align="center"/>
24892 <colspec colwidth="6*" align="center"/>
24893 <colspec colwidth="6*" align="right"/>
24894 <tbody>
24895 <row>
24896 <entry><option>dns_use_edns0</option></entry>
24897 <entry>Use: <emphasis>main</emphasis></entry>
24898 <entry>Type: <emphasis>integer</emphasis></entry>
24899 <entry>Default: <emphasis>-1</emphasis></entry>
24900 </row>
24901 </tbody>
24902 </tgroup>
24903 </informaltable>
24904 <para>
24905 <indexterm role="concept">
24906 <primary>DNS</primary>
24907 <secondary>resolver options</secondary>
24908 </indexterm>
24909 <indexterm role="concept">
24910 <primary>DNS</primary>
24911 <secondary>EDNS0</secondary>
24912 </indexterm>
24913 <indexterm role="concept">
24914 <primary>DNS</primary>
24915 <secondary>OpenBSD</secondary>
24916 </indexterm>
24917 If this option is set to a non-negative number then Exim will initialise the
24918 DNS resolver library to either use or not use EDNS0 extensions, overriding
24919 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
24920 on.
24921 </para>
24922 <para>
24923 If the resolver library does not support EDNS0 then this option has no effect.
24924 </para>
24925 <para revisionflag="changed">
24926 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
24927 means that DNSSEC will not work with Exim on that platform either, unless Exim
24928 is linked against an alternative DNS client library.
24929 </para>
24930 <para>
24931 <indexterm role="option">
24932 <primary><option>drop_cr</option></primary>
24933 </indexterm>
24934 </para>
24935 <informaltable frame="all">
24936 <tgroup cols="4" colsep="0" rowsep="0">
24937 <colspec colwidth="8*" align="left"/>
24938 <colspec colwidth="6*" align="center"/>
24939 <colspec colwidth="6*" align="center"/>
24940 <colspec colwidth="6*" align="right"/>
24941 <tbody>
24942 <row>
24943 <entry><option>drop_cr</option></entry>
24944 <entry>Use: <emphasis>main</emphasis></entry>
24945 <entry>Type: <emphasis>boolean</emphasis></entry>
24946 <entry>Default: <emphasis>false</emphasis></entry>
24947 </row>
24948 </tbody>
24949 </tgroup>
24950 </informaltable>
24951 <para>
24952 This is an obsolete option that is now a no-op. It used to affect the way Exim
24953 handled CR and LF characters in incoming messages. What happens now is
24954 described in section <xref linkend="SECTlineendings"/>.
24955 </para>
24956 <para>
24957 <indexterm role="option">
24958 <primary><option>dsn_advertise_hosts</option></primary>
24959 </indexterm>
24960 </para>
24961 <informaltable frame="all">
24962 <tgroup cols="4" colsep="0" rowsep="0">
24963 <colspec colwidth="8*" align="left"/>
24964 <colspec colwidth="6*" align="center"/>
24965 <colspec colwidth="6*" align="center"/>
24966 <colspec colwidth="6*" align="right"/>
24967 <tbody>
24968 <row>
24969 <entry><option>dsn_advertise_hosts</option></entry>
24970 <entry>Use: <emphasis>main</emphasis></entry>
24971 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24972 <entry>Default: <emphasis>unset</emphasis></entry>
24973 </row>
24974 </tbody>
24975 </tgroup>
24976 </informaltable>
24977 <para>
24978 <indexterm role="concept">
24979 <primary>bounce messages</primary>
24980 <secondary>success</secondary>
24981 </indexterm>
24982 <indexterm role="concept">
24983 <primary>DSN</primary>
24984 <secondary>success</secondary>
24985 </indexterm>
24986 <indexterm role="concept">
24987 <primary>Delivery Status Notification</primary>
24988 <secondary>success</secondary>
24989 </indexterm>
24990 DSN extensions (RFC3461) will be advertised in the EHLO message to,
24991 and accepted from, these hosts.
24992 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
24993 and RET and ORCPT options on MAIL FROM commands.
24994 A NOTIFY=SUCCESS option requests success-DSN messages.
24995 A NOTIFY= option with no argument requests that no delay or failure DSNs
24996 are sent.
24997 </para>
24998 <para>
24999 <indexterm role="option">
25000 <primary><option>dsn_from</option></primary>
25001 </indexterm>
25002 </para>
25003 <informaltable frame="all">
25004 <tgroup cols="4" colsep="0" rowsep="0">
25005 <colspec colwidth="8*" align="left"/>
25006 <colspec colwidth="6*" align="center"/>
25007 <colspec colwidth="6*" align="center"/>
25008 <colspec colwidth="6*" align="right"/>
25009 <tbody>
25010 <row>
25011 <entry><option>dsn_from</option></entry>
25012 <entry>Use: <emphasis>main</emphasis></entry>
25013 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25014 <entry>Default: <emphasis>see below</emphasis></entry>
25015 </row>
25016 </tbody>
25017 </tgroup>
25018 </informaltable>
25019 <para>
25020 <indexterm role="concept">
25021 <primary><emphasis>From:</emphasis> header line</primary>
25022 <secondary>in bounces</secondary>
25023 </indexterm>
25024 <indexterm role="concept">
25025 <primary>bounce messages</primary>
25026 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
25027 </indexterm>
25028 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
25029 bounces and other automatically generated messages (<quote>Delivery Status
25030 Notifications</quote> &ndash; hence the name of the option). The default setting is:
25031 </para>
25032 <literallayout class="monospaced">
25033 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
25034 </literallayout>
25035 <para>
25036 The value is expanded every time it is needed. If the expansion fails, a
25037 panic is logged, and the default value is used.
25038 </para>
25039 <para>
25040 <indexterm role="option">
25041 <primary><option>envelope_to_remove</option></primary>
25042 </indexterm>
25043 </para>
25044 <informaltable frame="all">
25045 <tgroup cols="4" colsep="0" rowsep="0">
25046 <colspec colwidth="8*" align="left"/>
25047 <colspec colwidth="6*" align="center"/>
25048 <colspec colwidth="6*" align="center"/>
25049 <colspec colwidth="6*" align="right"/>
25050 <tbody>
25051 <row>
25052 <entry><option>envelope_to_remove</option></entry>
25053 <entry>Use: <emphasis>main</emphasis></entry>
25054 <entry>Type: <emphasis>boolean</emphasis></entry>
25055 <entry>Default: <emphasis>true</emphasis></entry>
25056 </row>
25057 </tbody>
25058 </tgroup>
25059 </informaltable>
25060 <para>
25061 <indexterm role="concept">
25062 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
25063 </indexterm>
25064 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
25065 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
25066 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
25067 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
25068 be present in incoming messages, and this option causes them to be removed at
25069 the time the message is received, to avoid any problems that might occur when a
25070 delivered message is subsequently sent on to some other recipient.
25071 </para>
25072 <para>
25073 <indexterm role="option">
25074 <primary><option>errors_copy</option></primary>
25075 </indexterm>
25076 </para>
25077 <informaltable frame="all">
25078 <tgroup cols="4" colsep="0" rowsep="0">
25079 <colspec colwidth="8*" align="left"/>
25080 <colspec colwidth="6*" align="center"/>
25081 <colspec colwidth="6*" align="center"/>
25082 <colspec colwidth="6*" align="right"/>
25083 <tbody>
25084 <row>
25085 <entry><option>errors_copy</option></entry>
25086 <entry>Use: <emphasis>main</emphasis></entry>
25087 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25088 <entry>Default: <emphasis>unset</emphasis></entry>
25089 </row>
25090 </tbody>
25091 </tgroup>
25092 </informaltable>
25093 <para>
25094 <indexterm role="concept">
25095 <primary>bounce message</primary>
25096 <secondary>copy to other address</secondary>
25097 </indexterm>
25098 <indexterm role="concept">
25099 <primary>copy of bounce message</primary>
25100 </indexterm>
25101 Setting this option causes Exim to send bcc copies of bounce messages that it
25102 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
25103 coming from elsewhere. The value of the option is a colon-separated list of
25104 items. Each item consists of a pattern, terminated by white space, followed by
25105 a comma-separated list of email addresses. If a pattern contains spaces, it
25106 must be enclosed in double quotes.
25107 </para>
25108 <para>
25109 Each pattern is processed in the same way as a single item in an address list
25110 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
25111 the bounce message, the message is copied to the addresses on the list. The
25112 items are scanned in order, and once a matching one is found, no further items
25113 are examined. For example:
25114 </para>
25115 <literallayout class="monospaced">
25116 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
25117               rqps@mydomain   hostmaster@mydomain.example,\
25118                               postmaster@mydomain.example
25119 </literallayout>
25120 <para>
25121 <indexterm role="variable">
25122 <primary><varname>$domain</varname></primary>
25123 </indexterm>
25124 <indexterm role="variable">
25125 <primary><varname>$local_part</varname></primary>
25126 </indexterm>
25127 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
25128 and <varname>$domain</varname> are set from the original recipient of the error message, and if
25129 there was any wildcard matching in the pattern, the expansion
25130 <indexterm role="concept">
25131 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25132 <secondary>in <option>errors_copy</option></secondary>
25133 </indexterm>
25134 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
25135 </para>
25136 <para>
25137 <indexterm role="option">
25138 <primary><option>errors_reply_to</option></primary>
25139 </indexterm>
25140 </para>
25141 <informaltable frame="all">
25142 <tgroup cols="4" colsep="0" rowsep="0">
25143 <colspec colwidth="8*" align="left"/>
25144 <colspec colwidth="6*" align="center"/>
25145 <colspec colwidth="6*" align="center"/>
25146 <colspec colwidth="6*" align="right"/>
25147 <tbody>
25148 <row>
25149 <entry><option>errors_reply_to</option></entry>
25150 <entry>Use: <emphasis>main</emphasis></entry>
25151 <entry>Type: <emphasis>string</emphasis></entry>
25152 <entry>Default: <emphasis>unset</emphasis></entry>
25153 </row>
25154 </tbody>
25155 </tgroup>
25156 </informaltable>
25157 <para>
25158 <indexterm role="concept">
25159 <primary>bounce message</primary>
25160 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
25161 </indexterm>
25162 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
25163 </para>
25164 <literallayout>
25165 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
25166 </literallayout>
25167 <para>
25168 <indexterm role="option">
25169 <primary><option>quota_warn_message</option></primary>
25170 </indexterm>
25171 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
25172 A warning message that is generated by the <option>quota_warn_message</option> option in an
25173 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
25174 overrides the default.
25175 </para>
25176 <para>
25177 Experience shows that people reply to bounce messages. If the
25178 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
25179 and warning messages. For example:
25180 </para>
25181 <literallayout class="monospaced">
25182 errors_reply_to = postmaster@my.domain.example
25183 </literallayout>
25184 <para>
25185 The value of the option is not expanded. It must specify a valid RFC 2822
25186 address. However, if a warning message that is generated by the
25187 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
25188 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
25189 not used.
25190 </para>
25191 <para>
25192 <indexterm role="option">
25193 <primary><option>event_action</option></primary>
25194 </indexterm>
25195 </para>
25196 <informaltable frame="all">
25197 <tgroup cols="4" colsep="0" rowsep="0">
25198 <colspec colwidth="8*" align="left"/>
25199 <colspec colwidth="6*" align="center"/>
25200 <colspec colwidth="6*" align="center"/>
25201 <colspec colwidth="6*" align="right"/>
25202 <tbody>
25203 <row>
25204 <entry><option>event_action</option></entry>
25205 <entry>Use: <emphasis>main</emphasis></entry>
25206 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25207 <entry>Default: <emphasis>unset</emphasis></entry>
25208 </row>
25209 </tbody>
25210 </tgroup>
25211 </informaltable>
25212 <para>
25213 <indexterm role="concept">
25214 <primary>events</primary>
25215 </indexterm>
25216 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
25217 For details see chapter <xref linkend="CHAPevents"/>.
25218 </para>
25219 <para>
25220 <indexterm role="option">
25221 <primary><option>exim_group</option></primary>
25222 </indexterm>
25223 </para>
25224 <informaltable frame="all">
25225 <tgroup cols="4" colsep="0" rowsep="0">
25226 <colspec colwidth="8*" align="left"/>
25227 <colspec colwidth="6*" align="center"/>
25228 <colspec colwidth="6*" align="center"/>
25229 <colspec colwidth="6*" align="right"/>
25230 <tbody>
25231 <row>
25232 <entry><option>exim_group</option></entry>
25233 <entry>Use: <emphasis>main</emphasis></entry>
25234 <entry>Type: <emphasis>string</emphasis></entry>
25235 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25236 </row>
25237 </tbody>
25238 </tgroup>
25239 </informaltable>
25240 <para>
25241 <indexterm role="concept">
25242 <primary>gid (group id)</primary>
25243 <secondary>Exim&#x2019;s own</secondary>
25244 </indexterm>
25245 <indexterm role="concept">
25246 <primary>Exim group</primary>
25247 </indexterm>
25248 This option changes the gid under which Exim runs when it gives up root
25249 privilege. The default value is compiled into the binary. The value of this
25250 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
25251 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
25252 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
25253 security issues.
25254 </para>
25255 <para>
25256 <indexterm role="option">
25257 <primary><option>exim_path</option></primary>
25258 </indexterm>
25259 </para>
25260 <informaltable frame="all">
25261 <tgroup cols="4" colsep="0" rowsep="0">
25262 <colspec colwidth="8*" align="left"/>
25263 <colspec colwidth="6*" align="center"/>
25264 <colspec colwidth="6*" align="center"/>
25265 <colspec colwidth="6*" align="right"/>
25266 <tbody>
25267 <row>
25268 <entry><option>exim_path</option></entry>
25269 <entry>Use: <emphasis>main</emphasis></entry>
25270 <entry>Type: <emphasis>string</emphasis></entry>
25271 <entry>Default: <emphasis>see below</emphasis></entry>
25272 </row>
25273 </tbody>
25274 </tgroup>
25275 </informaltable>
25276 <para>
25277 <indexterm role="concept">
25278 <primary>Exim binary, path name</primary>
25279 </indexterm>
25280 This option specifies the path name of the Exim binary, which is used when Exim
25281 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
25282 the directory configured at compile time by the BIN_DIRECTORY setting. It
25283 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
25284 other place.
25285 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
25286 you will break those Exim utilities that scan the configuration file to find
25287 where the binary is. (They then use the <option>-bP</option> option to extract option
25288 settings such as the value of <option>spool_directory</option>.)
25289 </para>
25290 <para>
25291 <indexterm role="option">
25292 <primary><option>exim_user</option></primary>
25293 </indexterm>
25294 </para>
25295 <informaltable frame="all">
25296 <tgroup cols="4" colsep="0" rowsep="0">
25297 <colspec colwidth="8*" align="left"/>
25298 <colspec colwidth="6*" align="center"/>
25299 <colspec colwidth="6*" align="center"/>
25300 <colspec colwidth="6*" align="right"/>
25301 <tbody>
25302 <row>
25303 <entry><option>exim_user</option></entry>
25304 <entry>Use: <emphasis>main</emphasis></entry>
25305 <entry>Type: <emphasis>string</emphasis></entry>
25306 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
25307 </row>
25308 </tbody>
25309 </tgroup>
25310 </informaltable>
25311 <para>
25312 <indexterm role="concept">
25313 <primary>uid (user id)</primary>
25314 <secondary>Exim&#x2019;s own</secondary>
25315 </indexterm>
25316 <indexterm role="concept">
25317 <primary>Exim user</primary>
25318 </indexterm>
25319 This option changes the uid under which Exim runs when it gives up root
25320 privilege. The default value is compiled into the binary. Ownership of the run
25321 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
25322 options is checked against the values in the binary, not what is set here.
25323 </para>
25324 <para>
25325 Unless it consists entirely of digits, the string is looked up using
25326 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
25327 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
25328 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
25329 </para>
25330 <para>
25331 <indexterm role="option">
25332 <primary><option>extra_local_interfaces</option></primary>
25333 </indexterm>
25334 </para>
25335 <informaltable frame="all">
25336 <tgroup cols="4" colsep="0" rowsep="0">
25337 <colspec colwidth="8*" align="left"/>
25338 <colspec colwidth="6*" align="center"/>
25339 <colspec colwidth="6*" align="center"/>
25340 <colspec colwidth="6*" align="right"/>
25341 <tbody>
25342 <row>
25343 <entry><option>extra_local_interfaces</option></entry>
25344 <entry>Use: <emphasis>main</emphasis></entry>
25345 <entry>Type: <emphasis>string list</emphasis></entry>
25346 <entry>Default: <emphasis>unset</emphasis></entry>
25347 </row>
25348 </tbody>
25349 </tgroup>
25350 </informaltable>
25351 <para>
25352 This option defines network interfaces that are to be considered local when
25353 routing, but which are not used for listening by the daemon. See section
25354 <xref linkend="SECTreclocipadd"/> for details.
25355 </para>
25356 <para>
25357 <indexterm role="option">
25358 <primary><option>extract_addresses_remove_arguments</option></primary>
25359 </indexterm>
25360 </para>
25361 <informaltable frame="all">
25362 <tgroup cols="4" colsep="0" rowsep="0">
25363 <colspec colwidth="8*" align="left"/>
25364 <colspec colwidth="6*" align="center"/>
25365 <colspec colwidth="6*" align="center"/>
25366 <colspec colwidth="6*" align="right"/>
25367 <tbody>
25368 <row>
25369 <entry><option>extract_addresses_remove_arguments</option></entry>
25370 <entry>Use: <emphasis>main</emphasis></entry>
25371 <entry>Type: <emphasis>boolean</emphasis></entry>
25372 <entry>Default: <emphasis>true</emphasis></entry>
25373 </row>
25374 </tbody>
25375 </tgroup>
25376 </informaltable>
25377 <para>
25378 <indexterm role="option">
25379 <primary><option>-t</option></primary>
25380 </indexterm>
25381 <indexterm role="concept">
25382 <primary>command line</primary>
25383 <secondary>addresses with <option>-t</option></secondary>
25384 </indexterm>
25385 <indexterm role="concept">
25386 <primary>Sendmail compatibility</primary>
25387 <secondary><option>-t</option> option</secondary>
25388 </indexterm>
25389 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
25390 are present on the command line when the <option>-t</option> option is used to build an
25391 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
25392 line addresses are removed from the recipients list. This is also how Smail
25393 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
25394 command line addresses are added to those obtained from the header lines. When
25395 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
25396 argument headers. If it is set false, Exim adds rather than removes argument
25397 addresses.
25398 </para>
25399 <para>
25400 <indexterm role="option">
25401 <primary><option>finduser_retries</option></primary>
25402 </indexterm>
25403 </para>
25404 <informaltable frame="all">
25405 <tgroup cols="4" colsep="0" rowsep="0">
25406 <colspec colwidth="8*" align="left"/>
25407 <colspec colwidth="6*" align="center"/>
25408 <colspec colwidth="6*" align="center"/>
25409 <colspec colwidth="6*" align="right"/>
25410 <tbody>
25411 <row>
25412 <entry><option>finduser_retries</option></entry>
25413 <entry>Use: <emphasis>main</emphasis></entry>
25414 <entry>Type: <emphasis>integer</emphasis></entry>
25415 <entry>Default: <emphasis>0</emphasis></entry>
25416 </row>
25417 </tbody>
25418 </tgroup>
25419 </informaltable>
25420 <para>
25421 <indexterm role="concept">
25422 <primary>NIS, retrying user lookups</primary>
25423 </indexterm>
25424 On systems running NIS or other schemes in which user and group information is
25425 distributed from a remote system, there can be times when <function>getpwnam()</function> and
25426 related functions fail, even when given valid data, because things time out.
25427 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
25428 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
25429 many extra times to find a user or a group, waiting for one second between
25430 retries.
25431 </para>
25432 <para>
25433 <indexterm role="concept">
25434 <primary><filename>/etc/passwd</filename></primary>
25435 <secondary>multiple reading of</secondary>
25436 </indexterm>
25437 You should not set this option greater than zero if your user information is in
25438 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
25439 search the file multiple times for non-existent users, and also cause delay.
25440 </para>
25441 <para>
25442 <indexterm role="option">
25443 <primary><option>freeze_tell</option></primary>
25444 </indexterm>
25445 </para>
25446 <informaltable frame="all">
25447 <tgroup cols="4" colsep="0" rowsep="0">
25448 <colspec colwidth="8*" align="left"/>
25449 <colspec colwidth="6*" align="center"/>
25450 <colspec colwidth="6*" align="center"/>
25451 <colspec colwidth="6*" align="right"/>
25452 <tbody>
25453 <row>
25454 <entry><option>freeze_tell</option></entry>
25455 <entry>Use: <emphasis>main</emphasis></entry>
25456 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
25457 <entry>Default: <emphasis>unset</emphasis></entry>
25458 </row>
25459 </tbody>
25460 </tgroup>
25461 </informaltable>
25462 <para>
25463 <indexterm role="concept">
25464 <primary>freezing messages</primary>
25465 <secondary>sending a message when freezing</secondary>
25466 </indexterm>
25467 On encountering certain errors, or when configured to do so in a system filter,
25468 ACL, or special router, Exim freezes a message. This means that no further
25469 delivery attempts take place until an administrator thaws the message, or the
25470 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
25471 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
25472 warning message whenever it freezes something, unless the message it is
25473 freezing is a locally-generated bounce message. (Without this exception there
25474 is the possibility of looping.) The warning message is sent to the addresses
25475 supplied as the comma-separated value of this option. If several of the
25476 message&#x2019;s addresses cause freezing, only a single message is sent. If the
25477 freezing was automatic, the reason(s) for freezing can be found in the message
25478 log. If you configure freezing in a filter or ACL, you must arrange for any
25479 logging that you require.
25480 </para>
25481 <para>
25482 <indexterm role="option">
25483 <primary><option>gecos_name</option></primary>
25484 </indexterm>
25485 </para>
25486 <informaltable frame="all">
25487 <tgroup cols="4" colsep="0" rowsep="0">
25488 <colspec colwidth="8*" align="left"/>
25489 <colspec colwidth="6*" align="center"/>
25490 <colspec colwidth="6*" align="center"/>
25491 <colspec colwidth="6*" align="right"/>
25492 <tbody>
25493 <row>
25494 <entry><option>gecos_name</option></entry>
25495 <entry>Use: <emphasis>main</emphasis></entry>
25496 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25497 <entry>Default: <emphasis>unset</emphasis></entry>
25498 </row>
25499 </tbody>
25500 </tgroup>
25501 </informaltable>
25502 <para>
25503 <indexterm role="concept">
25504 <primary>HP-UX</primary>
25505 </indexterm>
25506 <indexterm role="concept">
25507 <primary><quote>gecos</quote> field, parsing</primary>
25508 </indexterm>
25509 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
25510 password file to hold other information in addition to users&#x2019; real names. Exim
25511 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
25512 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
25513 of the field are used unchanged, except that, if an ampersand is encountered,
25514 it is replaced by the user&#x2019;s login name with the first character forced to
25515 upper case, since this is a convention that is observed on many systems.
25516 </para>
25517 <para>
25518 When these options are set, <option>gecos_pattern</option> is treated as a regular
25519 expression that is to be applied to the field (again with &amp; replaced by the
25520 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
25521 user&#x2019;s name.
25522 </para>
25523 <para>
25524 <indexterm role="concept">
25525 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
25526 <secondary>in <option>gecos_name</option></secondary>
25527 </indexterm>
25528 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
25529 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
25530 name terminates at the first comma, the following can be used:
25531 </para>
25532 <literallayout class="monospaced">
25533 gecos_pattern = ([^,]*)
25534 gecos_name = $1
25535 </literallayout>
25536 <para>
25537 <indexterm role="option">
25538 <primary><option>gecos_pattern</option></primary>
25539 </indexterm>
25540 </para>
25541 <informaltable frame="all">
25542 <tgroup cols="4" colsep="0" rowsep="0">
25543 <colspec colwidth="8*" align="left"/>
25544 <colspec colwidth="6*" align="center"/>
25545 <colspec colwidth="6*" align="center"/>
25546 <colspec colwidth="6*" align="right"/>
25547 <tbody>
25548 <row>
25549 <entry><option>gecos_pattern</option></entry>
25550 <entry>Use: <emphasis>main</emphasis></entry>
25551 <entry>Type: <emphasis>string</emphasis></entry>
25552 <entry>Default: <emphasis>unset</emphasis></entry>
25553 </row>
25554 </tbody>
25555 </tgroup>
25556 </informaltable>
25557 <para>
25558 See <option>gecos_name</option> above.
25559 </para>
25560 <para>
25561 <indexterm role="option">
25562 <primary><option>gnutls_compat_mode</option></primary>
25563 </indexterm>
25564 </para>
25565 <informaltable frame="all">
25566 <tgroup cols="4" colsep="0" rowsep="0">
25567 <colspec colwidth="8*" align="left"/>
25568 <colspec colwidth="6*" align="center"/>
25569 <colspec colwidth="6*" align="center"/>
25570 <colspec colwidth="6*" align="right"/>
25571 <tbody>
25572 <row>
25573 <entry><option>gnutls_compat_mode</option></entry>
25574 <entry>Use: <emphasis>main</emphasis></entry>
25575 <entry>Type: <emphasis>boolean</emphasis></entry>
25576 <entry>Default: <emphasis>unset</emphasis></entry>
25577 </row>
25578 </tbody>
25579 </tgroup>
25580 </informaltable>
25581 <para>
25582 This option controls whether GnuTLS is used in compatibility mode in an Exim
25583 server. This reduces security slightly, but improves interworking with older
25584 implementations of TLS.
25585 </para>
25586 <para>
25587 option gnutls_allow_auto_pkcs11 main boolean unset
25588 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
25589 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
25590 </para>
25591 <para>
25592 See
25593 <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>
25594 for documentation.
25595 </para>
25596 <para>
25597 <indexterm role="option">
25598 <primary><option>headers_charset</option></primary>
25599 </indexterm>
25600 </para>
25601 <informaltable frame="all">
25602 <tgroup cols="4" colsep="0" rowsep="0">
25603 <colspec colwidth="8*" align="left"/>
25604 <colspec colwidth="6*" align="center"/>
25605 <colspec colwidth="6*" align="center"/>
25606 <colspec colwidth="6*" align="right"/>
25607 <tbody>
25608 <row>
25609 <entry><option>headers_charset</option></entry>
25610 <entry>Use: <emphasis>main</emphasis></entry>
25611 <entry>Type: <emphasis>string</emphasis></entry>
25612 <entry>Default: <emphasis>see below</emphasis></entry>
25613 </row>
25614 </tbody>
25615 </tgroup>
25616 </informaltable>
25617 <para>
25618 This option sets a default character set for translating from encoded MIME
25619 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
25620 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
25621 ultimate default is ISO-8859-1. For more details see the description of header
25622 insertions in section <xref linkend="SECTexpansionitems"/>.
25623 </para>
25624 <para>
25625 <indexterm role="option">
25626 <primary><option>header_maxsize</option></primary>
25627 </indexterm>
25628 </para>
25629 <informaltable frame="all">
25630 <tgroup cols="4" colsep="0" rowsep="0">
25631 <colspec colwidth="8*" align="left"/>
25632 <colspec colwidth="6*" align="center"/>
25633 <colspec colwidth="6*" align="center"/>
25634 <colspec colwidth="6*" align="right"/>
25635 <tbody>
25636 <row>
25637 <entry><option>header_maxsize</option></entry>
25638 <entry>Use: <emphasis>main</emphasis></entry>
25639 <entry>Type: <emphasis>integer</emphasis></entry>
25640 <entry>Default: <emphasis>see below</emphasis></entry>
25641 </row>
25642 </tbody>
25643 </tgroup>
25644 </informaltable>
25645 <para>
25646 <indexterm role="concept">
25647 <primary>header section</primary>
25648 <secondary>maximum size of</secondary>
25649 </indexterm>
25650 <indexterm role="concept">
25651 <primary>limit</primary>
25652 <secondary>size of message header section</secondary>
25653 </indexterm>
25654 This option controls the overall maximum size of a message&#x2019;s header
25655 section. The default is the value of HEADER_MAXSIZE in
25656 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
25657 sections are rejected.
25658 </para>
25659 <para>
25660 <indexterm role="option">
25661 <primary><option>header_line_maxsize</option></primary>
25662 </indexterm>
25663 </para>
25664 <informaltable frame="all">
25665 <tgroup cols="4" colsep="0" rowsep="0">
25666 <colspec colwidth="8*" align="left"/>
25667 <colspec colwidth="6*" align="center"/>
25668 <colspec colwidth="6*" align="center"/>
25669 <colspec colwidth="6*" align="right"/>
25670 <tbody>
25671 <row>
25672 <entry><option>header_line_maxsize</option></entry>
25673 <entry>Use: <emphasis>main</emphasis></entry>
25674 <entry>Type: <emphasis>integer</emphasis></entry>
25675 <entry>Default: <emphasis>0</emphasis></entry>
25676 </row>
25677 </tbody>
25678 </tgroup>
25679 </informaltable>
25680 <para>
25681 <indexterm role="concept">
25682 <primary>header lines</primary>
25683 <secondary>maximum size of</secondary>
25684 </indexterm>
25685 <indexterm role="concept">
25686 <primary>limit</primary>
25687 <secondary>size of one header line</secondary>
25688 </indexterm>
25689 This option limits the length of any individual header line in a message, after
25690 all the continuations have been joined together. Messages with individual
25691 header lines that are longer than the limit are rejected. The default value of
25692 zero means <quote>no limit</quote>.
25693 </para>
25694 <para>
25695 <indexterm role="option">
25696 <primary><option>helo_accept_junk_hosts</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>helo_accept_junk_hosts</option></entry>
25708 <entry>Use: <emphasis>main</emphasis></entry>
25709 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></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>HELO</primary>
25718 <secondary>accepting junk data</secondary>
25719 </indexterm>
25720 <indexterm role="concept">
25721 <primary>EHLO</primary>
25722 <secondary>accepting junk data</secondary>
25723 </indexterm>
25724 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
25725 mail, and gives an error response for invalid data. Unfortunately, there are
25726 some SMTP clients that send syntactic junk. They can be accommodated by setting
25727 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
25728 if you want to do semantic checking.
25729 See also <option>helo_allow_chars</option> for a way of extending the permitted character
25730 set.
25731 </para>
25732 <para>
25733 <indexterm role="option">
25734 <primary><option>helo_allow_chars</option></primary>
25735 </indexterm>
25736 </para>
25737 <informaltable frame="all">
25738 <tgroup cols="4" colsep="0" rowsep="0">
25739 <colspec colwidth="8*" align="left"/>
25740 <colspec colwidth="6*" align="center"/>
25741 <colspec colwidth="6*" align="center"/>
25742 <colspec colwidth="6*" align="right"/>
25743 <tbody>
25744 <row>
25745 <entry><option>helo_allow_chars</option></entry>
25746 <entry>Use: <emphasis>main</emphasis></entry>
25747 <entry>Type: <emphasis>string</emphasis></entry>
25748 <entry>Default: <emphasis>unset</emphasis></entry>
25749 </row>
25750 </tbody>
25751 </tgroup>
25752 </informaltable>
25753 <para>
25754 <indexterm role="concept">
25755 <primary>HELO</primary>
25756 <secondary>underscores in</secondary>
25757 </indexterm>
25758 <indexterm role="concept">
25759 <primary>EHLO</primary>
25760 <secondary>underscores in</secondary>
25761 </indexterm>
25762 <indexterm role="concept">
25763 <primary>underscore in EHLO/HELO</primary>
25764 </indexterm>
25765 This option can be set to a string of rogue characters that are permitted in
25766 all EHLO and HELO names in addition to the standard letters, digits,
25767 hyphens, and dots. If you really must allow underscores, you can set
25768 </para>
25769 <literallayout class="monospaced">
25770 helo_allow_chars = _
25771 </literallayout>
25772 <para>
25773 Note that the value is one string, not a list.
25774 </para>
25775 <para>
25776 <indexterm role="option">
25777 <primary><option>helo_lookup_domains</option></primary>
25778 </indexterm>
25779 </para>
25780 <informaltable frame="all">
25781 <tgroup cols="4" colsep="0" rowsep="0">
25782 <colspec colwidth="8*" align="left"/>
25783 <colspec colwidth="6*" align="center"/>
25784 <colspec colwidth="6*" align="center"/>
25785 <colspec colwidth="6*" align="right"/>
25786 <tbody>
25787 <row>
25788 <entry><option>helo_lookup_domains</option></entry>
25789 <entry>Use: <emphasis>main</emphasis></entry>
25790 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25791 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
25792 </row>
25793 </tbody>
25794 </tgroup>
25795 </informaltable>
25796 <para>
25797 <indexterm role="concept">
25798 <primary>HELO</primary>
25799 <secondary>forcing reverse lookup</secondary>
25800 </indexterm>
25801 <indexterm role="concept">
25802 <primary>EHLO</primary>
25803 <secondary>forcing reverse lookup</secondary>
25804 </indexterm>
25805 If the domain given by a client in a HELO or EHLO command matches this
25806 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
25807 default forces a lookup if the client host gives the server&#x2019;s name or any of
25808 its IP addresses (in brackets), something that broken clients have been seen to
25809 do.
25810 </para>
25811 <para>
25812 <indexterm role="option">
25813 <primary><option>helo_try_verify_hosts</option></primary>
25814 </indexterm>
25815 </para>
25816 <informaltable frame="all">
25817 <tgroup cols="4" colsep="0" rowsep="0">
25818 <colspec colwidth="8*" align="left"/>
25819 <colspec colwidth="6*" align="center"/>
25820 <colspec colwidth="6*" align="center"/>
25821 <colspec colwidth="6*" align="right"/>
25822 <tbody>
25823 <row>
25824 <entry><option>helo_try_verify_hosts</option></entry>
25825 <entry>Use: <emphasis>main</emphasis></entry>
25826 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25827 <entry>Default: <emphasis>unset</emphasis></entry>
25828 </row>
25829 </tbody>
25830 </tgroup>
25831 </informaltable>
25832 <para>
25833 <indexterm role="concept">
25834 <primary>HELO verifying</primary>
25835 <secondary>optional</secondary>
25836 </indexterm>
25837 <indexterm role="concept">
25838 <primary>EHLO</primary>
25839 <secondary>verifying, optional</secondary>
25840 </indexterm>
25841 By default, Exim just checks the syntax of HELO and EHLO commands (see
25842 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
25843 to do more extensive checking of the data supplied by these commands. The ACL
25844 condition <literal>verify = helo</literal> is provided to make this possible.
25845 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
25846 to force the check to occur. From release 4.53 onwards, this is no longer
25847 necessary. If the check has not been done before <literal>verify = helo</literal> is
25848 encountered, it is done at that time. Consequently, this option is obsolete.
25849 Its specification is retained here for backwards compatibility.
25850 </para>
25851 <para>
25852 When an EHLO or HELO command is received, if the calling host matches
25853 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
25854 EHLO command either:
25855 </para>
25856 <itemizedlist>
25857 <listitem>
25858 <para>
25859 is an IP literal matching the calling address of the host, or
25860 </para>
25861 </listitem>
25862 <listitem>
25863 <para>
25864 <indexterm role="concept">
25865 <primary>DNS</primary>
25866 <secondary>reverse lookup</secondary>
25867 </indexterm>
25868 <indexterm role="concept">
25869 <primary>reverse DNS lookup</primary>
25870 </indexterm>
25871 matches the host name that Exim obtains by doing a reverse lookup of the
25872 calling host address, or
25873 </para>
25874 </listitem>
25875 <listitem>
25876 <para>
25877 when looked up in DNS yields the calling host address.
25878 </para>
25879 </listitem>
25880 </itemizedlist>
25881 <para>
25882 However, the EHLO or HELO command is not rejected if any of the checks
25883 fail. Processing continues, but the result of the check is remembered, and can
25884 be detected later in an ACL by the <literal>verify = helo</literal> condition.
25885 </para>
25886 <para>
25887 If DNS was used for successful verification, the variable
25888 <indexterm role="concept">
25889 <primary>DNS</primary>
25890 <secondary>DNSSEC</secondary>
25891 </indexterm>
25892 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
25893 </para>
25894 <para>
25895 <indexterm role="option">
25896 <primary><option>helo_verify_hosts</option></primary>
25897 </indexterm>
25898 </para>
25899 <informaltable frame="all">
25900 <tgroup cols="4" colsep="0" rowsep="0">
25901 <colspec colwidth="8*" align="left"/>
25902 <colspec colwidth="6*" align="center"/>
25903 <colspec colwidth="6*" align="center"/>
25904 <colspec colwidth="6*" align="right"/>
25905 <tbody>
25906 <row>
25907 <entry><option>helo_verify_hosts</option></entry>
25908 <entry>Use: <emphasis>main</emphasis></entry>
25909 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25910 <entry>Default: <emphasis>unset</emphasis></entry>
25911 </row>
25912 </tbody>
25913 </tgroup>
25914 </informaltable>
25915 <para>
25916 <indexterm role="concept">
25917 <primary>HELO verifying</primary>
25918 <secondary>mandatory</secondary>
25919 </indexterm>
25920 <indexterm role="concept">
25921 <primary>EHLO</primary>
25922 <secondary>verifying, mandatory</secondary>
25923 </indexterm>
25924 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
25925 backwards compatibility. For hosts that match this option, Exim checks the host
25926 name given in the HELO or EHLO in the same way as for
25927 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
25928 rejected with a 550 error, and entries are written to the main and reject logs.
25929 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
25930 error.
25931 </para>
25932 <para>
25933 <indexterm role="option">
25934 <primary><option>hold_domains</option></primary>
25935 </indexterm>
25936 </para>
25937 <informaltable frame="all">
25938 <tgroup cols="4" colsep="0" rowsep="0">
25939 <colspec colwidth="8*" align="left"/>
25940 <colspec colwidth="6*" align="center"/>
25941 <colspec colwidth="6*" align="center"/>
25942 <colspec colwidth="6*" align="right"/>
25943 <tbody>
25944 <row>
25945 <entry><option>hold_domains</option></entry>
25946 <entry>Use: <emphasis>main</emphasis></entry>
25947 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25948 <entry>Default: <emphasis>unset</emphasis></entry>
25949 </row>
25950 </tbody>
25951 </tgroup>
25952 </informaltable>
25953 <para>
25954 <indexterm role="concept">
25955 <primary>domain</primary>
25956 <secondary>delaying delivery</secondary>
25957 </indexterm>
25958 <indexterm role="concept">
25959 <primary>delivery</primary>
25960 <secondary>delaying certain domains</secondary>
25961 </indexterm>
25962 This option allows mail for particular domains to be held on the queue
25963 manually. The option is overridden if a message delivery is forced with the
25964 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
25965 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
25966 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
25967 it is deferred every time the message is looked at.
25968 </para>
25969 <para>
25970 This option is intended as a temporary operational measure for delaying the
25971 delivery of mail while some problem is being sorted out, or some new
25972 configuration tested. If you just want to delay the processing of some
25973 domains until a queue run occurs, you should use <option>queue_domains</option> or
25974 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
25975 </para>
25976 <para>
25977 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
25978 messages from the queue if they have been there longer than the longest retry
25979 time in any retry rule. If you want to hold messages for longer than the normal
25980 retry times, insert a dummy retry rule with a long retry time.
25981 </para>
25982 <para>
25983 <indexterm role="option">
25984 <primary><option>host_lookup</option></primary>
25985 </indexterm>
25986 </para>
25987 <informaltable frame="all">
25988 <tgroup cols="4" colsep="0" rowsep="0">
25989 <colspec colwidth="8*" align="left"/>
25990 <colspec colwidth="6*" align="center"/>
25991 <colspec colwidth="6*" align="center"/>
25992 <colspec colwidth="6*" align="right"/>
25993 <tbody>
25994 <row>
25995 <entry><option>host_lookup</option></entry>
25996 <entry>Use: <emphasis>main</emphasis></entry>
25997 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25998 <entry>Default: <emphasis>unset</emphasis></entry>
25999 </row>
26000 </tbody>
26001 </tgroup>
26002 </informaltable>
26003 <para>
26004 <indexterm role="concept">
26005 <primary>host name</primary>
26006 <secondary>lookup, forcing</secondary>
26007 </indexterm>
26008 Exim does not look up the name of a calling host from its IP address unless it
26009 is required to compare against some host list, or the host matches
26010 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
26011 option (which normally contains IP addresses rather than host names). The
26012 default configuration file contains
26013 </para>
26014 <literallayout class="monospaced">
26015 host_lookup = *
26016 </literallayout>
26017 <para>
26018 which causes a lookup to happen for all hosts. If the expense of these lookups
26019 is felt to be too great, the setting can be changed or removed.
26020 </para>
26021 <para>
26022 After a successful reverse lookup, Exim does a forward lookup on the name it
26023 has obtained, to verify that it yields the IP address that it started with. If
26024 this check fails, Exim behaves as if the name lookup failed.
26025 </para>
26026 <para>
26027 <indexterm role="variable">
26028 <primary><varname>$host_lookup_failed</varname></primary>
26029 </indexterm>
26030 <indexterm role="variable">
26031 <primary><varname>$sender_host_name</varname></primary>
26032 </indexterm>
26033 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
26034 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
26035 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
26036 <literal>verify = reverse_host_lookup</literal> in ACLs.
26037 </para>
26038 <para>
26039 <indexterm role="option">
26040 <primary><option>host_lookup_order</option></primary>
26041 </indexterm>
26042 </para>
26043 <informaltable frame="all">
26044 <tgroup cols="4" colsep="0" rowsep="0">
26045 <colspec colwidth="8*" align="left"/>
26046 <colspec colwidth="6*" align="center"/>
26047 <colspec colwidth="6*" align="center"/>
26048 <colspec colwidth="6*" align="right"/>
26049 <tbody>
26050 <row>
26051 <entry><option>host_lookup_order</option></entry>
26052 <entry>Use: <emphasis>main</emphasis></entry>
26053 <entry>Type: <emphasis>string list</emphasis></entry>
26054 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
26055 </row>
26056 </tbody>
26057 </tgroup>
26058 </informaltable>
26059 <para>
26060 This option specifies the order of different lookup methods when Exim is trying
26061 to find a host name from an IP address. The default is to do a DNS lookup
26062 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
26063 if that fails. You can change the order of these lookups, or omit one entirely,
26064 if you want.
26065 </para>
26066 <para>
26067 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
26068 multiple PTR records in the DNS and the IP address is not listed in
26069 <filename>/etc/hosts</filename>. Different operating systems give different results in this
26070 case. That is why the default tries a DNS lookup first.
26071 </para>
26072 <para>
26073 <indexterm role="option">
26074 <primary><option>host_reject_connection</option></primary>
26075 </indexterm>
26076 </para>
26077 <informaltable frame="all">
26078 <tgroup cols="4" colsep="0" rowsep="0">
26079 <colspec colwidth="8*" align="left"/>
26080 <colspec colwidth="6*" align="center"/>
26081 <colspec colwidth="6*" align="center"/>
26082 <colspec colwidth="6*" align="right"/>
26083 <tbody>
26084 <row>
26085 <entry><option>host_reject_connection</option></entry>
26086 <entry>Use: <emphasis>main</emphasis></entry>
26087 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26088 <entry>Default: <emphasis>unset</emphasis></entry>
26089 </row>
26090 </tbody>
26091 </tgroup>
26092 </informaltable>
26093 <para>
26094 <indexterm role="concept">
26095 <primary>host</primary>
26096 <secondary>rejecting connections from</secondary>
26097 </indexterm>
26098 If this option is set, incoming SMTP calls from the hosts listed are rejected
26099 as soon as the connection is made.
26100 This option is obsolete, and retained only for backward compatibility, because
26101 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
26102 connections immediately.
26103 </para>
26104 <para>
26105 The ability to give an immediate rejection (either by this option or using an
26106 ACL) is provided for use in unusual cases. Many hosts will just try again,
26107 sometimes without much delay. Normally, it is better to use an ACL to reject
26108 incoming messages at a later stage, such as after RCPT commands. See
26109 chapter <xref linkend="CHAPACL"/>.
26110 </para>
26111 <para>
26112 <indexterm role="option">
26113 <primary><option>hosts_connection_nolog</option></primary>
26114 </indexterm>
26115 </para>
26116 <informaltable frame="all">
26117 <tgroup cols="4" colsep="0" rowsep="0">
26118 <colspec colwidth="8*" align="left"/>
26119 <colspec colwidth="6*" align="center"/>
26120 <colspec colwidth="6*" align="center"/>
26121 <colspec colwidth="6*" align="right"/>
26122 <tbody>
26123 <row>
26124 <entry><option>hosts_connection_nolog</option></entry>
26125 <entry>Use: <emphasis>main</emphasis></entry>
26126 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26127 <entry>Default: <emphasis>unset</emphasis></entry>
26128 </row>
26129 </tbody>
26130 </tgroup>
26131 </informaltable>
26132 <para>
26133 <indexterm role="concept">
26134 <primary>host</primary>
26135 <secondary>not logging connections from</secondary>
26136 </indexterm>
26137 This option defines a list of hosts for which connection logging does not
26138 happen, even though the <option>smtp_connection</option> log selector is set. For example,
26139 you might want not to log SMTP connections from local processes, or from
26140 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
26141 the daemon; you should therefore strive to restrict its value to a short inline
26142 list of IP addresses and networks. To disable logging SMTP connections from
26143 local processes, you must create a host list with an empty item. For example:
26144 </para>
26145 <literallayout class="monospaced">
26146 hosts_connection_nolog = :
26147 </literallayout>
26148 <para>
26149 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
26150 </para>
26151 <para>
26152 <indexterm role="option">
26153 <primary><option>hosts_proxy</option></primary>
26154 </indexterm>
26155 </para>
26156 <informaltable frame="all">
26157 <tgroup cols="4" colsep="0" rowsep="0">
26158 <colspec colwidth="8*" align="left"/>
26159 <colspec colwidth="6*" align="center"/>
26160 <colspec colwidth="6*" align="center"/>
26161 <colspec colwidth="6*" align="right"/>
26162 <tbody>
26163 <row>
26164 <entry><option>hosts_proxy</option></entry>
26165 <entry>Use: <emphasis>main</emphasis></entry>
26166 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26167 <entry>Default: <emphasis>unset</emphasis></entry>
26168 </row>
26169 </tbody>
26170 </tgroup>
26171 </informaltable>
26172 <para>
26173 <indexterm role="concept">
26174 <primary>proxy</primary>
26175 <secondary>proxy protocol</secondary>
26176 </indexterm>
26177 This option enables use of Proxy Protocol proxies for incoming
26178 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
26179 </para>
26180 <para>
26181 <indexterm role="option">
26182 <primary><option>hosts_treat_as_local</option></primary>
26183 </indexterm>
26184 </para>
26185 <informaltable frame="all">
26186 <tgroup cols="4" colsep="0" rowsep="0">
26187 <colspec colwidth="8*" align="left"/>
26188 <colspec colwidth="6*" align="center"/>
26189 <colspec colwidth="6*" align="center"/>
26190 <colspec colwidth="6*" align="right"/>
26191 <tbody>
26192 <row>
26193 <entry><option>hosts_treat_as_local</option></entry>
26194 <entry>Use: <emphasis>main</emphasis></entry>
26195 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26196 <entry>Default: <emphasis>unset</emphasis></entry>
26197 </row>
26198 </tbody>
26199 </tgroup>
26200 </informaltable>
26201 <para>
26202 <indexterm role="concept">
26203 <primary>local host</primary>
26204 <secondary>domains treated as</secondary>
26205 </indexterm>
26206 <indexterm role="concept">
26207 <primary>host</primary>
26208 <secondary>treated as local</secondary>
26209 </indexterm>
26210 If this option is set, any host names that match the domain list are treated as
26211 if they were the local host when Exim is scanning host lists obtained from MX
26212 records
26213 or other sources. Note that the value of this option is a domain list, not a
26214 host list, because it is always used to check host names, not IP addresses.
26215 </para>
26216 <para>
26217 This option also applies when Exim is matching the special items
26218 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
26219 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
26220 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
26221 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
26222 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
26223 interfaces and recognizing the local host.
26224 </para>
26225 <para>
26226 <indexterm role="option">
26227 <primary><option>ibase_servers</option></primary>
26228 </indexterm>
26229 </para>
26230 <informaltable frame="all">
26231 <tgroup cols="4" colsep="0" rowsep="0">
26232 <colspec colwidth="8*" align="left"/>
26233 <colspec colwidth="6*" align="center"/>
26234 <colspec colwidth="6*" align="center"/>
26235 <colspec colwidth="6*" align="right"/>
26236 <tbody>
26237 <row>
26238 <entry><option>ibase_servers</option></entry>
26239 <entry>Use: <emphasis>main</emphasis></entry>
26240 <entry>Type: <emphasis>string list</emphasis></entry>
26241 <entry>Default: <emphasis>unset</emphasis></entry>
26242 </row>
26243 </tbody>
26244 </tgroup>
26245 </informaltable>
26246 <para>
26247 <indexterm role="concept">
26248 <primary>InterBase</primary>
26249 <secondary>server list</secondary>
26250 </indexterm>
26251 This option provides a list of InterBase servers and associated connection data,
26252 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
26253 The option is available only if Exim has been built with InterBase support.
26254 </para>
26255 <para>
26256 <indexterm role="option">
26257 <primary><option>ignore_bounce_errors_after</option></primary>
26258 </indexterm>
26259 </para>
26260 <informaltable frame="all">
26261 <tgroup cols="4" colsep="0" rowsep="0">
26262 <colspec colwidth="8*" align="left"/>
26263 <colspec colwidth="6*" align="center"/>
26264 <colspec colwidth="6*" align="center"/>
26265 <colspec colwidth="6*" align="right"/>
26266 <tbody>
26267 <row>
26268 <entry><option>ignore_bounce_errors_after</option></entry>
26269 <entry>Use: <emphasis>main</emphasis></entry>
26270 <entry>Type: <emphasis>time</emphasis></entry>
26271 <entry>Default: <emphasis>10w</emphasis></entry>
26272 </row>
26273 </tbody>
26274 </tgroup>
26275 </informaltable>
26276 <para>
26277 <indexterm role="concept">
26278 <primary>bounce message</primary>
26279 <secondary>discarding</secondary>
26280 </indexterm>
26281 <indexterm role="concept">
26282 <primary>discarding bounce message</primary>
26283 </indexterm>
26284 This option affects the processing of bounce messages that cannot be delivered,
26285 that is, those that suffer a permanent delivery failure. (Bounce messages that
26286 suffer temporary delivery failures are of course retried in the usual way.)
26287 </para>
26288 <para>
26289 After a permanent delivery failure, bounce messages are frozen,
26290 because there is no sender to whom they can be returned. When a frozen bounce
26291 message has been on the queue for more than the given time, it is unfrozen at
26292 the next queue run, and a further delivery is attempted. If delivery fails
26293 again, the bounce message is discarded. This makes it possible to keep failed
26294 bounce messages around for a shorter time than the normal maximum retry time
26295 for frozen messages. For example,
26296 </para>
26297 <literallayout class="monospaced">
26298 ignore_bounce_errors_after = 12h
26299 </literallayout>
26300 <para>
26301 retries failed bounce message deliveries after 12 hours, discarding any further
26302 failures. If the value of this option is set to a zero time period, bounce
26303 failures are discarded immediately. Setting a very long time (as in the default
26304 value) has the effect of disabling this option. For ways of automatically
26305 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
26306 <option>timeout_frozen_after</option>.
26307 </para>
26308 <para>
26309 <indexterm role="option">
26310 <primary><option>ignore_fromline_hosts</option></primary>
26311 </indexterm>
26312 </para>
26313 <informaltable frame="all">
26314 <tgroup cols="4" colsep="0" rowsep="0">
26315 <colspec colwidth="8*" align="left"/>
26316 <colspec colwidth="6*" align="center"/>
26317 <colspec colwidth="6*" align="center"/>
26318 <colspec colwidth="6*" align="right"/>
26319 <tbody>
26320 <row>
26321 <entry><option>ignore_fromline_hosts</option></entry>
26322 <entry>Use: <emphasis>main</emphasis></entry>
26323 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26324 <entry>Default: <emphasis>unset</emphasis></entry>
26325 </row>
26326 </tbody>
26327 </tgroup>
26328 </informaltable>
26329 <para>
26330 <indexterm role="concept">
26331 <primary><quote>From</quote> line</primary>
26332 </indexterm>
26333 <indexterm role="concept">
26334 <primary>UUCP</primary>
26335 <secondary><quote>From</quote> line</secondary>
26336 </indexterm>
26337 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
26338 the headers of a message. By default this is treated as the start of the
26339 message&#x2019;s body, which means that any following headers are not recognized as
26340 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
26341 match those hosts that insist on sending it. If the sender is actually a local
26342 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
26343 <option>ignore_fromline_local</option> must be set to achieve this effect.
26344 </para>
26345 <para>
26346 <indexterm role="option">
26347 <primary><option>ignore_fromline_local</option></primary>
26348 </indexterm>
26349 </para>
26350 <informaltable frame="all">
26351 <tgroup cols="4" colsep="0" rowsep="0">
26352 <colspec colwidth="8*" align="left"/>
26353 <colspec colwidth="6*" align="center"/>
26354 <colspec colwidth="6*" align="center"/>
26355 <colspec colwidth="6*" align="right"/>
26356 <tbody>
26357 <row>
26358 <entry><option>ignore_fromline_local</option></entry>
26359 <entry>Use: <emphasis>main</emphasis></entry>
26360 <entry>Type: <emphasis>boolean</emphasis></entry>
26361 <entry>Default: <emphasis>false</emphasis></entry>
26362 </row>
26363 </tbody>
26364 </tgroup>
26365 </informaltable>
26366 <para>
26367 See <option>ignore_fromline_hosts</option> above.
26368 </para>
26369 <para>
26370 <indexterm role="option">
26371 <primary><option>keep_environment</option></primary>
26372 </indexterm>
26373 </para>
26374 <informaltable frame="all">
26375 <tgroup cols="4" colsep="0" rowsep="0">
26376 <colspec colwidth="8*" align="left"/>
26377 <colspec colwidth="6*" align="center"/>
26378 <colspec colwidth="6*" align="center"/>
26379 <colspec colwidth="6*" align="right"/>
26380 <tbody>
26381 <row>
26382 <entry><option>keep_environment</option></entry>
26383 <entry>Use: <emphasis>main</emphasis></entry>
26384 <entry>Type: <emphasis>string list</emphasis></entry>
26385 <entry>Default: <emphasis>unset</emphasis></entry>
26386 </row>
26387 </tbody>
26388 </tgroup>
26389 </informaltable>
26390 <para>
26391 <indexterm role="concept">
26392 <primary>environment</primary>
26393 <secondary>values from</secondary>
26394 </indexterm>
26395 This option contains a string list of environment variables to keep.
26396 You have to trust these variables or you have to be sure that
26397 these variables do not impose any security risk. Keep in mind that
26398 during the startup phase Exim is running with an effective UID 0 in most
26399 installations. As the default value is an empty list, the default
26400 environment for using libraries, running embedded Perl code, or running
26401 external binaries is empty, and does not not even contain PATH or HOME.
26402 </para>
26403 <para>
26404 Actually the list is interpreted as a list of patterns
26405 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
26406 </para>
26407 <para>
26408 WARNING: Macro substitution is still done first, so having a macro
26409 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
26410 unexpected results. You may work around this using a regular expression
26411 that does not match the macro name: ^[F]OO_HOME$.
26412 </para>
26413 <para>
26414 Current versions of Exim issue a warning during startup if you do not mention
26415 <option>keep_environment</option> in your runtime configuration file and if your
26416 current environment is not empty. Future versions may not issue that warning
26417 anymore.
26418 </para>
26419 <para>
26420 See the <option>add_environment</option> main config option for a way to set
26421 environment variables to a fixed value.  The environment for <command>pipe</command>
26422 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
26423 details.
26424 </para>
26425 <para>
26426 <indexterm role="option">
26427 <primary><option>keep_malformed</option></primary>
26428 </indexterm>
26429 </para>
26430 <informaltable frame="all">
26431 <tgroup cols="4" colsep="0" rowsep="0">
26432 <colspec colwidth="8*" align="left"/>
26433 <colspec colwidth="6*" align="center"/>
26434 <colspec colwidth="6*" align="center"/>
26435 <colspec colwidth="6*" align="right"/>
26436 <tbody>
26437 <row>
26438 <entry><option>keep_malformed</option></entry>
26439 <entry>Use: <emphasis>main</emphasis></entry>
26440 <entry>Type: <emphasis>time</emphasis></entry>
26441 <entry>Default: <emphasis>4d</emphasis></entry>
26442 </row>
26443 </tbody>
26444 </tgroup>
26445 </informaltable>
26446 <para>
26447 This option specifies the length of time to keep messages whose spool files
26448 have been corrupted in some way. This should, of course, never happen. At the
26449 next attempt to deliver such a message, it gets removed. The incident is
26450 logged.
26451 </para>
26452 <para>
26453 <indexterm role="option">
26454 <primary><option>ldap_ca_cert_dir</option></primary>
26455 </indexterm>
26456 </para>
26457 <informaltable frame="all">
26458 <tgroup cols="4" colsep="0" rowsep="0">
26459 <colspec colwidth="8*" align="left"/>
26460 <colspec colwidth="6*" align="center"/>
26461 <colspec colwidth="6*" align="center"/>
26462 <colspec colwidth="6*" align="right"/>
26463 <tbody>
26464 <row>
26465 <entry><option>ldap_ca_cert_dir</option></entry>
26466 <entry>Use: <emphasis>main</emphasis></entry>
26467 <entry>Type: <emphasis>string</emphasis></entry>
26468 <entry>Default: <emphasis>unset</emphasis></entry>
26469 </row>
26470 </tbody>
26471 </tgroup>
26472 </informaltable>
26473 <para>
26474 <indexterm role="concept">
26475 <primary>LDAP</primary>
26476 <secondary>,</secondary>
26477 </indexterm>
26478 <indexterm role="concept">
26479 <primary>certificate</primary>
26480 <secondary>directory for LDAP</secondary>
26481 </indexterm>
26482 This option indicates which directory contains CA certificates for verifying
26483 a TLS certificate presented by an LDAP server.
26484 While Exim does not provide a default value, your SSL library may.
26485 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26486 and constrained to be a directory.
26487 </para>
26488 <para>
26489 <indexterm role="option">
26490 <primary><option>ldap_ca_cert_file</option></primary>
26491 </indexterm>
26492 </para>
26493 <informaltable frame="all">
26494 <tgroup cols="4" colsep="0" rowsep="0">
26495 <colspec colwidth="8*" align="left"/>
26496 <colspec colwidth="6*" align="center"/>
26497 <colspec colwidth="6*" align="center"/>
26498 <colspec colwidth="6*" align="right"/>
26499 <tbody>
26500 <row>
26501 <entry><option>ldap_ca_cert_file</option></entry>
26502 <entry>Use: <emphasis>main</emphasis></entry>
26503 <entry>Type: <emphasis>string</emphasis></entry>
26504 <entry>Default: <emphasis>unset</emphasis></entry>
26505 </row>
26506 </tbody>
26507 </tgroup>
26508 </informaltable>
26509 <para>
26510 <indexterm role="concept">
26511 <primary>LDAP</primary>
26512 <secondary>,</secondary>
26513 </indexterm>
26514 <indexterm role="concept">
26515 <primary>certificate</primary>
26516 <secondary>file for LDAP</secondary>
26517 </indexterm>
26518 This option indicates which file contains CA certificates for verifying
26519 a TLS certificate presented by an LDAP server.
26520 While Exim does not provide a default value, your SSL library may.
26521 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
26522 and constrained to be a file.
26523 </para>
26524 <para>
26525 <indexterm role="option">
26526 <primary><option>ldap_cert_file</option></primary>
26527 </indexterm>
26528 </para>
26529 <informaltable frame="all">
26530 <tgroup cols="4" colsep="0" rowsep="0">
26531 <colspec colwidth="8*" align="left"/>
26532 <colspec colwidth="6*" align="center"/>
26533 <colspec colwidth="6*" align="center"/>
26534 <colspec colwidth="6*" align="right"/>
26535 <tbody>
26536 <row>
26537 <entry><option>ldap_cert_file</option></entry>
26538 <entry>Use: <emphasis>main</emphasis></entry>
26539 <entry>Type: <emphasis>string</emphasis></entry>
26540 <entry>Default: <emphasis>unset</emphasis></entry>
26541 </row>
26542 </tbody>
26543 </tgroup>
26544 </informaltable>
26545 <para>
26546 <indexterm role="concept">
26547 <primary>LDAP</primary>
26548 <secondary>TLS client certificate file</secondary>
26549 </indexterm>
26550 <indexterm role="concept">
26551 <primary>certificate</primary>
26552 <secondary>file for LDAP</secondary>
26553 </indexterm>
26554 This option indicates which file contains an TLS client certificate which
26555 Exim should present to the LDAP server during TLS negotiation.
26556 Should be used together with <option>ldap_cert_key</option>.
26557 </para>
26558 <para>
26559 <indexterm role="option">
26560 <primary><option>ldap_cert_key</option></primary>
26561 </indexterm>
26562 </para>
26563 <informaltable frame="all">
26564 <tgroup cols="4" colsep="0" rowsep="0">
26565 <colspec colwidth="8*" align="left"/>
26566 <colspec colwidth="6*" align="center"/>
26567 <colspec colwidth="6*" align="center"/>
26568 <colspec colwidth="6*" align="right"/>
26569 <tbody>
26570 <row>
26571 <entry><option>ldap_cert_key</option></entry>
26572 <entry>Use: <emphasis>main</emphasis></entry>
26573 <entry>Type: <emphasis>string</emphasis></entry>
26574 <entry>Default: <emphasis>unset</emphasis></entry>
26575 </row>
26576 </tbody>
26577 </tgroup>
26578 </informaltable>
26579 <para>
26580 <indexterm role="concept">
26581 <primary>LDAP</primary>
26582 <secondary>TLS client key file</secondary>
26583 </indexterm>
26584 <indexterm role="concept">
26585 <primary>certificate</primary>
26586 <secondary>key for LDAP</secondary>
26587 </indexterm>
26588 This option indicates which file contains the secret/private key to use
26589 to prove identity to the LDAP server during TLS negotiation.
26590 Should be used together with <option>ldap_cert_file</option>, which contains the
26591 identity to be proven.
26592 </para>
26593 <para>
26594 <indexterm role="option">
26595 <primary><option>ldap_cipher_suite</option></primary>
26596 </indexterm>
26597 </para>
26598 <informaltable frame="all">
26599 <tgroup cols="4" colsep="0" rowsep="0">
26600 <colspec colwidth="8*" align="left"/>
26601 <colspec colwidth="6*" align="center"/>
26602 <colspec colwidth="6*" align="center"/>
26603 <colspec colwidth="6*" align="right"/>
26604 <tbody>
26605 <row>
26606 <entry><option>ldap_cipher_suite</option></entry>
26607 <entry>Use: <emphasis>main</emphasis></entry>
26608 <entry>Type: <emphasis>string</emphasis></entry>
26609 <entry>Default: <emphasis>unset</emphasis></entry>
26610 </row>
26611 </tbody>
26612 </tgroup>
26613 </informaltable>
26614 <para>
26615 <indexterm role="concept">
26616 <primary>LDAP</primary>
26617 <secondary>TLS cipher suite</secondary>
26618 </indexterm>
26619 This controls the TLS cipher-suite negotiation during TLS negotiation with
26620 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
26621 cipher-suite options with OpenSSL (as used by LDAP client libraries).
26622 </para>
26623 <para>
26624 <indexterm role="option">
26625 <primary><option>ldap_default_servers</option></primary>
26626 </indexterm>
26627 </para>
26628 <informaltable frame="all">
26629 <tgroup cols="4" colsep="0" rowsep="0">
26630 <colspec colwidth="8*" align="left"/>
26631 <colspec colwidth="6*" align="center"/>
26632 <colspec colwidth="6*" align="center"/>
26633 <colspec colwidth="6*" align="right"/>
26634 <tbody>
26635 <row>
26636 <entry><option>ldap_default_servers</option></entry>
26637 <entry>Use: <emphasis>main</emphasis></entry>
26638 <entry>Type: <emphasis>string list</emphasis></entry>
26639 <entry>Default: <emphasis>unset</emphasis></entry>
26640 </row>
26641 </tbody>
26642 </tgroup>
26643 </informaltable>
26644 <para>
26645 <indexterm role="concept">
26646 <primary>LDAP</primary>
26647 <secondary>default servers</secondary>
26648 </indexterm>
26649 This option provides a list of LDAP servers which are tried in turn when an
26650 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
26651 details of LDAP queries. This option is available only when Exim has been built
26652 with LDAP support.
26653 </para>
26654 <para>
26655 <indexterm role="option">
26656 <primary><option>ldap_require_cert</option></primary>
26657 </indexterm>
26658 </para>
26659 <informaltable frame="all">
26660 <tgroup cols="4" colsep="0" rowsep="0">
26661 <colspec colwidth="8*" align="left"/>
26662 <colspec colwidth="6*" align="center"/>
26663 <colspec colwidth="6*" align="center"/>
26664 <colspec colwidth="6*" align="right"/>
26665 <tbody>
26666 <row>
26667 <entry><option>ldap_require_cert</option></entry>
26668 <entry>Use: <emphasis>main</emphasis></entry>
26669 <entry>Type: <emphasis>string</emphasis></entry>
26670 <entry>Default: <emphasis>unset.</emphasis></entry>
26671 </row>
26672 </tbody>
26673 </tgroup>
26674 </informaltable>
26675 <para>
26676 <indexterm role="concept">
26677 <primary>LDAP</primary>
26678 <secondary>policy for LDAP server TLS cert presentation</secondary>
26679 </indexterm>
26680 This should be one of the values "hard", "demand", "allow", "try" or "never".
26681 A value other than one of these is interpreted as "never".
26682 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
26683 Although Exim does not set a default, the LDAP library probably defaults
26684 to hard/demand.
26685 </para>
26686 <para>
26687 <indexterm role="option">
26688 <primary><option>ldap_start_tls</option></primary>
26689 </indexterm>
26690 </para>
26691 <informaltable frame="all">
26692 <tgroup cols="4" colsep="0" rowsep="0">
26693 <colspec colwidth="8*" align="left"/>
26694 <colspec colwidth="6*" align="center"/>
26695 <colspec colwidth="6*" align="center"/>
26696 <colspec colwidth="6*" align="right"/>
26697 <tbody>
26698 <row>
26699 <entry><option>ldap_start_tls</option></entry>
26700 <entry>Use: <emphasis>main</emphasis></entry>
26701 <entry>Type: <emphasis>boolean</emphasis></entry>
26702 <entry>Default: <emphasis>false</emphasis></entry>
26703 </row>
26704 </tbody>
26705 </tgroup>
26706 </informaltable>
26707 <para>
26708 <indexterm role="concept">
26709 <primary>LDAP</primary>
26710 <secondary>whether or not to negotiate TLS</secondary>
26711 </indexterm>
26712 If set, Exim will attempt to negotiate TLS with the LDAP server when
26713 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
26714 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
26715 of SSL-on-connect.
26716 In the event of failure to negotiate TLS, the action taken is controlled
26717 by <option>ldap_require_cert</option>.
26718 </para>
26719 <para revisionflag="changed">
26720 This option is ignored for <literal>ldapi</literal> connections.
26721 </para>
26722 <para>
26723 <indexterm role="option">
26724 <primary><option>ldap_version</option></primary>
26725 </indexterm>
26726 </para>
26727 <informaltable frame="all">
26728 <tgroup cols="4" colsep="0" rowsep="0">
26729 <colspec colwidth="8*" align="left"/>
26730 <colspec colwidth="6*" align="center"/>
26731 <colspec colwidth="6*" align="center"/>
26732 <colspec colwidth="6*" align="right"/>
26733 <tbody>
26734 <row>
26735 <entry><option>ldap_version</option></entry>
26736 <entry>Use: <emphasis>main</emphasis></entry>
26737 <entry>Type: <emphasis>integer</emphasis></entry>
26738 <entry>Default: <emphasis>unset</emphasis></entry>
26739 </row>
26740 </tbody>
26741 </tgroup>
26742 </informaltable>
26743 <para>
26744 <indexterm role="concept">
26745 <primary>LDAP</primary>
26746 <secondary>protocol version, forcing</secondary>
26747 </indexterm>
26748 This option can be used to force Exim to set a specific protocol version for
26749 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
26750 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
26751 the LDAP headers; otherwise it is 2. This option is available only when Exim
26752 has been built with LDAP support.
26753 </para>
26754 <para>
26755 <indexterm role="option">
26756 <primary><option>local_from_check</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>local_from_check</option></entry>
26768 <entry>Use: <emphasis>main</emphasis></entry>
26769 <entry>Type: <emphasis>boolean</emphasis></entry>
26770 <entry>Default: <emphasis>true</emphasis></entry>
26771 </row>
26772 </tbody>
26773 </tgroup>
26774 </informaltable>
26775 <para>
26776 <indexterm role="concept">
26777 <primary><emphasis>Sender:</emphasis> header line</primary>
26778 <secondary>disabling addition of</secondary>
26779 </indexterm>
26780 <indexterm role="concept">
26781 <primary><emphasis>From:</emphasis> header line</primary>
26782 <secondary>disabling checking of</secondary>
26783 </indexterm>
26784 When a message is submitted locally (that is, not over a TCP/IP connection) by
26785 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
26786 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
26787 the domain specified by <option>qualify_domain</option>.
26788 </para>
26789 <para>
26790 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
26791 locally submitted message is automatically qualified by Exim, unless the
26792 <option>-bnq</option> command line option is used.
26793 </para>
26794 <para>
26795 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
26796 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
26797 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
26798 and the default qualify domain.
26799 </para>
26800 <para>
26801 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
26802 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
26803 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
26804 <option>local_sender_retain</option> to be true.
26805 </para>
26806 <para>
26807 <indexterm role="concept">
26808 <primary>envelope sender</primary>
26809 </indexterm>
26810 These options affect only the header lines in the message. The envelope sender
26811 is still forced to be the login id at the qualify domain unless
26812 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
26813 </para>
26814 <para>
26815 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
26816 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
26817 has more details about <emphasis>Sender:</emphasis> processing.
26818 </para>
26819 <para>
26820 <indexterm role="option">
26821 <primary><option>local_from_prefix</option></primary>
26822 </indexterm>
26823 </para>
26824 <informaltable frame="all">
26825 <tgroup cols="4" colsep="0" rowsep="0">
26826 <colspec colwidth="8*" align="left"/>
26827 <colspec colwidth="6*" align="center"/>
26828 <colspec colwidth="6*" align="center"/>
26829 <colspec colwidth="6*" align="right"/>
26830 <tbody>
26831 <row>
26832 <entry><option>local_from_prefix</option></entry>
26833 <entry>Use: <emphasis>main</emphasis></entry>
26834 <entry>Type: <emphasis>string</emphasis></entry>
26835 <entry>Default: <emphasis>unset</emphasis></entry>
26836 </row>
26837 </tbody>
26838 </tgroup>
26839 </informaltable>
26840 <para>
26841 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
26842 matching the login id (see <option>local_from_check</option> above), it can be configured to
26843 ignore certain prefixes and suffixes in the local part of the address. This is
26844 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
26845 appropriate lists, in the same form as the <option>local_part_prefix</option> and
26846 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
26847 example, if
26848 </para>
26849 <literallayout class="monospaced">
26850 local_from_prefix = *-
26851 </literallayout>
26852 <para>
26853 is set, a <emphasis>From:</emphasis> line containing
26854 </para>
26855 <literallayout class="monospaced">
26856 From: anything-user@your.domain.example
26857 </literallayout>
26858 <para>
26859 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
26860 matches the actual sender address that is constructed from the login name and
26861 qualify domain.
26862 </para>
26863 <para>
26864 <indexterm role="option">
26865 <primary><option>local_from_suffix</option></primary>
26866 </indexterm>
26867 </para>
26868 <informaltable frame="all">
26869 <tgroup cols="4" colsep="0" rowsep="0">
26870 <colspec colwidth="8*" align="left"/>
26871 <colspec colwidth="6*" align="center"/>
26872 <colspec colwidth="6*" align="center"/>
26873 <colspec colwidth="6*" align="right"/>
26874 <tbody>
26875 <row>
26876 <entry><option>local_from_suffix</option></entry>
26877 <entry>Use: <emphasis>main</emphasis></entry>
26878 <entry>Type: <emphasis>string</emphasis></entry>
26879 <entry>Default: <emphasis>unset</emphasis></entry>
26880 </row>
26881 </tbody>
26882 </tgroup>
26883 </informaltable>
26884 <para>
26885 See <option>local_from_prefix</option> above.
26886 </para>
26887 <para>
26888 <indexterm role="option">
26889 <primary><option>local_interfaces</option></primary>
26890 </indexterm>
26891 </para>
26892 <informaltable frame="all">
26893 <tgroup cols="4" colsep="0" rowsep="0">
26894 <colspec colwidth="8*" align="left"/>
26895 <colspec colwidth="6*" align="center"/>
26896 <colspec colwidth="6*" align="center"/>
26897 <colspec colwidth="6*" align="right"/>
26898 <tbody>
26899 <row>
26900 <entry><option>local_interfaces</option></entry>
26901 <entry>Use: <emphasis>main</emphasis></entry>
26902 <entry>Type: <emphasis>string list</emphasis></entry>
26903 <entry>Default: <emphasis>see below</emphasis></entry>
26904 </row>
26905 </tbody>
26906 </tgroup>
26907 </informaltable>
26908 <para>
26909 This option controls which network interfaces are used by the daemon for
26910 listening; they are also used to identify the local host when routing. Chapter
26911 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
26912 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
26913 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
26914 <option>local_interfaces</option> is
26915 </para>
26916 <literallayout class="monospaced">
26917 local_interfaces = 0.0.0.0
26918 </literallayout>
26919 <para>
26920 when Exim is built without IPv6 support; otherwise it is
26921 </para>
26922 <literallayout class="monospaced">
26923 local_interfaces = &lt;; ::0 ; 0.0.0.0
26924 </literallayout>
26925 <para>
26926 <indexterm role="option">
26927 <primary><option>local_scan_timeout</option></primary>
26928 </indexterm>
26929 </para>
26930 <informaltable frame="all">
26931 <tgroup cols="4" colsep="0" rowsep="0">
26932 <colspec colwidth="8*" align="left"/>
26933 <colspec colwidth="6*" align="center"/>
26934 <colspec colwidth="6*" align="center"/>
26935 <colspec colwidth="6*" align="right"/>
26936 <tbody>
26937 <row>
26938 <entry><option>local_scan_timeout</option></entry>
26939 <entry>Use: <emphasis>main</emphasis></entry>
26940 <entry>Type: <emphasis>time</emphasis></entry>
26941 <entry>Default: <emphasis>5m</emphasis></entry>
26942 </row>
26943 </tbody>
26944 </tgroup>
26945 </informaltable>
26946 <para>
26947 <indexterm role="concept">
26948 <primary>timeout</primary>
26949 <secondary>for <function>local_scan()</function> function</secondary>
26950 </indexterm>
26951 <indexterm role="concept">
26952 <primary><function>local_scan()</function> function</primary>
26953 <secondary>timeout</secondary>
26954 </indexterm>
26955 This timeout applies to the <function>local_scan()</function> function (see chapter
26956 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
26957 the incoming message is rejected with a temporary error if it is an SMTP
26958 message. For a non-SMTP message, the message is dropped and Exim ends with a
26959 non-zero code. The incident is logged on the main and reject logs.
26960 </para>
26961 <para>
26962 <indexterm role="option">
26963 <primary><option>local_sender_retain</option></primary>
26964 </indexterm>
26965 </para>
26966 <informaltable frame="all">
26967 <tgroup cols="4" colsep="0" rowsep="0">
26968 <colspec colwidth="8*" align="left"/>
26969 <colspec colwidth="6*" align="center"/>
26970 <colspec colwidth="6*" align="center"/>
26971 <colspec colwidth="6*" align="right"/>
26972 <tbody>
26973 <row>
26974 <entry><option>local_sender_retain</option></entry>
26975 <entry>Use: <emphasis>main</emphasis></entry>
26976 <entry>Type: <emphasis>boolean</emphasis></entry>
26977 <entry>Default: <emphasis>false</emphasis></entry>
26978 </row>
26979 </tbody>
26980 </tgroup>
26981 </informaltable>
26982 <para>
26983 <indexterm role="concept">
26984 <primary><emphasis>Sender:</emphasis> header line</primary>
26985 <secondary>retaining from local submission</secondary>
26986 </indexterm>
26987 When a message is submitted locally (that is, not over a TCP/IP connection) by
26988 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
26989 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
26990 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
26991 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
26992 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
26993 </para>
26994 <para>
26995 <indexterm role="option">
26996 <primary><option>localhost_number</option></primary>
26997 </indexterm>
26998 </para>
26999 <informaltable frame="all">
27000 <tgroup cols="4" colsep="0" rowsep="0">
27001 <colspec colwidth="8*" align="left"/>
27002 <colspec colwidth="6*" align="center"/>
27003 <colspec colwidth="6*" align="center"/>
27004 <colspec colwidth="6*" align="right"/>
27005 <tbody>
27006 <row>
27007 <entry><option>localhost_number</option></entry>
27008 <entry>Use: <emphasis>main</emphasis></entry>
27009 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27010 <entry>Default: <emphasis>unset</emphasis></entry>
27011 </row>
27012 </tbody>
27013 </tgroup>
27014 </informaltable>
27015 <para>
27016 <indexterm role="concept">
27017 <primary>host</primary>
27018 <secondary>locally unique number for</secondary>
27019 </indexterm>
27020 <indexterm role="concept">
27021 <primary>message ids</primary>
27022 <secondary>with multiple hosts</secondary>
27023 </indexterm>
27024 <indexterm role="variable">
27025 <primary><varname>$localhost_number</varname></primary>
27026 </indexterm>
27027 Exim&#x2019;s message ids are normally unique only within the local host. If
27028 uniqueness among a set of hosts is required, each host must set a different
27029 value for the <option>localhost_number</option> option. The string is expanded immediately
27030 after reading the configuration file (so that a number can be computed from the
27031 host name, for example) and the result of the expansion must be a number in the
27032 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
27033 systems). This is available in subsequent string expansions via the variable
27034 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
27035 characters of the message id, instead of just being a fractional part of the
27036 time, are computed from the time and the local host number as described in
27037 section <xref linkend="SECTmessiden"/>.
27038 </para>
27039 <para>
27040 <indexterm role="option">
27041 <primary><option>log_file_path</option></primary>
27042 </indexterm>
27043 </para>
27044 <informaltable frame="all">
27045 <tgroup cols="4" colsep="0" rowsep="0">
27046 <colspec colwidth="8*" align="left"/>
27047 <colspec colwidth="6*" align="center"/>
27048 <colspec colwidth="6*" align="center"/>
27049 <colspec colwidth="6*" align="right"/>
27050 <tbody>
27051 <row>
27052 <entry><option>log_file_path</option></entry>
27053 <entry>Use: <emphasis>main</emphasis></entry>
27054 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27055 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27056 </row>
27057 </tbody>
27058 </tgroup>
27059 </informaltable>
27060 <para>
27061 <indexterm role="concept">
27062 <primary>log</primary>
27063 <secondary>file path for</secondary>
27064 </indexterm>
27065 This option sets the path which is used to determine the names of Exim&#x2019;s log
27066 files, or indicates that logging is to be to syslog, or both. It is expanded
27067 when Exim is entered, so it can, for example, contain a reference to the host
27068 name. If no specific path is set for the log files at compile or run time,
27069 or if the option is unset at run time (i.e.  <literal>log_file_path = </literal>)
27070 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
27071 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
27072 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
27073 used. If this string is fixed at your installation (contains no expansion
27074 variables) it is recommended that you do not set this option in the
27075 configuration file, but instead supply the path using LOG_FILE_PATH in
27076 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
27077 early on &ndash; in particular, failure to read the configuration file.
27078 </para>
27079 <para>
27080 <indexterm role="option">
27081 <primary><option>log_selector</option></primary>
27082 </indexterm>
27083 </para>
27084 <informaltable frame="all">
27085 <tgroup cols="4" colsep="0" rowsep="0">
27086 <colspec colwidth="8*" align="left"/>
27087 <colspec colwidth="6*" align="center"/>
27088 <colspec colwidth="6*" align="center"/>
27089 <colspec colwidth="6*" align="right"/>
27090 <tbody>
27091 <row>
27092 <entry><option>log_selector</option></entry>
27093 <entry>Use: <emphasis>main</emphasis></entry>
27094 <entry>Type: <emphasis>string</emphasis></entry>
27095 <entry>Default: <emphasis>unset</emphasis></entry>
27096 </row>
27097 </tbody>
27098 </tgroup>
27099 </informaltable>
27100 <para>
27101 <indexterm role="concept">
27102 <primary>log</primary>
27103 <secondary>selectors</secondary>
27104 </indexterm>
27105 This option can be used to reduce or increase the number of things that Exim
27106 writes to its log files. Its argument is made up of names preceded by plus or
27107 minus characters. For example:
27108 </para>
27109 <literallayout class="monospaced">
27110 log_selector = +arguments -retry_defer
27111 </literallayout>
27112 <para>
27113 A list of possible names and what they control is given in the chapter on
27114 logging, in section <xref linkend="SECTlogselector"/>.
27115 </para>
27116 <para>
27117 <indexterm role="option">
27118 <primary><option>log_timezone</option></primary>
27119 </indexterm>
27120 </para>
27121 <informaltable frame="all">
27122 <tgroup cols="4" colsep="0" rowsep="0">
27123 <colspec colwidth="8*" align="left"/>
27124 <colspec colwidth="6*" align="center"/>
27125 <colspec colwidth="6*" align="center"/>
27126 <colspec colwidth="6*" align="right"/>
27127 <tbody>
27128 <row>
27129 <entry><option>log_timezone</option></entry>
27130 <entry>Use: <emphasis>main</emphasis></entry>
27131 <entry>Type: <emphasis>boolean</emphasis></entry>
27132 <entry>Default: <emphasis>false</emphasis></entry>
27133 </row>
27134 </tbody>
27135 </tgroup>
27136 </informaltable>
27137 <para>
27138 <indexterm role="concept">
27139 <primary>log</primary>
27140 <secondary>timezone for entries</secondary>
27141 </indexterm>
27142 <indexterm role="variable">
27143 <primary><varname>$tod_log</varname></primary>
27144 </indexterm>
27145 <indexterm role="variable">
27146 <primary><varname>$tod_zone</varname></primary>
27147 </indexterm>
27148 By default, the timestamps on log lines are in local time without the
27149 timezone. This means that if your timezone changes twice a year, the timestamps
27150 in log lines are ambiguous for an hour when the clocks go back. One way of
27151 avoiding this problem is to set the timezone to UTC. An alternative is to set
27152 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
27153 timestamps in log lines. Turning on this option can add quite a lot to the size
27154 of log files because each line is extended by 6 characters. Note that the
27155 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
27156 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
27157 </para>
27158 <para>
27159 <indexterm role="option">
27160 <primary><option>lookup_open_max</option></primary>
27161 </indexterm>
27162 </para>
27163 <informaltable frame="all">
27164 <tgroup cols="4" colsep="0" rowsep="0">
27165 <colspec colwidth="8*" align="left"/>
27166 <colspec colwidth="6*" align="center"/>
27167 <colspec colwidth="6*" align="center"/>
27168 <colspec colwidth="6*" align="right"/>
27169 <tbody>
27170 <row>
27171 <entry><option>lookup_open_max</option></entry>
27172 <entry>Use: <emphasis>main</emphasis></entry>
27173 <entry>Type: <emphasis>integer</emphasis></entry>
27174 <entry>Default: <emphasis>25</emphasis></entry>
27175 </row>
27176 </tbody>
27177 </tgroup>
27178 </informaltable>
27179 <para>
27180 <indexterm role="concept">
27181 <primary>too many open files</primary>
27182 </indexterm>
27183 <indexterm role="concept">
27184 <primary>open files, too many</primary>
27185 </indexterm>
27186 <indexterm role="concept">
27187 <primary>file</primary>
27188 <secondary>too many open</secondary>
27189 </indexterm>
27190 <indexterm role="concept">
27191 <primary>lookup</primary>
27192 <secondary>maximum open files</secondary>
27193 </indexterm>
27194 <indexterm role="concept">
27195 <primary>limit</primary>
27196 <secondary>open files for lookups</secondary>
27197 </indexterm>
27198 This option limits the number of simultaneously open files for single-key
27199 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
27200 Exim normally keeps these files open during routing, because often the same
27201 file is required several times. If the limit is reached, Exim closes the least
27202 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
27203 actually opens two files for each logical DBM database, though it still counts
27204 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
27205 open files</quote> errors with NDBM, you need to reduce the value of
27206 <option>lookup_open_max</option>.
27207 </para>
27208 <para>
27209 <indexterm role="option">
27210 <primary><option>max_username_length</option></primary>
27211 </indexterm>
27212 </para>
27213 <informaltable frame="all">
27214 <tgroup cols="4" colsep="0" rowsep="0">
27215 <colspec colwidth="8*" align="left"/>
27216 <colspec colwidth="6*" align="center"/>
27217 <colspec colwidth="6*" align="center"/>
27218 <colspec colwidth="6*" align="right"/>
27219 <tbody>
27220 <row>
27221 <entry><option>max_username_length</option></entry>
27222 <entry>Use: <emphasis>main</emphasis></entry>
27223 <entry>Type: <emphasis>integer</emphasis></entry>
27224 <entry>Default: <emphasis>0</emphasis></entry>
27225 </row>
27226 </tbody>
27227 </tgroup>
27228 </informaltable>
27229 <para>
27230 <indexterm role="concept">
27231 <primary>length of login name</primary>
27232 </indexterm>
27233 <indexterm role="concept">
27234 <primary>user name</primary>
27235 <secondary>maximum length</secondary>
27236 </indexterm>
27237 <indexterm role="concept">
27238 <primary>limit</primary>
27239 <secondary>user name length</secondary>
27240 </indexterm>
27241 Some operating systems are broken in that they truncate long arguments to
27242 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
27243 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
27244 an argument that is longer behaves as if <function>getpwnam()</function> failed.
27245 </para>
27246 <para>
27247 <indexterm role="option">
27248 <primary><option>message_body_newlines</option></primary>
27249 </indexterm>
27250 </para>
27251 <informaltable frame="all">
27252 <tgroup cols="4" colsep="0" rowsep="0">
27253 <colspec colwidth="8*" align="left"/>
27254 <colspec colwidth="6*" align="center"/>
27255 <colspec colwidth="6*" align="center"/>
27256 <colspec colwidth="6*" align="right"/>
27257 <tbody>
27258 <row>
27259 <entry><option>message_body_newlines</option></entry>
27260 <entry>Use: <emphasis>main</emphasis></entry>
27261 <entry>Type: <emphasis>bool</emphasis></entry>
27262 <entry>Default: <emphasis>false</emphasis></entry>
27263 </row>
27264 </tbody>
27265 </tgroup>
27266 </informaltable>
27267 <para>
27268 <indexterm role="concept">
27269 <primary>message body</primary>
27270 <secondary>newlines in variables</secondary>
27271 </indexterm>
27272 <indexterm role="concept">
27273 <primary>newline</primary>
27274 <secondary>in message body variables</secondary>
27275 </indexterm>
27276 <indexterm role="variable">
27277 <primary><varname>$message_body</varname></primary>
27278 </indexterm>
27279 <indexterm role="variable">
27280 <primary><varname>$message_body_end</varname></primary>
27281 </indexterm>
27282 By default, newlines in the message body are replaced by spaces when setting
27283 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
27284 option is set true, this no longer happens.
27285 </para>
27286 <para>
27287 <indexterm role="option">
27288 <primary><option>message_body_visible</option></primary>
27289 </indexterm>
27290 </para>
27291 <informaltable frame="all">
27292 <tgroup cols="4" colsep="0" rowsep="0">
27293 <colspec colwidth="8*" align="left"/>
27294 <colspec colwidth="6*" align="center"/>
27295 <colspec colwidth="6*" align="center"/>
27296 <colspec colwidth="6*" align="right"/>
27297 <tbody>
27298 <row>
27299 <entry><option>message_body_visible</option></entry>
27300 <entry>Use: <emphasis>main</emphasis></entry>
27301 <entry>Type: <emphasis>integer</emphasis></entry>
27302 <entry>Default: <emphasis>500</emphasis></entry>
27303 </row>
27304 </tbody>
27305 </tgroup>
27306 </informaltable>
27307 <para>
27308 <indexterm role="concept">
27309 <primary>body of message</primary>
27310 <secondary>visible size</secondary>
27311 </indexterm>
27312 <indexterm role="concept">
27313 <primary>message body</primary>
27314 <secondary>visible size</secondary>
27315 </indexterm>
27316 <indexterm role="variable">
27317 <primary><varname>$message_body</varname></primary>
27318 </indexterm>
27319 <indexterm role="variable">
27320 <primary><varname>$message_body_end</varname></primary>
27321 </indexterm>
27322 This option specifies how much of a message&#x2019;s body is to be included in the
27323 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
27324 </para>
27325 <para>
27326 <indexterm role="option">
27327 <primary><option>message_id_header_domain</option></primary>
27328 </indexterm>
27329 </para>
27330 <informaltable frame="all">
27331 <tgroup cols="4" colsep="0" rowsep="0">
27332 <colspec colwidth="8*" align="left"/>
27333 <colspec colwidth="6*" align="center"/>
27334 <colspec colwidth="6*" align="center"/>
27335 <colspec colwidth="6*" align="right"/>
27336 <tbody>
27337 <row>
27338 <entry><option>message_id_header_domain</option></entry>
27339 <entry>Use: <emphasis>main</emphasis></entry>
27340 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27341 <entry>Default: <emphasis>unset</emphasis></entry>
27342 </row>
27343 </tbody>
27344 </tgroup>
27345 </informaltable>
27346 <para>
27347 <indexterm role="concept">
27348 <primary><emphasis>Message-ID:</emphasis> header line</primary>
27349 </indexterm>
27350 If this option is set, the string is expanded and used as the right hand side
27351 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
27352 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
27353 means <quote>not received over TCP/IP.</quote>
27354 Otherwise, the primary host name is used.
27355 Only letters, digits, dot and hyphen are accepted; any other characters are
27356 replaced by hyphens. If the expansion is forced to fail, or if the result is an
27357 empty string, the option is ignored.
27358 </para>
27359 <para>
27360 <indexterm role="option">
27361 <primary><option>message_id_header_text</option></primary>
27362 </indexterm>
27363 </para>
27364 <informaltable frame="all">
27365 <tgroup cols="4" colsep="0" rowsep="0">
27366 <colspec colwidth="8*" align="left"/>
27367 <colspec colwidth="6*" align="center"/>
27368 <colspec colwidth="6*" align="center"/>
27369 <colspec colwidth="6*" align="right"/>
27370 <tbody>
27371 <row>
27372 <entry><option>message_id_header_text</option></entry>
27373 <entry>Use: <emphasis>main</emphasis></entry>
27374 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27375 <entry>Default: <emphasis>unset</emphasis></entry>
27376 </row>
27377 </tbody>
27378 </tgroup>
27379 </informaltable>
27380 <para>
27381 If this variable is set, the string is expanded and used to augment the text of
27382 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
27383 message does not have one. The text of this header is required by RFC 2822 to
27384 take the form of an address. By default, Exim uses its internal message id as
27385 the local part, and the primary host name as the domain. If this option is set,
27386 it is expanded, and provided the expansion is not forced to fail, and does not
27387 yield an empty string, the result is inserted into the header immediately
27388 before the @, separated from the internal message id by a dot. Any characters
27389 that are illegal in an address are automatically converted into hyphens. This
27390 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
27391 colons will become hyphens.
27392 </para>
27393 <para>
27394 <indexterm role="option">
27395 <primary><option>message_logs</option></primary>
27396 </indexterm>
27397 </para>
27398 <informaltable frame="all">
27399 <tgroup cols="4" colsep="0" rowsep="0">
27400 <colspec colwidth="8*" align="left"/>
27401 <colspec colwidth="6*" align="center"/>
27402 <colspec colwidth="6*" align="center"/>
27403 <colspec colwidth="6*" align="right"/>
27404 <tbody>
27405 <row>
27406 <entry><option>message_logs</option></entry>
27407 <entry>Use: <emphasis>main</emphasis></entry>
27408 <entry>Type: <emphasis>boolean</emphasis></entry>
27409 <entry>Default: <emphasis>true</emphasis></entry>
27410 </row>
27411 </tbody>
27412 </tgroup>
27413 </informaltable>
27414 <para>
27415 <indexterm role="concept">
27416 <primary>message logs</primary>
27417 <secondary>disabling</secondary>
27418 </indexterm>
27419 <indexterm role="concept">
27420 <primary>log</primary>
27421 <secondary>message log; disabling</secondary>
27422 </indexterm>
27423 If this option is turned off, per-message log files are not created in the
27424 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
27425 Exim, by reducing the number of files involved in handling a message from a
27426 minimum of four (header spool file, body spool file, delivery journal, and
27427 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
27428 which is not affected by this option.
27429 </para>
27430 <para>
27431 <indexterm role="option">
27432 <primary><option>message_size_limit</option></primary>
27433 </indexterm>
27434 </para>
27435 <informaltable frame="all">
27436 <tgroup cols="4" colsep="0" rowsep="0">
27437 <colspec colwidth="8*" align="left"/>
27438 <colspec colwidth="6*" align="center"/>
27439 <colspec colwidth="6*" align="center"/>
27440 <colspec colwidth="6*" align="right"/>
27441 <tbody>
27442 <row>
27443 <entry><option>message_size_limit</option></entry>
27444 <entry>Use: <emphasis>main</emphasis></entry>
27445 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27446 <entry>Default: <emphasis>50M</emphasis></entry>
27447 </row>
27448 </tbody>
27449 </tgroup>
27450 </informaltable>
27451 <para>
27452 <indexterm role="concept">
27453 <primary>message</primary>
27454 <secondary>size limit</secondary>
27455 </indexterm>
27456 <indexterm role="concept">
27457 <primary>limit</primary>
27458 <secondary>message size</secondary>
27459 </indexterm>
27460 <indexterm role="concept">
27461 <primary>size</primary>
27462 <secondary>of message, limit</secondary>
27463 </indexterm>
27464 This option limits the maximum size of message that Exim will process. The
27465 value is expanded for each incoming connection so, for example, it can be made
27466 to depend on the IP address of the remote host for messages arriving via
27467 TCP/IP. After expansion, the value must be a sequence of decimal digits,
27468 optionally followed by K or M.
27469 </para>
27470 <para>
27471 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
27472 other properties of an individual message, because it has to be advertised in
27473 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
27474 error. A value of zero means no limit, but its use is not recommended. See also
27475 <option>bounce_return_size_limit</option>.
27476 </para>
27477 <para>
27478 Incoming SMTP messages are failed with a 552 error if the limit is
27479 exceeded; locally-generated messages either get a stderr message or a delivery
27480 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
27481 an oversized message is logged in both the main and the reject logs. See also
27482 the generic transport option <option>message_size_limit</option>, which limits the size of
27483 message that an individual transport can process.
27484 </para>
27485 <para>
27486 If you use a virus-scanner and set this option to to a value larger than the
27487 maximum size that your virus-scanner is configured to support, you may get
27488 failures triggered by large mails.  The right size to configure for the
27489 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
27490 probably safest to just set it to a little larger than this value.  E.g., with a
27491 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
27492 some problems may result.
27493 </para>
27494 <para>
27495 A value of 0 will disable size limit checking; Exim will still advertise the
27496 SIZE extension in an EHLO response, but without a limit, so as to permit
27497 SMTP clients to still indicate the message size along with the MAIL verb.
27498 </para>
27499 <para>
27500 <indexterm role="option">
27501 <primary><option>move_frozen_messages</option></primary>
27502 </indexterm>
27503 </para>
27504 <informaltable frame="all">
27505 <tgroup cols="4" colsep="0" rowsep="0">
27506 <colspec colwidth="8*" align="left"/>
27507 <colspec colwidth="6*" align="center"/>
27508 <colspec colwidth="6*" align="center"/>
27509 <colspec colwidth="6*" align="right"/>
27510 <tbody>
27511 <row>
27512 <entry><option>move_frozen_messages</option></entry>
27513 <entry>Use: <emphasis>main</emphasis></entry>
27514 <entry>Type: <emphasis>boolean</emphasis></entry>
27515 <entry>Default: <emphasis>false</emphasis></entry>
27516 </row>
27517 </tbody>
27518 </tgroup>
27519 </informaltable>
27520 <para>
27521 <indexterm role="concept">
27522 <primary>frozen messages</primary>
27523 <secondary>moving</secondary>
27524 </indexterm>
27525 This option, which is available only if Exim has been built with the setting
27526 </para>
27527 <literallayout class="monospaced">
27528 SUPPORT_MOVE_FROZEN_MESSAGES=yes
27529 </literallayout>
27530 <para>
27531 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
27532 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
27533 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
27534 standard utilities for handling such moved messages, and they do not show up in
27535 lists generated by <option>-bp</option> or by the Exim monitor.
27536 </para>
27537 <para>
27538 <indexterm role="option">
27539 <primary><option>mua_wrapper</option></primary>
27540 </indexterm>
27541 </para>
27542 <informaltable frame="all">
27543 <tgroup cols="4" colsep="0" rowsep="0">
27544 <colspec colwidth="8*" align="left"/>
27545 <colspec colwidth="6*" align="center"/>
27546 <colspec colwidth="6*" align="center"/>
27547 <colspec colwidth="6*" align="right"/>
27548 <tbody>
27549 <row>
27550 <entry><option>mua_wrapper</option></entry>
27551 <entry>Use: <emphasis>main</emphasis></entry>
27552 <entry>Type: <emphasis>boolean</emphasis></entry>
27553 <entry>Default: <emphasis>false</emphasis></entry>
27554 </row>
27555 </tbody>
27556 </tgroup>
27557 </informaltable>
27558 <para>
27559 Setting this option true causes Exim to run in a very restrictive mode in which
27560 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
27561 contains a full description of this facility.
27562 </para>
27563 <para>
27564 <indexterm role="option">
27565 <primary><option>mysql_servers</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>mysql_servers</option></entry>
27577 <entry>Use: <emphasis>main</emphasis></entry>
27578 <entry>Type: <emphasis>string list</emphasis></entry>
27579 <entry>Default: <emphasis>unset</emphasis></entry>
27580 </row>
27581 </tbody>
27582 </tgroup>
27583 </informaltable>
27584 <para>
27585 <indexterm role="concept">
27586 <primary>MySQL</primary>
27587 <secondary>server list</secondary>
27588 </indexterm>
27589 This option provides a list of MySQL servers and associated connection data, to
27590 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
27591 option is available only if Exim has been built with MySQL support.
27592 </para>
27593 <para>
27594 <indexterm role="option">
27595 <primary><option>never_users</option></primary>
27596 </indexterm>
27597 </para>
27598 <informaltable frame="all">
27599 <tgroup cols="4" colsep="0" rowsep="0">
27600 <colspec colwidth="8*" align="left"/>
27601 <colspec colwidth="6*" align="center"/>
27602 <colspec colwidth="6*" align="center"/>
27603 <colspec colwidth="6*" align="right"/>
27604 <tbody>
27605 <row>
27606 <entry><option>never_users</option></entry>
27607 <entry>Use: <emphasis>main</emphasis></entry>
27608 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27609 <entry>Default: <emphasis>unset</emphasis></entry>
27610 </row>
27611 </tbody>
27612 </tgroup>
27613 </informaltable>
27614 <para>
27615 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
27616 message deliveries are normally run in processes that are setuid to the
27617 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
27618 It is usually desirable to prevent any deliveries from running as root, as a
27619 safety precaution.
27620 </para>
27621 <para>
27622 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
27623 list of users that must not be used for local deliveries. This list is fixed in
27624 the binary and cannot be overridden by the configuration file. By default, it
27625 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
27626 can be used to add more users to the fixed list.
27627 </para>
27628 <para>
27629 If a message is to be delivered as one of the users on the fixed list or the
27630 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
27631 example is
27632 </para>
27633 <literallayout class="monospaced">
27634 never_users = root:daemon:bin
27635 </literallayout>
27636 <para>
27637 Including root is redundant if it is also on the fixed list, but it does no
27638 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
27639 transport driver.
27640 </para>
27641 <para>
27642 <indexterm role="option">
27643 <primary><option>openssl_options</option></primary>
27644 </indexterm>
27645 </para>
27646 <informaltable frame="all">
27647 <tgroup cols="4" colsep="0" rowsep="0">
27648 <colspec colwidth="8*" align="left"/>
27649 <colspec colwidth="6*" align="center"/>
27650 <colspec colwidth="6*" align="center"/>
27651 <colspec colwidth="6*" align="right"/>
27652 <tbody>
27653 <row>
27654 <entry><option>openssl_options</option></entry>
27655 <entry>Use: <emphasis>main</emphasis></entry>
27656 <entry>Type: <emphasis>string list</emphasis></entry>
27657 <entry>Default: <emphasis>+no_sslv2 +single_dh_use +no_ticket</emphasis></entry>
27658 </row>
27659 </tbody>
27660 </tgroup>
27661 </informaltable>
27662 <para>
27663 <indexterm role="concept">
27664 <primary>OpenSSL </primary>
27665 <secondary>compatibility</secondary>
27666 </indexterm>
27667 This option allows an administrator to adjust the SSL options applied
27668 by OpenSSL to connections.  It is given as a space-separated list of items,
27669 each one to be +added or -subtracted from the current value.
27670 </para>
27671 <para>
27672 This option is only available if Exim is built against OpenSSL.  The values
27673 available for this option vary according to the age of your OpenSSL install.
27674 The <quote>all</quote> value controls a subset of flags which are available, typically
27675 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
27676 list the values known on your system and Exim should support all the
27677 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
27678 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
27679 </para>
27680 <para>
27681 Note that adjusting the options can have severe impact upon the security of
27682 SSL as used by Exim.  It is possible to disable safety checks and shoot
27683 yourself in the foot in various unpleasant ways.  This option should not be
27684 adjusted lightly.  An unrecognised item will be detected at startup, by
27685 invoking Exim with the <option>-bV</option> flag.
27686 </para>
27687 <para>
27688 The option affects Exim operating both as a server and as a client.
27689 </para>
27690 <para>
27691 Historical note: prior to release 4.80, Exim defaulted this value to
27692 "+dont_insert_empty_fragments", which may still be needed for compatibility
27693 with some clients, but which lowers security by increasing exposure to
27694 some now infamous attacks.
27695 </para>
27696 <para>
27697 Examples:
27698 </para>
27699 <literallayout class="monospaced">
27700 # Make both old MS and old Eudora happy:
27701 openssl_options = -all +microsoft_big_sslv3_buffer \
27702                        +dont_insert_empty_fragments
27703
27704 # Disable older protocol versions:
27705 openssl_options = +no_sslv2 +no_sslv3
27706 </literallayout>
27707 <para>
27708 Possible options may include:
27709 </para>
27710 <itemizedlist>
27711 <listitem>
27712 <para>
27713 <literal>all</literal>
27714 </para>
27715 </listitem>
27716 <listitem>
27717 <para>
27718 <literal>allow_unsafe_legacy_renegotiation</literal>
27719 </para>
27720 </listitem>
27721 <listitem>
27722 <para>
27723 <literal>cipher_server_preference</literal>
27724 </para>
27725 </listitem>
27726 <listitem>
27727 <para>
27728 <literal>dont_insert_empty_fragments</literal>
27729 </para>
27730 </listitem>
27731 <listitem>
27732 <para>
27733 <literal>ephemeral_rsa</literal>
27734 </para>
27735 </listitem>
27736 <listitem>
27737 <para>
27738 <literal>legacy_server_connect</literal>
27739 </para>
27740 </listitem>
27741 <listitem>
27742 <para>
27743 <literal>microsoft_big_sslv3_buffer</literal>
27744 </para>
27745 </listitem>
27746 <listitem>
27747 <para>
27748 <literal>microsoft_sess_id_bug</literal>
27749 </para>
27750 </listitem>
27751 <listitem>
27752 <para>
27753 <literal>msie_sslv2_rsa_padding</literal>
27754 </para>
27755 </listitem>
27756 <listitem>
27757 <para>
27758 <literal>netscape_challenge_bug</literal>
27759 </para>
27760 </listitem>
27761 <listitem>
27762 <para>
27763 <literal>netscape_reuse_cipher_change_bug</literal>
27764 </para>
27765 </listitem>
27766 <listitem>
27767 <para>
27768 <literal>no_compression</literal>
27769 </para>
27770 </listitem>
27771 <listitem>
27772 <para>
27773 <literal>no_session_resumption_on_renegotiation</literal>
27774 </para>
27775 </listitem>
27776 <listitem>
27777 <para>
27778 <literal>no_sslv2</literal>
27779 </para>
27780 </listitem>
27781 <listitem>
27782 <para>
27783 <literal>no_sslv3</literal>
27784 </para>
27785 </listitem>
27786 <listitem>
27787 <para>
27788 <literal>no_ticket</literal>
27789 </para>
27790 </listitem>
27791 <listitem>
27792 <para>
27793 <literal>no_tlsv1</literal>
27794 </para>
27795 </listitem>
27796 <listitem>
27797 <para>
27798 <literal>no_tlsv1_1</literal>
27799 </para>
27800 </listitem>
27801 <listitem>
27802 <para>
27803 <literal>no_tlsv1_2</literal>
27804 </para>
27805 </listitem>
27806 <listitem>
27807 <para>
27808 <literal>safari_ecdhe_ecdsa_bug</literal>
27809 </para>
27810 </listitem>
27811 <listitem>
27812 <para>
27813 <literal>single_dh_use</literal>
27814 </para>
27815 </listitem>
27816 <listitem>
27817 <para>
27818 <literal>single_ecdh_use</literal>
27819 </para>
27820 </listitem>
27821 <listitem>
27822 <para>
27823 <literal>ssleay_080_client_dh_bug</literal>
27824 </para>
27825 </listitem>
27826 <listitem>
27827 <para>
27828 <literal>sslref2_reuse_cert_type_bug</literal>
27829 </para>
27830 </listitem>
27831 <listitem>
27832 <para>
27833 <literal>tls_block_padding_bug</literal>
27834 </para>
27835 </listitem>
27836 <listitem>
27837 <para>
27838 <literal>tls_d5_bug</literal>
27839 </para>
27840 </listitem>
27841 <listitem>
27842 <para>
27843 <literal>tls_rollback_bug</literal>
27844 </para>
27845 </listitem>
27846 </itemizedlist>
27847 <para>
27848 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
27849 all clients connecting using the MacOS SecureTransport TLS facility prior
27850 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
27851 to negotiate TLS then this option value might help, provided that your OpenSSL
27852 release is new enough to contain this work-around.  This may be a situation
27853 where you have to upgrade OpenSSL to get buggy clients working.
27854 </para>
27855 <para>
27856 <indexterm role="option">
27857 <primary><option>oracle_servers</option></primary>
27858 </indexterm>
27859 </para>
27860 <informaltable frame="all">
27861 <tgroup cols="4" colsep="0" rowsep="0">
27862 <colspec colwidth="8*" align="left"/>
27863 <colspec colwidth="6*" align="center"/>
27864 <colspec colwidth="6*" align="center"/>
27865 <colspec colwidth="6*" align="right"/>
27866 <tbody>
27867 <row>
27868 <entry><option>oracle_servers</option></entry>
27869 <entry>Use: <emphasis>main</emphasis></entry>
27870 <entry>Type: <emphasis>string list</emphasis></entry>
27871 <entry>Default: <emphasis>unset</emphasis></entry>
27872 </row>
27873 </tbody>
27874 </tgroup>
27875 </informaltable>
27876 <para>
27877 <indexterm role="concept">
27878 <primary>Oracle</primary>
27879 <secondary>server list</secondary>
27880 </indexterm>
27881 This option provides a list of Oracle servers and associated connection data,
27882 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
27883 The option is available only if Exim has been built with Oracle support.
27884 </para>
27885 <para>
27886 <indexterm role="option">
27887 <primary><option>percent_hack_domains</option></primary>
27888 </indexterm>
27889 </para>
27890 <informaltable frame="all">
27891 <tgroup cols="4" colsep="0" rowsep="0">
27892 <colspec colwidth="8*" align="left"/>
27893 <colspec colwidth="6*" align="center"/>
27894 <colspec colwidth="6*" align="center"/>
27895 <colspec colwidth="6*" align="right"/>
27896 <tbody>
27897 <row>
27898 <entry><option>percent_hack_domains</option></entry>
27899 <entry>Use: <emphasis>main</emphasis></entry>
27900 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27901 <entry>Default: <emphasis>unset</emphasis></entry>
27902 </row>
27903 </tbody>
27904 </tgroup>
27905 </informaltable>
27906 <para>
27907 <indexterm role="concept">
27908 <primary><quote>percent hack</quote></primary>
27909 </indexterm>
27910 <indexterm role="concept">
27911 <primary>source routing</primary>
27912 <secondary>in email address</secondary>
27913 </indexterm>
27914 <indexterm role="concept">
27915 <primary>address</primary>
27916 <secondary>source-routed</secondary>
27917 </indexterm>
27918 The <quote>percent hack</quote> is the convention whereby a local part containing a
27919 percent sign is re-interpreted as a new email address, with the percent
27920 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
27921 also applied to RFC 2822 addresses that begin with an @ character. If this
27922 option is set, Exim implements the percent facility for those domains listed,
27923 but no others. This happens before an incoming SMTP address is tested against
27924 an ACL.
27925 </para>
27926 <para>
27927 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
27928 trying to get round relaying restrictions. For this reason, it is best avoided
27929 if at all possible. Unfortunately, a number of less security-conscious MTAs
27930 implement it unconditionally. If you are running Exim on a gateway host, and
27931 routing mail through to internal MTAs without processing the local parts, it is
27932 a good idea to reject recipient addresses with percent characters in their
27933 local parts. Exim&#x2019;s default configuration does this.
27934 </para>
27935 <para>
27936 <indexterm role="option">
27937 <primary><option>perl_at_start</option></primary>
27938 </indexterm>
27939 </para>
27940 <informaltable frame="all">
27941 <tgroup cols="4" colsep="0" rowsep="0">
27942 <colspec colwidth="8*" align="left"/>
27943 <colspec colwidth="6*" align="center"/>
27944 <colspec colwidth="6*" align="center"/>
27945 <colspec colwidth="6*" align="right"/>
27946 <tbody>
27947 <row>
27948 <entry><option>perl_at_start</option></entry>
27949 <entry>Use: <emphasis>main</emphasis></entry>
27950 <entry>Type: <emphasis>boolean</emphasis></entry>
27951 <entry>Default: <emphasis>false</emphasis></entry>
27952 </row>
27953 </tbody>
27954 </tgroup>
27955 </informaltable>
27956 <para>
27957 <indexterm role="concept">
27958 <primary>Perl</primary>
27959 </indexterm>
27960 This option is available only when Exim is built with an embedded Perl
27961 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27962 </para>
27963 <para>
27964 <indexterm role="option">
27965 <primary><option>perl_startup</option></primary>
27966 </indexterm>
27967 </para>
27968 <informaltable frame="all">
27969 <tgroup cols="4" colsep="0" rowsep="0">
27970 <colspec colwidth="8*" align="left"/>
27971 <colspec colwidth="6*" align="center"/>
27972 <colspec colwidth="6*" align="center"/>
27973 <colspec colwidth="6*" align="right"/>
27974 <tbody>
27975 <row>
27976 <entry><option>perl_startup</option></entry>
27977 <entry>Use: <emphasis>main</emphasis></entry>
27978 <entry>Type: <emphasis>string</emphasis></entry>
27979 <entry>Default: <emphasis>unset</emphasis></entry>
27980 </row>
27981 </tbody>
27982 </tgroup>
27983 </informaltable>
27984 <para>
27985 <indexterm role="concept">
27986 <primary>Perl</primary>
27987 </indexterm>
27988 This option is available only when Exim is built with an embedded Perl
27989 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
27990 </para>
27991 <para>
27992 <indexterm role="option">
27993 <primary><option>perl_startup</option></primary>
27994 </indexterm>
27995 </para>
27996 <informaltable frame="all">
27997 <tgroup cols="4" colsep="0" rowsep="0">
27998 <colspec colwidth="8*" align="left"/>
27999 <colspec colwidth="6*" align="center"/>
28000 <colspec colwidth="6*" align="center"/>
28001 <colspec colwidth="6*" align="right"/>
28002 <tbody>
28003 <row>
28004 <entry><option>perl_startup</option></entry>
28005 <entry>Use: <emphasis>main</emphasis></entry>
28006 <entry>Type: <emphasis>boolean</emphasis></entry>
28007 <entry>Default: <emphasis>false</emphasis></entry>
28008 </row>
28009 </tbody>
28010 </tgroup>
28011 </informaltable>
28012 <para>
28013 <indexterm role="concept">
28014 <primary>Perl</primary>
28015 </indexterm>
28016 This Option enables the taint mode of the embedded Perl interpreter.
28017 </para>
28018 <para>
28019 <indexterm role="option">
28020 <primary><option>pgsql_servers</option></primary>
28021 </indexterm>
28022 </para>
28023 <informaltable frame="all">
28024 <tgroup cols="4" colsep="0" rowsep="0">
28025 <colspec colwidth="8*" align="left"/>
28026 <colspec colwidth="6*" align="center"/>
28027 <colspec colwidth="6*" align="center"/>
28028 <colspec colwidth="6*" align="right"/>
28029 <tbody>
28030 <row>
28031 <entry><option>pgsql_servers</option></entry>
28032 <entry>Use: <emphasis>main</emphasis></entry>
28033 <entry>Type: <emphasis>string list</emphasis></entry>
28034 <entry>Default: <emphasis>unset</emphasis></entry>
28035 </row>
28036 </tbody>
28037 </tgroup>
28038 </informaltable>
28039 <para>
28040 <indexterm role="concept">
28041 <primary>PostgreSQL lookup type</primary>
28042 <secondary>server list</secondary>
28043 </indexterm>
28044 This option provides a list of PostgreSQL servers and associated connection
28045 data, to be used in conjunction with <command>pgsql</command> lookups (see section
28046 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
28047 PostgreSQL support.
28048 </para>
28049 <para>
28050 <indexterm role="option">
28051 <primary><option>pid_file_path</option></primary>
28052 </indexterm>
28053 </para>
28054 <informaltable frame="all">
28055 <tgroup cols="4" colsep="0" rowsep="0">
28056 <colspec colwidth="8*" align="left"/>
28057 <colspec colwidth="6*" align="center"/>
28058 <colspec colwidth="6*" align="center"/>
28059 <colspec colwidth="6*" align="right"/>
28060 <tbody>
28061 <row>
28062 <entry><option>pid_file_path</option></entry>
28063 <entry>Use: <emphasis>main</emphasis></entry>
28064 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28065 <entry>Default: <emphasis>set at compile time</emphasis></entry>
28066 </row>
28067 </tbody>
28068 </tgroup>
28069 </informaltable>
28070 <para>
28071 <indexterm role="concept">
28072 <primary>daemon</primary>
28073 <secondary>pid file path</secondary>
28074 </indexterm>
28075 <indexterm role="concept">
28076 <primary>pid file, path for</primary>
28077 </indexterm>
28078 This option sets the name of the file to which the Exim daemon writes its
28079 process id. The string is expanded, so it can contain, for example, references
28080 to the host name:
28081 </para>
28082 <literallayout class="monospaced">
28083 pid_file_path = /var/log/$primary_hostname/exim.pid
28084 </literallayout>
28085 <para>
28086 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
28087 spool directory.
28088 The value set by the option can be overridden by the <option>-oP</option> command line
28089 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
28090 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
28091 </para>
28092 <para>
28093 <indexterm role="option">
28094 <primary><option>pipelining_advertise_hosts</option></primary>
28095 </indexterm>
28096 </para>
28097 <informaltable frame="all">
28098 <tgroup cols="4" colsep="0" rowsep="0">
28099 <colspec colwidth="8*" align="left"/>
28100 <colspec colwidth="6*" align="center"/>
28101 <colspec colwidth="6*" align="center"/>
28102 <colspec colwidth="6*" align="right"/>
28103 <tbody>
28104 <row>
28105 <entry><option>pipelining_advertise_hosts</option></entry>
28106 <entry>Use: <emphasis>main</emphasis></entry>
28107 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28108 <entry>Default: <emphasis>*</emphasis></entry>
28109 </row>
28110 </tbody>
28111 </tgroup>
28112 </informaltable>
28113 <para>
28114 <indexterm role="concept">
28115 <primary>PIPELINING</primary>
28116 <secondary>suppressing advertising</secondary>
28117 </indexterm>
28118 This option can be used to suppress the advertisement of the SMTP
28119 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
28120 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
28121 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
28122 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
28123 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
28124 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
28125 </para>
28126 <para>
28127 <indexterm role="option">
28128 <primary><option>prdr_enable</option></primary>
28129 </indexterm>
28130 </para>
28131 <informaltable frame="all">
28132 <tgroup cols="4" colsep="0" rowsep="0">
28133 <colspec colwidth="8*" align="left"/>
28134 <colspec colwidth="6*" align="center"/>
28135 <colspec colwidth="6*" align="center"/>
28136 <colspec colwidth="6*" align="right"/>
28137 <tbody>
28138 <row>
28139 <entry><option>prdr_enable</option></entry>
28140 <entry>Use: <emphasis>main</emphasis></entry>
28141 <entry>Type: <emphasis>boolean</emphasis></entry>
28142 <entry>Default: <emphasis>false</emphasis></entry>
28143 </row>
28144 </tbody>
28145 </tgroup>
28146 </informaltable>
28147 <para>
28148 <indexterm role="concept">
28149 <primary>PRDR</primary>
28150 <secondary>enabling on server</secondary>
28151 </indexterm>
28152 This option can be used to enable the Per-Recipient Data Response extension
28153 to SMTP, defined by Eric Hall.
28154 If the option is set, PRDR is advertised by Exim when operating as a server.
28155 If the client requests PRDR, and more than one recipient, for a message
28156 an additional ACL is called for each recipient after the message content
28157 is received.  See section <xref linkend="SECTPRDRACL"/>.
28158 </para>
28159 <para>
28160 <indexterm role="option">
28161 <primary><option>preserve_message_logs</option></primary>
28162 </indexterm>
28163 </para>
28164 <informaltable frame="all">
28165 <tgroup cols="4" colsep="0" rowsep="0">
28166 <colspec colwidth="8*" align="left"/>
28167 <colspec colwidth="6*" align="center"/>
28168 <colspec colwidth="6*" align="center"/>
28169 <colspec colwidth="6*" align="right"/>
28170 <tbody>
28171 <row>
28172 <entry><option>preserve_message_logs</option></entry>
28173 <entry>Use: <emphasis>main</emphasis></entry>
28174 <entry>Type: <emphasis>boolean</emphasis></entry>
28175 <entry>Default: <emphasis>false</emphasis></entry>
28176 </row>
28177 </tbody>
28178 </tgroup>
28179 </informaltable>
28180 <para>
28181 <indexterm role="concept">
28182 <primary>message logs</primary>
28183 <secondary>preserving</secondary>
28184 </indexterm>
28185 If this option is set, message log files are not deleted when messages are
28186 completed. Instead, they are moved to a sub-directory of the spool directory
28187 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
28188 purposes. This is a dangerous option to set on systems with any appreciable
28189 volume of mail. Use with care!
28190 </para>
28191 <para>
28192 <indexterm role="option">
28193 <primary><option>primary_hostname</option></primary>
28194 </indexterm>
28195 </para>
28196 <informaltable frame="all">
28197 <tgroup cols="4" colsep="0" rowsep="0">
28198 <colspec colwidth="8*" align="left"/>
28199 <colspec colwidth="6*" align="center"/>
28200 <colspec colwidth="6*" align="center"/>
28201 <colspec colwidth="6*" align="right"/>
28202 <tbody>
28203 <row>
28204 <entry><option>primary_hostname</option></entry>
28205 <entry>Use: <emphasis>main</emphasis></entry>
28206 <entry>Type: <emphasis>string</emphasis></entry>
28207 <entry>Default: <emphasis>see below</emphasis></entry>
28208 </row>
28209 </tbody>
28210 </tgroup>
28211 </informaltable>
28212 <para>
28213 <indexterm role="concept">
28214 <primary>name</primary>
28215 <secondary>of local host</secondary>
28216 </indexterm>
28217 <indexterm role="concept">
28218 <primary>host</primary>
28219 <secondary>name of local</secondary>
28220 </indexterm>
28221 <indexterm role="concept">
28222 <primary>local host</primary>
28223 <secondary>name of</secondary>
28224 </indexterm>
28225 <indexterm role="variable">
28226 <primary><varname>$primary_hostname</varname></primary>
28227 </indexterm>
28228 This specifies the name of the current host. It is used in the default EHLO or
28229 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
28230 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
28231 The value is also used by default in some SMTP response messages from an Exim
28232 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
28233 </para>
28234 <para>
28235 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
28236 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
28237 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
28238 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
28239 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
28240 explicitly by this option, or defaulted.
28241 </para>
28242 <para>
28243 <indexterm role="option">
28244 <primary><option>print_topbitchars</option></primary>
28245 </indexterm>
28246 </para>
28247 <informaltable frame="all">
28248 <tgroup cols="4" colsep="0" rowsep="0">
28249 <colspec colwidth="8*" align="left"/>
28250 <colspec colwidth="6*" align="center"/>
28251 <colspec colwidth="6*" align="center"/>
28252 <colspec colwidth="6*" align="right"/>
28253 <tbody>
28254 <row>
28255 <entry><option>print_topbitchars</option></entry>
28256 <entry>Use: <emphasis>main</emphasis></entry>
28257 <entry>Type: <emphasis>boolean</emphasis></entry>
28258 <entry>Default: <emphasis>false</emphasis></entry>
28259 </row>
28260 </tbody>
28261 </tgroup>
28262 </informaltable>
28263 <para>
28264 <indexterm role="concept">
28265 <primary>printing characters</primary>
28266 </indexterm>
28267 <indexterm role="concept">
28268 <primary>8-bit characters</primary>
28269 </indexterm>
28270 By default, Exim considers only those characters whose codes lie in the range
28271 32&ndash;126 to be printing characters. In a number of circumstances (for example,
28272 when writing log entries) non-printing characters are converted into escape
28273 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
28274 is set, code values of 128 and above are also considered to be printing
28275 characters.
28276 </para>
28277 <para>
28278 This option also affects the header syntax checks performed by the
28279 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
28280 the user&#x2019;s full name when constructing From: and Sender: addresses (as
28281 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
28282 Exim to generate eight bit message headers that do not conform to the
28283 standards.
28284 </para>
28285 <para>
28286 <indexterm role="option">
28287 <primary><option>process_log_path</option></primary>
28288 </indexterm>
28289 </para>
28290 <informaltable frame="all">
28291 <tgroup cols="4" colsep="0" rowsep="0">
28292 <colspec colwidth="8*" align="left"/>
28293 <colspec colwidth="6*" align="center"/>
28294 <colspec colwidth="6*" align="center"/>
28295 <colspec colwidth="6*" align="right"/>
28296 <tbody>
28297 <row>
28298 <entry><option>process_log_path</option></entry>
28299 <entry>Use: <emphasis>main</emphasis></entry>
28300 <entry>Type: <emphasis>string</emphasis></entry>
28301 <entry>Default: <emphasis>unset</emphasis></entry>
28302 </row>
28303 </tbody>
28304 </tgroup>
28305 </informaltable>
28306 <para>
28307 <indexterm role="concept">
28308 <primary>process log path</primary>
28309 </indexterm>
28310 <indexterm role="concept">
28311 <primary>log</primary>
28312 <secondary>process log</secondary>
28313 </indexterm>
28314 <indexterm role="concept">
28315 <primary><emphasis>exiwhat</emphasis></primary>
28316 </indexterm>
28317 This option sets the name of the file to which an Exim process writes its
28318 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
28319 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
28320 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
28321 can be useful in environments where two different Exims are running, using
28322 different spool directories.
28323 </para>
28324 <para>
28325 <indexterm role="option">
28326 <primary><option>prod_requires_admin</option></primary>
28327 </indexterm>
28328 </para>
28329 <informaltable frame="all">
28330 <tgroup cols="4" colsep="0" rowsep="0">
28331 <colspec colwidth="8*" align="left"/>
28332 <colspec colwidth="6*" align="center"/>
28333 <colspec colwidth="6*" align="center"/>
28334 <colspec colwidth="6*" align="right"/>
28335 <tbody>
28336 <row>
28337 <entry><option>prod_requires_admin</option></entry>
28338 <entry>Use: <emphasis>main</emphasis></entry>
28339 <entry>Type: <emphasis>boolean</emphasis></entry>
28340 <entry>Default: <emphasis>true</emphasis></entry>
28341 </row>
28342 </tbody>
28343 </tgroup>
28344 </informaltable>
28345 <para>
28346 <indexterm role="option">
28347 <primary><option>-M</option></primary>
28348 </indexterm>
28349 <indexterm role="option">
28350 <primary><option>-R</option></primary>
28351 </indexterm>
28352 <indexterm role="option">
28353 <primary><option>-q</option></primary>
28354 </indexterm>
28355 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
28356 admin user unless <option>prod_requires_admin</option> is set false. See also
28357 <option>queue_list_requires_admin</option>.
28358 </para>
28359 <para>
28360 <indexterm role="option">
28361 <primary><option>qualify_domain</option></primary>
28362 </indexterm>
28363 </para>
28364 <informaltable frame="all">
28365 <tgroup cols="4" colsep="0" rowsep="0">
28366 <colspec colwidth="8*" align="left"/>
28367 <colspec colwidth="6*" align="center"/>
28368 <colspec colwidth="6*" align="center"/>
28369 <colspec colwidth="6*" align="right"/>
28370 <tbody>
28371 <row>
28372 <entry><option>qualify_domain</option></entry>
28373 <entry>Use: <emphasis>main</emphasis></entry>
28374 <entry>Type: <emphasis>string</emphasis></entry>
28375 <entry>Default: <emphasis>see below</emphasis></entry>
28376 </row>
28377 </tbody>
28378 </tgroup>
28379 </informaltable>
28380 <para>
28381 <indexterm role="concept">
28382 <primary>domain</primary>
28383 <secondary>for qualifying addresses</secondary>
28384 </indexterm>
28385 <indexterm role="concept">
28386 <primary>address</primary>
28387 <secondary>qualification</secondary>
28388 </indexterm>
28389 This option specifies the domain name that is added to any envelope sender
28390 addresses that do not have a domain qualification. It also applies to
28391 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
28392 are accepted by default only for locally-generated messages. Qualification is
28393 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
28394 locally-generated messages, unless the <option>-bnq</option> command line option is used.
28395 </para>
28396 <para>
28397 Messages from external sources must always contain fully qualified addresses,
28398 unless the sending host matches <option>sender_unqualified_hosts</option> or
28399 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
28400 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
28401 necessary. Internally, Exim always works with fully qualified envelope
28402 addresses. If <option>qualify_domain</option> is not set, it defaults to the
28403 <option>primary_hostname</option> value.
28404 </para>
28405 <para>
28406 <indexterm role="option">
28407 <primary><option>qualify_recipient</option></primary>
28408 </indexterm>
28409 </para>
28410 <informaltable frame="all">
28411 <tgroup cols="4" colsep="0" rowsep="0">
28412 <colspec colwidth="8*" align="left"/>
28413 <colspec colwidth="6*" align="center"/>
28414 <colspec colwidth="6*" align="center"/>
28415 <colspec colwidth="6*" align="right"/>
28416 <tbody>
28417 <row>
28418 <entry><option>qualify_recipient</option></entry>
28419 <entry>Use: <emphasis>main</emphasis></entry>
28420 <entry>Type: <emphasis>string</emphasis></entry>
28421 <entry>Default: <emphasis>see below</emphasis></entry>
28422 </row>
28423 </tbody>
28424 </tgroup>
28425 </informaltable>
28426 <para>
28427 This option allows you to specify a different domain for qualifying recipient
28428 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
28429 </para>
28430 <para>
28431 <indexterm role="option">
28432 <primary><option>queue_domains</option></primary>
28433 </indexterm>
28434 </para>
28435 <informaltable frame="all">
28436 <tgroup cols="4" colsep="0" rowsep="0">
28437 <colspec colwidth="8*" align="left"/>
28438 <colspec colwidth="6*" align="center"/>
28439 <colspec colwidth="6*" align="center"/>
28440 <colspec colwidth="6*" align="right"/>
28441 <tbody>
28442 <row>
28443 <entry><option>queue_domains</option></entry>
28444 <entry>Use: <emphasis>main</emphasis></entry>
28445 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28446 <entry>Default: <emphasis>unset</emphasis></entry>
28447 </row>
28448 </tbody>
28449 </tgroup>
28450 </informaltable>
28451 <para>
28452 <indexterm role="concept">
28453 <primary>domain</primary>
28454 <secondary>specifying non-immediate delivery</secondary>
28455 </indexterm>
28456 <indexterm role="concept">
28457 <primary>queueing incoming messages</primary>
28458 </indexterm>
28459 <indexterm role="concept">
28460 <primary>message</primary>
28461 <secondary>queueing certain domains</secondary>
28462 </indexterm>
28463 This option lists domains for which immediate delivery is not required.
28464 A delivery process is started whenever a message is received, but only those
28465 domains that do not match are processed. All other deliveries wait until the
28466 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
28467 </para>
28468 <para>
28469 <indexterm role="option">
28470 <primary><option>queue_list_requires_admin</option></primary>
28471 </indexterm>
28472 </para>
28473 <informaltable frame="all">
28474 <tgroup cols="4" colsep="0" rowsep="0">
28475 <colspec colwidth="8*" align="left"/>
28476 <colspec colwidth="6*" align="center"/>
28477 <colspec colwidth="6*" align="center"/>
28478 <colspec colwidth="6*" align="right"/>
28479 <tbody>
28480 <row>
28481 <entry><option>queue_list_requires_admin</option></entry>
28482 <entry>Use: <emphasis>main</emphasis></entry>
28483 <entry>Type: <emphasis>boolean</emphasis></entry>
28484 <entry>Default: <emphasis>true</emphasis></entry>
28485 </row>
28486 </tbody>
28487 </tgroup>
28488 </informaltable>
28489 <para>
28490 <indexterm role="option">
28491 <primary><option>-bp</option></primary>
28492 </indexterm>
28493 The <option>-bp</option> command-line option, which lists the messages that are on the
28494 queue, requires the caller to be an admin user unless
28495 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
28496 </para>
28497 <para>
28498 <indexterm role="option">
28499 <primary><option>queue_only</option></primary>
28500 </indexterm>
28501 </para>
28502 <informaltable frame="all">
28503 <tgroup cols="4" colsep="0" rowsep="0">
28504 <colspec colwidth="8*" align="left"/>
28505 <colspec colwidth="6*" align="center"/>
28506 <colspec colwidth="6*" align="center"/>
28507 <colspec colwidth="6*" align="right"/>
28508 <tbody>
28509 <row>
28510 <entry><option>queue_only</option></entry>
28511 <entry>Use: <emphasis>main</emphasis></entry>
28512 <entry>Type: <emphasis>boolean</emphasis></entry>
28513 <entry>Default: <emphasis>false</emphasis></entry>
28514 </row>
28515 </tbody>
28516 </tgroup>
28517 </informaltable>
28518 <para>
28519 <indexterm role="concept">
28520 <primary>queueing incoming messages</primary>
28521 </indexterm>
28522 <indexterm role="concept">
28523 <primary>message</primary>
28524 <secondary>queueing unconditionally</secondary>
28525 </indexterm>
28526 If <option>queue_only</option> is set, a delivery process is not automatically started
28527 whenever a message is received. Instead, the message waits on the queue for the
28528 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
28529 delivered immediately when certain conditions (such as heavy load) occur.
28530 </para>
28531 <para>
28532 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
28533 and <option>-odi</option> command line options override <option>queue_only</option> unless
28534 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
28535 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
28536 </para>
28537 <para>
28538 <indexterm role="option">
28539 <primary><option>queue_only_file</option></primary>
28540 </indexterm>
28541 </para>
28542 <informaltable frame="all">
28543 <tgroup cols="4" colsep="0" rowsep="0">
28544 <colspec colwidth="8*" align="left"/>
28545 <colspec colwidth="6*" align="center"/>
28546 <colspec colwidth="6*" align="center"/>
28547 <colspec colwidth="6*" align="right"/>
28548 <tbody>
28549 <row>
28550 <entry><option>queue_only_file</option></entry>
28551 <entry>Use: <emphasis>main</emphasis></entry>
28552 <entry>Type: <emphasis>string</emphasis></entry>
28553 <entry>Default: <emphasis>unset</emphasis></entry>
28554 </row>
28555 </tbody>
28556 </tgroup>
28557 </informaltable>
28558 <para>
28559 <indexterm role="concept">
28560 <primary>queueing incoming messages</primary>
28561 </indexterm>
28562 <indexterm role="concept">
28563 <primary>message</primary>
28564 <secondary>queueing by file existence</secondary>
28565 </indexterm>
28566 This option can be set to a colon-separated list of absolute path names, each
28567 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
28568 it tests for the existence of each listed path using a call to <function>stat()</function>. For
28569 each path that exists, the corresponding queueing option is set.
28570 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
28571 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
28572 </para>
28573 <literallayout class="monospaced">
28574 queue_only_file = smtp/some/file
28575 </literallayout>
28576 <para>
28577 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
28578 <filename>/some/file</filename> exists.
28579 </para>
28580 <para>
28581 <indexterm role="option">
28582 <primary><option>queue_only_load</option></primary>
28583 </indexterm>
28584 </para>
28585 <informaltable frame="all">
28586 <tgroup cols="4" colsep="0" rowsep="0">
28587 <colspec colwidth="8*" align="left"/>
28588 <colspec colwidth="6*" align="center"/>
28589 <colspec colwidth="6*" align="center"/>
28590 <colspec colwidth="6*" align="right"/>
28591 <tbody>
28592 <row>
28593 <entry><option>queue_only_load</option></entry>
28594 <entry>Use: <emphasis>main</emphasis></entry>
28595 <entry>Type: <emphasis>fixed-point</emphasis></entry>
28596 <entry>Default: <emphasis>unset</emphasis></entry>
28597 </row>
28598 </tbody>
28599 </tgroup>
28600 </informaltable>
28601 <para>
28602 <indexterm role="concept">
28603 <primary>load average</primary>
28604 </indexterm>
28605 <indexterm role="concept">
28606 <primary>queueing incoming messages</primary>
28607 </indexterm>
28608 <indexterm role="concept">
28609 <primary>message</primary>
28610 <secondary>queueing by load</secondary>
28611 </indexterm>
28612 If the system load average is higher than this value, incoming messages from
28613 all sources are queued, and no automatic deliveries are started. If this
28614 happens during local or remote SMTP input, all subsequent messages received on
28615 the same SMTP connection are queued by default, whatever happens to the load in
28616 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
28617 false.
28618 </para>
28619 <para>
28620 Deliveries will subsequently be performed by queue runner processes. This
28621 option has no effect on ancient operating systems on which Exim cannot
28622 determine the load average. See also <option>deliver_queue_load_max</option> and
28623 <option>smtp_load_reserve</option>.
28624 </para>
28625 <para>
28626 <indexterm role="option">
28627 <primary><option>queue_only_load_latch</option></primary>
28628 </indexterm>
28629 </para>
28630 <informaltable frame="all">
28631 <tgroup cols="4" colsep="0" rowsep="0">
28632 <colspec colwidth="8*" align="left"/>
28633 <colspec colwidth="6*" align="center"/>
28634 <colspec colwidth="6*" align="center"/>
28635 <colspec colwidth="6*" align="right"/>
28636 <tbody>
28637 <row>
28638 <entry><option>queue_only_load_latch</option></entry>
28639 <entry>Use: <emphasis>main</emphasis></entry>
28640 <entry>Type: <emphasis>boolean</emphasis></entry>
28641 <entry>Default: <emphasis>true</emphasis></entry>
28642 </row>
28643 </tbody>
28644 </tgroup>
28645 </informaltable>
28646 <para>
28647 <indexterm role="concept">
28648 <primary>load average</primary>
28649 <secondary>re-evaluating per message</secondary>
28650 </indexterm>
28651 When this option is true (the default), once one message has been queued
28652 because the load average is higher than the value set by <option>queue_only_load</option>,
28653 all subsequent messages received on the same SMTP connection are also queued.
28654 This is a deliberate choice; even though the load average may fall below the
28655 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
28656 connection when not delivering earlier ones. However, there are special
28657 circumstances such as very long-lived connections from scanning appliances
28658 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
28659 should be set false. This causes the value of the load average to be
28660 re-evaluated for each message.
28661 </para>
28662 <para>
28663 <indexterm role="option">
28664 <primary><option>queue_only_override</option></primary>
28665 </indexterm>
28666 </para>
28667 <informaltable frame="all">
28668 <tgroup cols="4" colsep="0" rowsep="0">
28669 <colspec colwidth="8*" align="left"/>
28670 <colspec colwidth="6*" align="center"/>
28671 <colspec colwidth="6*" align="center"/>
28672 <colspec colwidth="6*" align="right"/>
28673 <tbody>
28674 <row>
28675 <entry><option>queue_only_override</option></entry>
28676 <entry>Use: <emphasis>main</emphasis></entry>
28677 <entry>Type: <emphasis>boolean</emphasis></entry>
28678 <entry>Default: <emphasis>true</emphasis></entry>
28679 </row>
28680 </tbody>
28681 </tgroup>
28682 </informaltable>
28683 <para>
28684 <indexterm role="concept">
28685 <primary>queueing incoming messages</primary>
28686 </indexterm>
28687 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
28688 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
28689 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
28690 to override; they are accepted, but ignored.
28691 </para>
28692 <para>
28693 <indexterm role="option">
28694 <primary><option>queue_run_in_order</option></primary>
28695 </indexterm>
28696 </para>
28697 <informaltable frame="all">
28698 <tgroup cols="4" colsep="0" rowsep="0">
28699 <colspec colwidth="8*" align="left"/>
28700 <colspec colwidth="6*" align="center"/>
28701 <colspec colwidth="6*" align="center"/>
28702 <colspec colwidth="6*" align="right"/>
28703 <tbody>
28704 <row>
28705 <entry><option>queue_run_in_order</option></entry>
28706 <entry>Use: <emphasis>main</emphasis></entry>
28707 <entry>Type: <emphasis>boolean</emphasis></entry>
28708 <entry>Default: <emphasis>false</emphasis></entry>
28709 </row>
28710 </tbody>
28711 </tgroup>
28712 </informaltable>
28713 <para>
28714 <indexterm role="concept">
28715 <primary>queue runner</primary>
28716 <secondary>processing messages in order</secondary>
28717 </indexterm>
28718 If this option is set, queue runs happen in order of message arrival instead of
28719 in an arbitrary order. For this to happen, a complete list of the entire queue
28720 must be set up before the deliveries start. When the queue is all held in a
28721 single directory (the default), a single list is created for both the ordered
28722 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
28723 single list is not created when <option>queue_run_in_order</option> is false. In this case,
28724 the sub-directories are processed one at a time (in a random order), and this
28725 avoids setting up one huge list for the whole queue. Thus, setting
28726 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
28727 when the queue is large, because of the extra work in setting up the single,
28728 large list. In most situations, <option>queue_run_in_order</option> should not be set.
28729 </para>
28730 <para>
28731 <indexterm role="option">
28732 <primary><option>queue_run_max</option></primary>
28733 </indexterm>
28734 </para>
28735 <informaltable frame="all">
28736 <tgroup cols="4" colsep="0" rowsep="0">
28737 <colspec colwidth="8*" align="left"/>
28738 <colspec colwidth="6*" align="center"/>
28739 <colspec colwidth="6*" align="center"/>
28740 <colspec colwidth="6*" align="right"/>
28741 <tbody>
28742 <row>
28743 <entry><option>queue_run_max</option></entry>
28744 <entry>Use: <emphasis>main</emphasis></entry>
28745 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
28746 <entry>Default: <emphasis>5</emphasis></entry>
28747 </row>
28748 </tbody>
28749 </tgroup>
28750 </informaltable>
28751 <para>
28752 <indexterm role="concept">
28753 <primary>queue runner</primary>
28754 <secondary>maximum number of</secondary>
28755 </indexterm>
28756 This controls the maximum number of queue runner processes that an Exim daemon
28757 can run simultaneously. This does not mean that it starts them all at once,
28758 but rather that if the maximum number are still running when the time comes to
28759 start another one, it refrains from starting another one. This can happen with
28760 very large queues and/or very sluggish deliveries. This option does not,
28761 however, interlock with other processes, so additional queue runners can be
28762 started by other means, or by killing and restarting the daemon.
28763 </para>
28764 <para>
28765 Setting this option to zero does not suppress queue runs; rather, it disables
28766 the limit, allowing any number of simultaneous queue runner processes to be
28767 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
28768 the daemon&#x2019;s command line.
28769 </para>
28770 <para>
28771 <indexterm role="concept">
28772 <primary>queues</primary>
28773 <secondary>named</secondary>
28774 </indexterm>
28775 <indexterm role="concept">
28776 <primary>named queues</primary>
28777 </indexterm>
28778 To set limits for different named queues use
28779 an expansion depending on the <varname>$queue_name</varname> variable.
28780 </para>
28781 <para>
28782 <indexterm role="option">
28783 <primary><option>queue_smtp_domains</option></primary>
28784 </indexterm>
28785 </para>
28786 <informaltable frame="all">
28787 <tgroup cols="4" colsep="0" rowsep="0">
28788 <colspec colwidth="8*" align="left"/>
28789 <colspec colwidth="6*" align="center"/>
28790 <colspec colwidth="6*" align="center"/>
28791 <colspec colwidth="6*" align="right"/>
28792 <tbody>
28793 <row>
28794 <entry><option>queue_smtp_domains</option></entry>
28795 <entry>Use: <emphasis>main</emphasis></entry>
28796 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28797 <entry>Default: <emphasis>unset</emphasis></entry>
28798 </row>
28799 </tbody>
28800 </tgroup>
28801 </informaltable>
28802 <para>
28803 <indexterm role="concept">
28804 <primary>queueing incoming messages</primary>
28805 </indexterm>
28806 <indexterm role="concept">
28807 <primary>message</primary>
28808 <secondary>queueing remote deliveries</secondary>
28809 </indexterm>
28810 When this option is set, a delivery process is started whenever a message is
28811 received, routing is performed, and local deliveries take place.
28812 However, if any SMTP deliveries are required for domains that match
28813 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
28814 message waits on the queue for the next queue run. Since routing of the message
28815 has taken place, Exim knows to which remote hosts it must be delivered, and so
28816 when the queue run happens, multiple messages for the same host are delivered
28817 over a single SMTP connection. The <option>-odqs</option> command line option causes all
28818 SMTP deliveries to be queued in this way, and is equivalent to setting
28819 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
28820 <option>queue_domains</option>.
28821 </para>
28822 <para>
28823 <indexterm role="option">
28824 <primary><option>receive_timeout</option></primary>
28825 </indexterm>
28826 </para>
28827 <informaltable frame="all">
28828 <tgroup cols="4" colsep="0" rowsep="0">
28829 <colspec colwidth="8*" align="left"/>
28830 <colspec colwidth="6*" align="center"/>
28831 <colspec colwidth="6*" align="center"/>
28832 <colspec colwidth="6*" align="right"/>
28833 <tbody>
28834 <row>
28835 <entry><option>receive_timeout</option></entry>
28836 <entry>Use: <emphasis>main</emphasis></entry>
28837 <entry>Type: <emphasis>time</emphasis></entry>
28838 <entry>Default: <emphasis>0s</emphasis></entry>
28839 </row>
28840 </tbody>
28841 </tgroup>
28842 </informaltable>
28843 <para>
28844 <indexterm role="concept">
28845 <primary>timeout</primary>
28846 <secondary>for non-SMTP input</secondary>
28847 </indexterm>
28848 This option sets the timeout for accepting a non-SMTP message, that is, the
28849 maximum time that Exim waits when reading a message on the standard input. If
28850 the value is zero, it will wait for ever. This setting is overridden by the
28851 <option>-or</option> command line option. The timeout for incoming SMTP messages is
28852 controlled by <option>smtp_receive_timeout</option>.
28853 </para>
28854 <para>
28855 <indexterm role="option">
28856 <primary><option>received_header_text</option></primary>
28857 </indexterm>
28858 </para>
28859 <informaltable frame="all">
28860 <tgroup cols="4" colsep="0" rowsep="0">
28861 <colspec colwidth="8*" align="left"/>
28862 <colspec colwidth="6*" align="center"/>
28863 <colspec colwidth="6*" align="center"/>
28864 <colspec colwidth="6*" align="right"/>
28865 <tbody>
28866 <row>
28867 <entry><option>received_header_text</option></entry>
28868 <entry>Use: <emphasis>main</emphasis></entry>
28869 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28870 <entry>Default: <emphasis>see below</emphasis></entry>
28871 </row>
28872 </tbody>
28873 </tgroup>
28874 </informaltable>
28875 <para>
28876 <indexterm role="concept">
28877 <primary>customizing</primary>
28878 <secondary><emphasis>Received:</emphasis> header</secondary>
28879 </indexterm>
28880 <indexterm role="concept">
28881 <primary><emphasis>Received:</emphasis> header line</primary>
28882 <secondary>customizing</secondary>
28883 </indexterm>
28884 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
28885 added to each message, except for the timestamp, which is automatically added
28886 on at the end (preceded by a semicolon). The string is expanded each time it is
28887 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
28888 added to the message. Otherwise, the string should start with the text
28889 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
28890 header lines. The default setting is:
28891 </para>
28892 <literallayout class="monospaced">
28893 received_header_text = Received: \
28894   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
28895   {${if def:sender_ident \
28896   {from ${quote_local_part:$sender_ident} }}\
28897   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
28898   by $primary_hostname \
28899   ${if def:received_protocol {with $received_protocol}} \
28900   ${if def:tls_in_cipher {($tls_in_cipher)\n\t}}\
28901   (Exim $version_number)\n\t\
28902   ${if def:sender_address \
28903   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
28904   id $message_exim_id\
28905   ${if def:received_for {\n\tfor $received_for}}
28906 </literallayout>
28907 <para>
28908 The reference to the TLS cipher is omitted when Exim is built without TLS
28909 support. The use of conditional expansions ensures that this works for both
28910 locally generated messages and messages received from remote hosts, giving
28911 header lines such as the following:
28912 </para>
28913 <literallayout class="monospaced">
28914 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
28915 by marley.carol.example with esmtp (Exim 4.00)
28916 (envelope-from &lt;bob@carol.example&gt;)
28917 id 16IOWa-00019l-00
28918 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
28919 Received: by scrooge.carol.example with local (Exim 4.00)
28920 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
28921 </literallayout>
28922 <para>
28923 Until the body of the message has been received, the timestamp is the time when
28924 the message started to be received. Once the body has arrived, and all policy
28925 checks have taken place, the timestamp is updated to the time at which the
28926 message was accepted.
28927 </para>
28928 <para>
28929 <indexterm role="option">
28930 <primary><option>received_headers_max</option></primary>
28931 </indexterm>
28932 </para>
28933 <informaltable frame="all">
28934 <tgroup cols="4" colsep="0" rowsep="0">
28935 <colspec colwidth="8*" align="left"/>
28936 <colspec colwidth="6*" align="center"/>
28937 <colspec colwidth="6*" align="center"/>
28938 <colspec colwidth="6*" align="right"/>
28939 <tbody>
28940 <row>
28941 <entry><option>received_headers_max</option></entry>
28942 <entry>Use: <emphasis>main</emphasis></entry>
28943 <entry>Type: <emphasis>integer</emphasis></entry>
28944 <entry>Default: <emphasis>30</emphasis></entry>
28945 </row>
28946 </tbody>
28947 </tgroup>
28948 </informaltable>
28949 <para>
28950 <indexterm role="concept">
28951 <primary>loop</primary>
28952 <secondary>prevention</secondary>
28953 </indexterm>
28954 <indexterm role="concept">
28955 <primary>mail loop prevention</primary>
28956 </indexterm>
28957 <indexterm role="concept">
28958 <primary><emphasis>Received:</emphasis> header line</primary>
28959 <secondary>counting</secondary>
28960 </indexterm>
28961 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
28962 counted, and if it is greater than this parameter, a mail loop is assumed to
28963 have occurred, the delivery is abandoned, and an error message is generated.
28964 This applies to both local and remote deliveries.
28965 </para>
28966 <para>
28967 <indexterm role="option">
28968 <primary><option>recipient_unqualified_hosts</option></primary>
28969 </indexterm>
28970 </para>
28971 <informaltable frame="all">
28972 <tgroup cols="4" colsep="0" rowsep="0">
28973 <colspec colwidth="8*" align="left"/>
28974 <colspec colwidth="6*" align="center"/>
28975 <colspec colwidth="6*" align="center"/>
28976 <colspec colwidth="6*" align="right"/>
28977 <tbody>
28978 <row>
28979 <entry><option>recipient_unqualified_hosts</option></entry>
28980 <entry>Use: <emphasis>main</emphasis></entry>
28981 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28982 <entry>Default: <emphasis>unset</emphasis></entry>
28983 </row>
28984 </tbody>
28985 </tgroup>
28986 </informaltable>
28987 <para>
28988 <indexterm role="concept">
28989 <primary>unqualified addresses</primary>
28990 </indexterm>
28991 <indexterm role="concept">
28992 <primary>host</primary>
28993 <secondary>unqualified addresses from</secondary>
28994 </indexterm>
28995 This option lists those hosts from which Exim is prepared to accept unqualified
28996 recipient addresses in message envelopes. The addresses are made fully
28997 qualified by the addition of the <option>qualify_recipient</option> value. This option also
28998 affects message header lines. Exim does not reject unqualified recipient
28999 addresses in headers, but it qualifies them only if the message came from a
29000 host that matches <option>recipient_unqualified_hosts</option>,
29001 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
29002 option was not set.
29003 </para>
29004 <para>
29005 <indexterm role="option">
29006 <primary><option>recipients_max</option></primary>
29007 </indexterm>
29008 </para>
29009 <informaltable frame="all">
29010 <tgroup cols="4" colsep="0" rowsep="0">
29011 <colspec colwidth="8*" align="left"/>
29012 <colspec colwidth="6*" align="center"/>
29013 <colspec colwidth="6*" align="center"/>
29014 <colspec colwidth="6*" align="right"/>
29015 <tbody>
29016 <row>
29017 <entry><option>recipients_max</option></entry>
29018 <entry>Use: <emphasis>main</emphasis></entry>
29019 <entry>Type: <emphasis>integer</emphasis></entry>
29020 <entry>Default: <emphasis>0</emphasis></entry>
29021 </row>
29022 </tbody>
29023 </tgroup>
29024 </informaltable>
29025 <para>
29026 <indexterm role="concept">
29027 <primary>limit</primary>
29028 <secondary>number of recipients</secondary>
29029 </indexterm>
29030 <indexterm role="concept">
29031 <primary>recipient</primary>
29032 <secondary>maximum number</secondary>
29033 </indexterm>
29034 If this option is set greater than zero, it specifies the maximum number of
29035 original recipients for any message. Additional recipients that are generated
29036 by aliasing or forwarding do not count. SMTP messages get a 452 response for
29037 all recipients over the limit; earlier recipients are delivered as normal.
29038 Non-SMTP messages with too many recipients are failed, and no deliveries are
29039 done.
29040 </para>
29041 <para>
29042 <indexterm role="concept">
29043 <primary>RCPT</primary>
29044 <secondary>maximum number of incoming</secondary>
29045 </indexterm>
29046 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
29047 RCPT commands in a single message.
29048 </para>
29049 <para>
29050 <indexterm role="option">
29051 <primary><option>recipients_max_reject</option></primary>
29052 </indexterm>
29053 </para>
29054 <informaltable frame="all">
29055 <tgroup cols="4" colsep="0" rowsep="0">
29056 <colspec colwidth="8*" align="left"/>
29057 <colspec colwidth="6*" align="center"/>
29058 <colspec colwidth="6*" align="center"/>
29059 <colspec colwidth="6*" align="right"/>
29060 <tbody>
29061 <row>
29062 <entry><option>recipients_max_reject</option></entry>
29063 <entry>Use: <emphasis>main</emphasis></entry>
29064 <entry>Type: <emphasis>boolean</emphasis></entry>
29065 <entry>Default: <emphasis>false</emphasis></entry>
29066 </row>
29067 </tbody>
29068 </tgroup>
29069 </informaltable>
29070 <para>
29071 If this option is set true, Exim rejects SMTP messages containing too many
29072 recipients by giving 552 errors to the surplus RCPT commands, and a 554
29073 error to the eventual DATA command. Otherwise (the default) it gives a 452
29074 error to the surplus RCPT commands and accepts the message on behalf of the
29075 initial set of recipients. The remote server should then re-send the message
29076 for the remaining recipients at a later time.
29077 </para>
29078 <para>
29079 <indexterm role="option">
29080 <primary><option>remote_max_parallel</option></primary>
29081 </indexterm>
29082 </para>
29083 <informaltable frame="all">
29084 <tgroup cols="4" colsep="0" rowsep="0">
29085 <colspec colwidth="8*" align="left"/>
29086 <colspec colwidth="6*" align="center"/>
29087 <colspec colwidth="6*" align="center"/>
29088 <colspec colwidth="6*" align="right"/>
29089 <tbody>
29090 <row>
29091 <entry><option>remote_max_parallel</option></entry>
29092 <entry>Use: <emphasis>main</emphasis></entry>
29093 <entry>Type: <emphasis>integer</emphasis></entry>
29094 <entry>Default: <emphasis>2</emphasis></entry>
29095 </row>
29096 </tbody>
29097 </tgroup>
29098 </informaltable>
29099 <para>
29100 <indexterm role="concept">
29101 <primary>delivery</primary>
29102 <secondary>parallelism for remote</secondary>
29103 </indexterm>
29104 This option controls parallel delivery of one message to a number of remote
29105 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
29106 does all the remote deliveries for a message one by one. Otherwise, if a single
29107 message has to be delivered to more than one remote host, or if several copies
29108 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
29109 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
29110 deliveries are required, the maximum number of processes are started, and as
29111 each one finishes, another is begun. The order of starting processes is the
29112 same as if sequential delivery were being done, and can be controlled by the
29113 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
29114 with debugging turned on, the debugging output from each delivery process is
29115 tagged with its process id.
29116 </para>
29117 <para>
29118 This option controls only the maximum number of parallel deliveries for one
29119 message in one Exim delivery process. Because Exim has no central queue
29120 manager, there is no way of controlling the total number of simultaneous
29121 deliveries if the configuration allows a delivery attempt as soon as a message
29122 is received.
29123 </para>
29124 <para>
29125 <indexterm role="concept">
29126 <primary>number of deliveries</primary>
29127 </indexterm>
29128 <indexterm role="concept">
29129 <primary>delivery</primary>
29130 <secondary>maximum number of</secondary>
29131 </indexterm>
29132 If you want to control the total number of deliveries on the system, you
29133 need to set the <option>queue_only</option> option. This ensures that all incoming messages
29134 are added to the queue without starting a delivery process. Then set up an Exim
29135 daemon to start queue runner processes at appropriate intervals (probably
29136 fairly often, for example, every minute), and limit the total number of queue
29137 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
29138 delivers only one message at a time, the maximum number of deliveries that can
29139 then take place at once is <option>queue_run_max</option> multiplied by
29140 <option>remote_max_parallel</option>.
29141 </para>
29142 <para>
29143 If it is purely remote deliveries you want to control, use
29144 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
29145 doing the SMTP routing before queueing, so that several messages for the same
29146 host will eventually get delivered down the same connection.
29147 </para>
29148 <para>
29149 <indexterm role="option">
29150 <primary><option>remote_sort_domains</option></primary>
29151 </indexterm>
29152 </para>
29153 <informaltable frame="all">
29154 <tgroup cols="4" colsep="0" rowsep="0">
29155 <colspec colwidth="8*" align="left"/>
29156 <colspec colwidth="6*" align="center"/>
29157 <colspec colwidth="6*" align="center"/>
29158 <colspec colwidth="6*" align="right"/>
29159 <tbody>
29160 <row>
29161 <entry><option>remote_sort_domains</option></entry>
29162 <entry>Use: <emphasis>main</emphasis></entry>
29163 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29164 <entry>Default: <emphasis>unset</emphasis></entry>
29165 </row>
29166 </tbody>
29167 </tgroup>
29168 </informaltable>
29169 <para>
29170 <indexterm role="concept">
29171 <primary>sorting remote deliveries</primary>
29172 </indexterm>
29173 <indexterm role="concept">
29174 <primary>delivery</primary>
29175 <secondary>sorting remote</secondary>
29176 </indexterm>
29177 When there are a number of remote deliveries for a message, they are sorted by
29178 domain into the order given by this list. For example,
29179 </para>
29180 <literallayout class="monospaced">
29181 remote_sort_domains = *.cam.ac.uk:*.uk
29182 </literallayout>
29183 <para>
29184 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
29185 then to those in the <option>uk</option> domain, then to any others.
29186 </para>
29187 <para>
29188 <indexterm role="option">
29189 <primary><option>retry_data_expire</option></primary>
29190 </indexterm>
29191 </para>
29192 <informaltable frame="all">
29193 <tgroup cols="4" colsep="0" rowsep="0">
29194 <colspec colwidth="8*" align="left"/>
29195 <colspec colwidth="6*" align="center"/>
29196 <colspec colwidth="6*" align="center"/>
29197 <colspec colwidth="6*" align="right"/>
29198 <tbody>
29199 <row>
29200 <entry><option>retry_data_expire</option></entry>
29201 <entry>Use: <emphasis>main</emphasis></entry>
29202 <entry>Type: <emphasis>time</emphasis></entry>
29203 <entry>Default: <emphasis>7d</emphasis></entry>
29204 </row>
29205 </tbody>
29206 </tgroup>
29207 </informaltable>
29208 <para>
29209 <indexterm role="concept">
29210 <primary>hints database</primary>
29211 <secondary>data expiry</secondary>
29212 </indexterm>
29213 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
29214 database. Any older retry data is ignored. This means that, for example, once a
29215 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
29216 past failures.
29217 </para>
29218 <para>
29219 <indexterm role="option">
29220 <primary><option>retry_interval_max</option></primary>
29221 </indexterm>
29222 </para>
29223 <informaltable frame="all">
29224 <tgroup cols="4" colsep="0" rowsep="0">
29225 <colspec colwidth="8*" align="left"/>
29226 <colspec colwidth="6*" align="center"/>
29227 <colspec colwidth="6*" align="center"/>
29228 <colspec colwidth="6*" align="right"/>
29229 <tbody>
29230 <row>
29231 <entry><option>retry_interval_max</option></entry>
29232 <entry>Use: <emphasis>main</emphasis></entry>
29233 <entry>Type: <emphasis>time</emphasis></entry>
29234 <entry>Default: <emphasis>24h</emphasis></entry>
29235 </row>
29236 </tbody>
29237 </tgroup>
29238 </informaltable>
29239 <para>
29240 <indexterm role="concept">
29241 <primary>retry</primary>
29242 <secondary>limit on interval</secondary>
29243 </indexterm>
29244 <indexterm role="concept">
29245 <primary>limit</primary>
29246 <secondary>on retry interval</secondary>
29247 </indexterm>
29248 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
29249 intervals between delivery attempts for messages that cannot be delivered
29250 straight away. This option sets an overall limit to the length of time between
29251 retries. It cannot be set greater than 24 hours; any attempt to do so forces
29252 the default value.
29253 </para>
29254 <para>
29255 <indexterm role="option">
29256 <primary><option>return_path_remove</option></primary>
29257 </indexterm>
29258 </para>
29259 <informaltable frame="all">
29260 <tgroup cols="4" colsep="0" rowsep="0">
29261 <colspec colwidth="8*" align="left"/>
29262 <colspec colwidth="6*" align="center"/>
29263 <colspec colwidth="6*" align="center"/>
29264 <colspec colwidth="6*" align="right"/>
29265 <tbody>
29266 <row>
29267 <entry><option>return_path_remove</option></entry>
29268 <entry>Use: <emphasis>main</emphasis></entry>
29269 <entry>Type: <emphasis>boolean</emphasis></entry>
29270 <entry>Default: <emphasis>true</emphasis></entry>
29271 </row>
29272 </tbody>
29273 </tgroup>
29274 </informaltable>
29275 <para>
29276 <indexterm role="concept">
29277 <primary><emphasis>Return-path:</emphasis> header line</primary>
29278 <secondary>removing</secondary>
29279 </indexterm>
29280 RFC 2821, section 4.4, states that an SMTP server must insert a
29281 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
29282 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
29283 MAIL command. This description implies that this header should not be present
29284 in an incoming message. If <option>return_path_remove</option> is true, any existing
29285 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
29286 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
29287 the time of delivery. They are normally used only for final local deliveries.
29288 </para>
29289 <para>
29290 <indexterm role="option">
29291 <primary><option>return_size_limit</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>return_size_limit</option></entry>
29303 <entry>Use: <emphasis>main</emphasis></entry>
29304 <entry>Type: <emphasis>integer</emphasis></entry>
29305 <entry>Default: <emphasis>100K</emphasis></entry>
29306 </row>
29307 </tbody>
29308 </tgroup>
29309 </informaltable>
29310 <para>
29311 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
29312 </para>
29313 <para>
29314 <indexterm role="option">
29315 <primary><option>rfc1413_hosts</option></primary>
29316 </indexterm>
29317 </para>
29318 <informaltable frame="all">
29319 <tgroup cols="4" colsep="0" rowsep="0">
29320 <colspec colwidth="8*" align="left"/>
29321 <colspec colwidth="6*" align="center"/>
29322 <colspec colwidth="6*" align="center"/>
29323 <colspec colwidth="6*" align="right"/>
29324 <tbody>
29325 <row>
29326 <entry><option>rfc1413_hosts</option></entry>
29327 <entry>Use: <emphasis>main</emphasis></entry>
29328 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29329 <entry>Default: <emphasis>@[]</emphasis></entry>
29330 </row>
29331 </tbody>
29332 </tgroup>
29333 </informaltable>
29334 <para>
29335 <indexterm role="concept">
29336 <primary>RFC 1413</primary>
29337 </indexterm>
29338 <indexterm role="concept">
29339 <primary>host</primary>
29340 <secondary>for RFC 1413 calls</secondary>
29341 </indexterm>
29342 RFC 1413 identification calls are made to any client host which matches
29343 an item in the list.
29344 The default value specifies just this host, being any local interface
29345 for the system.
29346 </para>
29347 <para>
29348 <indexterm role="option">
29349 <primary><option>rfc1413_query_timeout</option></primary>
29350 </indexterm>
29351 </para>
29352 <informaltable frame="all">
29353 <tgroup cols="4" colsep="0" rowsep="0">
29354 <colspec colwidth="8*" align="left"/>
29355 <colspec colwidth="6*" align="center"/>
29356 <colspec colwidth="6*" align="center"/>
29357 <colspec colwidth="6*" align="right"/>
29358 <tbody>
29359 <row>
29360 <entry><option>rfc1413_query_timeout</option></entry>
29361 <entry>Use: <emphasis>main</emphasis></entry>
29362 <entry>Type: <emphasis>time</emphasis></entry>
29363 <entry>Default: <emphasis>0s</emphasis></entry>
29364 </row>
29365 </tbody>
29366 </tgroup>
29367 </informaltable>
29368 <para>
29369 <indexterm role="concept">
29370 <primary>RFC 1413</primary>
29371 <secondary>query timeout</secondary>
29372 </indexterm>
29373 <indexterm role="concept">
29374 <primary>timeout</primary>
29375 <secondary>for RFC 1413 call</secondary>
29376 </indexterm>
29377 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
29378 no RFC 1413 calls are ever made.
29379 </para>
29380 <para>
29381 <indexterm role="option">
29382 <primary><option>sender_unqualified_hosts</option></primary>
29383 </indexterm>
29384 </para>
29385 <informaltable frame="all">
29386 <tgroup cols="4" colsep="0" rowsep="0">
29387 <colspec colwidth="8*" align="left"/>
29388 <colspec colwidth="6*" align="center"/>
29389 <colspec colwidth="6*" align="center"/>
29390 <colspec colwidth="6*" align="right"/>
29391 <tbody>
29392 <row>
29393 <entry><option>sender_unqualified_hosts</option></entry>
29394 <entry>Use: <emphasis>main</emphasis></entry>
29395 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29396 <entry>Default: <emphasis>unset</emphasis></entry>
29397 </row>
29398 </tbody>
29399 </tgroup>
29400 </informaltable>
29401 <para>
29402 <indexterm role="concept">
29403 <primary>unqualified addresses</primary>
29404 </indexterm>
29405 <indexterm role="concept">
29406 <primary>host</primary>
29407 <secondary>unqualified addresses from</secondary>
29408 </indexterm>
29409 This option lists those hosts from which Exim is prepared to accept unqualified
29410 sender addresses. The addresses are made fully qualified by the addition of
29411 <option>qualify_domain</option>. This option also affects message header lines. Exim does
29412 not reject unqualified addresses in headers that contain sender addresses, but
29413 it qualifies them only if the message came from a host that matches
29414 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
29415 using TCP/IP), and the <option>-bnq</option> option was not set.
29416 </para>
29417 <para>
29418 <indexterm role="option">
29419 <primary><option>set_environment</option></primary>
29420 </indexterm>
29421 </para>
29422 <informaltable frame="all">
29423 <tgroup cols="4" colsep="0" rowsep="0">
29424 <colspec colwidth="8*" align="left"/>
29425 <colspec colwidth="6*" align="center"/>
29426 <colspec colwidth="6*" align="center"/>
29427 <colspec colwidth="6*" align="right"/>
29428 <tbody>
29429 <row>
29430 <entry><option>set_environment</option></entry>
29431 <entry>Use: <emphasis>main</emphasis></entry>
29432 <entry>Type: <emphasis>string list</emphasis></entry>
29433 <entry>Default: <emphasis>empty</emphasis></entry>
29434 </row>
29435 </tbody>
29436 </tgroup>
29437 </informaltable>
29438 <para>
29439 <indexterm role="concept">
29440 <primary>environment</primary>
29441 </indexterm>
29442 This option allows to set individual environment variables that the
29443 currently linked libraries and programs in child processes use. The
29444 default list is empty,
29445 </para>
29446 <para>
29447 <indexterm role="option">
29448 <primary><option>slow_lookup_log</option></primary>
29449 </indexterm>
29450 </para>
29451 <informaltable frame="all">
29452 <tgroup cols="4" colsep="0" rowsep="0">
29453 <colspec colwidth="8*" align="left"/>
29454 <colspec colwidth="6*" align="center"/>
29455 <colspec colwidth="6*" align="center"/>
29456 <colspec colwidth="6*" align="right"/>
29457 <tbody>
29458 <row>
29459 <entry><option>slow_lookup_log</option></entry>
29460 <entry>Use: <emphasis>main</emphasis></entry>
29461 <entry>Type: <emphasis>integer</emphasis></entry>
29462 <entry>Default: <emphasis>0</emphasis></entry>
29463 </row>
29464 </tbody>
29465 </tgroup>
29466 </informaltable>
29467 <para>
29468 <indexterm role="concept">
29469 <primary>logging</primary>
29470 <secondary>slow lookups</secondary>
29471 </indexterm>
29472 <indexterm role="concept">
29473 <primary>dns</primary>
29474 <secondary>logging slow lookups</secondary>
29475 </indexterm>
29476 This option controls logging of slow lookups.
29477 If the value is nonzero it is taken as a number of milliseconds
29478 and lookups taking longer than this are logged.
29479 Currently this applies only to DNS lookups.
29480 </para>
29481 <para>
29482 <indexterm role="option">
29483 <primary><option>smtp_accept_keepalive</option></primary>
29484 </indexterm>
29485 </para>
29486 <informaltable frame="all">
29487 <tgroup cols="4" colsep="0" rowsep="0">
29488 <colspec colwidth="8*" align="left"/>
29489 <colspec colwidth="6*" align="center"/>
29490 <colspec colwidth="6*" align="center"/>
29491 <colspec colwidth="6*" align="right"/>
29492 <tbody>
29493 <row>
29494 <entry><option>smtp_accept_keepalive</option></entry>
29495 <entry>Use: <emphasis>main</emphasis></entry>
29496 <entry>Type: <emphasis>boolean</emphasis></entry>
29497 <entry>Default: <emphasis>true</emphasis></entry>
29498 </row>
29499 </tbody>
29500 </tgroup>
29501 </informaltable>
29502 <para>
29503 <indexterm role="concept">
29504 <primary>keepalive</primary>
29505 <secondary>on incoming connection</secondary>
29506 </indexterm>
29507 This option controls the setting of the SO_KEEPALIVE option on incoming
29508 TCP/IP socket connections. When set, it causes the kernel to probe idle
29509 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
29510 other end of the connection should send an acknowledgment if the connection is
29511 still okay or a reset if the connection has been aborted. The reason for doing
29512 this is that it has the beneficial effect of freeing up certain types of
29513 connection that can get stuck when the remote host is disconnected without
29514 tidying up the TCP/IP call properly. The keepalive mechanism takes several
29515 hours to detect unreachable hosts.
29516 </para>
29517 <para>
29518 <indexterm role="option">
29519 <primary><option>smtp_accept_max</option></primary>
29520 </indexterm>
29521 </para>
29522 <informaltable frame="all">
29523 <tgroup cols="4" colsep="0" rowsep="0">
29524 <colspec colwidth="8*" align="left"/>
29525 <colspec colwidth="6*" align="center"/>
29526 <colspec colwidth="6*" align="center"/>
29527 <colspec colwidth="6*" align="right"/>
29528 <tbody>
29529 <row>
29530 <entry><option>smtp_accept_max</option></entry>
29531 <entry>Use: <emphasis>main</emphasis></entry>
29532 <entry>Type: <emphasis>integer</emphasis></entry>
29533 <entry>Default: <emphasis>20</emphasis></entry>
29534 </row>
29535 </tbody>
29536 </tgroup>
29537 </informaltable>
29538 <para>
29539 <indexterm role="concept">
29540 <primary>limit</primary>
29541 <secondary>incoming SMTP connections</secondary>
29542 </indexterm>
29543 <indexterm role="concept">
29544 <primary>SMTP</primary>
29545 <secondary>incoming connection count</secondary>
29546 </indexterm>
29547 <indexterm role="concept">
29548 <primary>inetd</primary>
29549 </indexterm>
29550 This option specifies the maximum number of simultaneous incoming SMTP calls
29551 that Exim will accept. It applies only to the listening daemon; there is no
29552 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
29553 value is set to zero, no limit is applied. However, it is required to be
29554 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
29555 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
29556 </para>
29557 <para>
29558 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
29559 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
29560 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
29561 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
29562 </para>
29563 <para>
29564 <indexterm role="option">
29565 <primary><option>smtp_accept_max_nonmail</option></primary>
29566 </indexterm>
29567 </para>
29568 <informaltable frame="all">
29569 <tgroup cols="4" colsep="0" rowsep="0">
29570 <colspec colwidth="8*" align="left"/>
29571 <colspec colwidth="6*" align="center"/>
29572 <colspec colwidth="6*" align="center"/>
29573 <colspec colwidth="6*" align="right"/>
29574 <tbody>
29575 <row>
29576 <entry><option>smtp_accept_max_nonmail</option></entry>
29577 <entry>Use: <emphasis>main</emphasis></entry>
29578 <entry>Type: <emphasis>integer</emphasis></entry>
29579 <entry>Default: <emphasis>10</emphasis></entry>
29580 </row>
29581 </tbody>
29582 </tgroup>
29583 </informaltable>
29584 <para>
29585 <indexterm role="concept">
29586 <primary>limit</primary>
29587 <secondary>non-mail SMTP commands</secondary>
29588 </indexterm>
29589 <indexterm role="concept">
29590 <primary>SMTP</primary>
29591 <secondary>limiting non-mail commands</secondary>
29592 </indexterm>
29593 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
29594 the connection if there are too many. This option defines <quote>too many</quote>. The
29595 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
29596 client looping sending EHLO, for example. The check is applied only if the
29597 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
29598 </para>
29599 <para>
29600 When a new message is expected, one occurrence of RSET is not counted. This
29601 allows a client to send one RSET between messages (this is not necessary,
29602 but some clients do it). Exim also allows one uncounted occurrence of HELO
29603 or EHLO, and one occurrence of STARTTLS between messages. After
29604 starting up a TLS session, another EHLO is expected, and so it too is not
29605 counted. The first occurrence of AUTH in a connection, or immediately
29606 following STARTTLS is not counted. Otherwise, all commands other than
29607 MAIL, RCPT, DATA, and QUIT are counted.
29608 </para>
29609 <para>
29610 <indexterm role="option">
29611 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
29612 </indexterm>
29613 </para>
29614 <informaltable frame="all">
29615 <tgroup cols="4" colsep="0" rowsep="0">
29616 <colspec colwidth="8*" align="left"/>
29617 <colspec colwidth="6*" align="center"/>
29618 <colspec colwidth="6*" align="center"/>
29619 <colspec colwidth="6*" align="right"/>
29620 <tbody>
29621 <row>
29622 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
29623 <entry>Use: <emphasis>main</emphasis></entry>
29624 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29625 <entry>Default: <emphasis>*</emphasis></entry>
29626 </row>
29627 </tbody>
29628 </tgroup>
29629 </informaltable>
29630 <para>
29631 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
29632 check by setting this option. The default value makes it apply to all hosts. By
29633 changing the value, you can exclude any badly-behaved hosts that you have to
29634 live with.
29635 </para>
29636 <para>
29637 <indexterm role="option">
29638 <primary><option>smtp_accept_max_per_connection</option></primary>
29639 </indexterm>
29640 </para>
29641 <informaltable frame="all">
29642 <tgroup cols="4" colsep="0" rowsep="0">
29643 <colspec colwidth="8*" align="left"/>
29644 <colspec colwidth="6*" align="center"/>
29645 <colspec colwidth="6*" align="center"/>
29646 <colspec colwidth="6*" align="right"/>
29647 <tbody>
29648 <row>
29649 <entry><option>smtp_accept_max_per_connection</option></entry>
29650 <entry>Use: <emphasis>main</emphasis></entry>
29651 <entry>Type: <emphasis>integer</emphasis></entry>
29652 <entry>Default: <emphasis>1000</emphasis></entry>
29653 </row>
29654 </tbody>
29655 </tgroup>
29656 </informaltable>
29657 <para>
29658 <indexterm role="concept">
29659 <primary>SMTP</primary>
29660 <secondary>limiting incoming message count</secondary>
29661 </indexterm>
29662 <indexterm role="concept">
29663 <primary>limit</primary>
29664 <secondary>messages per SMTP connection</secondary>
29665 </indexterm>
29666 The value of this option limits the number of MAIL commands that Exim is
29667 prepared to accept over a single SMTP connection, whether or not each command
29668 results in the transfer of a message. After the limit is reached, a 421
29669 response is given to subsequent MAIL commands. This limit is a safety
29670 precaution against a client that goes mad (incidents of this type have been
29671 seen).
29672 </para>
29673 <para>
29674 <indexterm role="option">
29675 <primary><option>smtp_accept_max_per_host</option></primary>
29676 </indexterm>
29677 </para>
29678 <informaltable frame="all">
29679 <tgroup cols="4" colsep="0" rowsep="0">
29680 <colspec colwidth="8*" align="left"/>
29681 <colspec colwidth="6*" align="center"/>
29682 <colspec colwidth="6*" align="center"/>
29683 <colspec colwidth="6*" align="right"/>
29684 <tbody>
29685 <row>
29686 <entry><option>smtp_accept_max_per_host</option></entry>
29687 <entry>Use: <emphasis>main</emphasis></entry>
29688 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29689 <entry>Default: <emphasis>unset</emphasis></entry>
29690 </row>
29691 </tbody>
29692 </tgroup>
29693 </informaltable>
29694 <para>
29695 <indexterm role="concept">
29696 <primary>limit</primary>
29697 <secondary>SMTP connections from one host</secondary>
29698 </indexterm>
29699 <indexterm role="concept">
29700 <primary>host</primary>
29701 <secondary>limiting SMTP connections from</secondary>
29702 </indexterm>
29703 This option restricts the number of simultaneous IP connections from a single
29704 host (strictly, from a single IP address) to the Exim daemon. The option is
29705 expanded, to enable different limits to be applied to different hosts by
29706 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
29707 connection attempts from the same host are rejected with error code 421. This
29708 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
29709 of zero imposes no limit. If this option is set greater than zero, it is
29710 required that <option>smtp_accept_max</option> be non-zero.
29711 </para>
29712 <para>
29713 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
29714 constructions that take an appreciable amount of time. The expansion and test
29715 happen in the main daemon loop, in order to reject additional connections
29716 without forking additional processes (otherwise a denial-of-service attack
29717 could cause a vast number or processes to be created). While the daemon is
29718 doing this processing, it cannot accept any other incoming connections.
29719 </para>
29720 <para>
29721 <indexterm role="option">
29722 <primary><option>smtp_accept_queue</option></primary>
29723 </indexterm>
29724 </para>
29725 <informaltable frame="all">
29726 <tgroup cols="4" colsep="0" rowsep="0">
29727 <colspec colwidth="8*" align="left"/>
29728 <colspec colwidth="6*" align="center"/>
29729 <colspec colwidth="6*" align="center"/>
29730 <colspec colwidth="6*" align="right"/>
29731 <tbody>
29732 <row>
29733 <entry><option>smtp_accept_queue</option></entry>
29734 <entry>Use: <emphasis>main</emphasis></entry>
29735 <entry>Type: <emphasis>integer</emphasis></entry>
29736 <entry>Default: <emphasis>0</emphasis></entry>
29737 </row>
29738 </tbody>
29739 </tgroup>
29740 </informaltable>
29741 <para>
29742 <indexterm role="concept">
29743 <primary>SMTP</primary>
29744 <secondary>incoming connection count</secondary>
29745 </indexterm>
29746 <indexterm role="concept">
29747 <primary>queueing incoming messages</primary>
29748 </indexterm>
29749 <indexterm role="concept">
29750 <primary>message</primary>
29751 <secondary>queueing by SMTP connection count</secondary>
29752 </indexterm>
29753 If the number of simultaneous incoming SMTP connections being handled via the
29754 listening daemon exceeds this value, messages received by SMTP are just placed
29755 on the queue; no delivery processes are started automatically. The count is
29756 fixed at the start of an SMTP connection. It cannot be updated in the
29757 subprocess that receives messages, and so the queueing or not queueing applies
29758 to all messages received in the same connection.
29759 </para>
29760 <para>
29761 A value of zero implies no limit, and clearly any non-zero value is useful only
29762 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
29763 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
29764 various <option>-od</option><emphasis>x</emphasis> command line options.
29765 </para>
29766 <para>
29767 <indexterm role="option">
29768 <primary><option>smtp_accept_queue_per_connection</option></primary>
29769 </indexterm>
29770 </para>
29771 <informaltable frame="all">
29772 <tgroup cols="4" colsep="0" rowsep="0">
29773 <colspec colwidth="8*" align="left"/>
29774 <colspec colwidth="6*" align="center"/>
29775 <colspec colwidth="6*" align="center"/>
29776 <colspec colwidth="6*" align="right"/>
29777 <tbody>
29778 <row>
29779 <entry><option>smtp_accept_queue_per_connection</option></entry>
29780 <entry>Use: <emphasis>main</emphasis></entry>
29781 <entry>Type: <emphasis>integer</emphasis></entry>
29782 <entry>Default: <emphasis>10</emphasis></entry>
29783 </row>
29784 </tbody>
29785 </tgroup>
29786 </informaltable>
29787 <para>
29788 <indexterm role="concept">
29789 <primary>queueing incoming messages</primary>
29790 </indexterm>
29791 <indexterm role="concept">
29792 <primary>message</primary>
29793 <secondary>queueing by message count</secondary>
29794 </indexterm>
29795 This option limits the number of delivery processes that Exim starts
29796 automatically when receiving messages via SMTP, whether via the daemon or by
29797 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
29798 and the number of messages received in a single SMTP session exceeds this
29799 number, subsequent messages are placed on the queue, but no delivery processes
29800 are started. This helps to limit the number of Exim processes when a server
29801 restarts after downtime and there is a lot of mail waiting for it on other
29802 systems. On large systems, the default should probably be increased, and on
29803 dial-in client systems it should probably be set to zero (that is, disabled).
29804 </para>
29805 <para>
29806 <indexterm role="option">
29807 <primary><option>smtp_accept_reserve</option></primary>
29808 </indexterm>
29809 </para>
29810 <informaltable frame="all">
29811 <tgroup cols="4" colsep="0" rowsep="0">
29812 <colspec colwidth="8*" align="left"/>
29813 <colspec colwidth="6*" align="center"/>
29814 <colspec colwidth="6*" align="center"/>
29815 <colspec colwidth="6*" align="right"/>
29816 <tbody>
29817 <row>
29818 <entry><option>smtp_accept_reserve</option></entry>
29819 <entry>Use: <emphasis>main</emphasis></entry>
29820 <entry>Type: <emphasis>integer</emphasis></entry>
29821 <entry>Default: <emphasis>0</emphasis></entry>
29822 </row>
29823 </tbody>
29824 </tgroup>
29825 </informaltable>
29826 <para>
29827 <indexterm role="concept">
29828 <primary>SMTP</primary>
29829 <secondary>incoming call count</secondary>
29830 </indexterm>
29831 <indexterm role="concept">
29832 <primary>host</primary>
29833 <secondary>reserved</secondary>
29834 </indexterm>
29835 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
29836 number of SMTP connections that are reserved for connections from the hosts
29837 that are specified in <option>smtp_reserve_hosts</option>. The value set in
29838 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
29839 restricted to this number of connections; the option specifies a minimum number
29840 of connection slots for them, not a maximum. It is a guarantee that this group
29841 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
29842 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
29843 individual host.
29844 </para>
29845 <para>
29846 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
29847 set to 5, once there are 45 active connections (from any hosts), new
29848 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
29849 provided the other criteria for acceptance are met.
29850 </para>
29851 <para>
29852 <indexterm role="option">
29853 <primary><option>smtp_active_hostname</option></primary>
29854 </indexterm>
29855 </para>
29856 <informaltable frame="all">
29857 <tgroup cols="4" colsep="0" rowsep="0">
29858 <colspec colwidth="8*" align="left"/>
29859 <colspec colwidth="6*" align="center"/>
29860 <colspec colwidth="6*" align="center"/>
29861 <colspec colwidth="6*" align="right"/>
29862 <tbody>
29863 <row>
29864 <entry><option>smtp_active_hostname</option></entry>
29865 <entry>Use: <emphasis>main</emphasis></entry>
29866 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29867 <entry>Default: <emphasis>unset</emphasis></entry>
29868 </row>
29869 </tbody>
29870 </tgroup>
29871 </informaltable>
29872 <para>
29873 <indexterm role="concept">
29874 <primary>host</primary>
29875 <secondary>name in SMTP responses</secondary>
29876 </indexterm>
29877 <indexterm role="concept">
29878 <primary>SMTP</primary>
29879 <secondary>host name in responses</secondary>
29880 </indexterm>
29881 <indexterm role="variable">
29882 <primary><varname>$primary_hostname</varname></primary>
29883 </indexterm>
29884 This option is provided for multi-homed servers that want to masquerade as
29885 several different hosts. At the start of an incoming SMTP connection, its value
29886 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
29887 responses. For example, it is used as domain name in the response to an
29888 incoming HELO or EHLO command.
29889 </para>
29890 <para>
29891 <indexterm role="variable">
29892 <primary><varname>$smtp_active_hostname</varname></primary>
29893 </indexterm>
29894 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
29895 is saved with any messages that are received. It is therefore available for use
29896 in routers and transports when the message is later delivered.
29897 </para>
29898 <para>
29899 If this option is unset, or if its expansion is forced to fail, or if the
29900 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
29901 used. Other expansion failures cause a message to be written to the main and
29902 panic logs, and the SMTP command receives a temporary error. Typically, the
29903 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
29904 For example:
29905 </para>
29906 <literallayout class="monospaced">
29907 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
29908   {cox.mydomain}{box.mydomain}}
29909 </literallayout>
29910 <para>
29911 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
29912 messages, it is also used as the default for HELO commands in callout
29913 verification if there is no remote transport from which to obtain a
29914 <option>helo_data</option> value.
29915 </para>
29916 <para>
29917 <indexterm role="option">
29918 <primary><option>smtp_banner</option></primary>
29919 </indexterm>
29920 </para>
29921 <informaltable frame="all">
29922 <tgroup cols="4" colsep="0" rowsep="0">
29923 <colspec colwidth="8*" align="left"/>
29924 <colspec colwidth="6*" align="center"/>
29925 <colspec colwidth="6*" align="center"/>
29926 <colspec colwidth="6*" align="right"/>
29927 <tbody>
29928 <row>
29929 <entry><option>smtp_banner</option></entry>
29930 <entry>Use: <emphasis>main</emphasis></entry>
29931 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29932 <entry>Default: <emphasis>see below</emphasis></entry>
29933 </row>
29934 </tbody>
29935 </tgroup>
29936 </informaltable>
29937 <para>
29938 <indexterm role="concept">
29939 <primary>SMTP</primary>
29940 <secondary>welcome banner</secondary>
29941 </indexterm>
29942 <indexterm role="concept">
29943 <primary>banner for SMTP</primary>
29944 </indexterm>
29945 <indexterm role="concept">
29946 <primary>welcome banner for SMTP</primary>
29947 </indexterm>
29948 <indexterm role="concept">
29949 <primary>customizing</primary>
29950 <secondary>SMTP banner</secondary>
29951 </indexterm>
29952 This string, which is expanded every time it is used, is output as the initial
29953 positive response to an SMTP connection. The default setting is:
29954 </para>
29955 <literallayout class="monospaced">
29956 smtp_banner = $smtp_active_hostname ESMTP Exim \
29957   $version_number $tod_full
29958 </literallayout>
29959 <para>
29960 Failure to expand the string causes a panic error. If you want to create a
29961 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
29962 appropriate points, but not at the end. Note that the 220 code is not included
29963 in this string. Exim adds it automatically (several times in the case of a
29964 multiline response).
29965 </para>
29966 <para>
29967 <indexterm role="option">
29968 <primary><option>smtp_check_spool_space</option></primary>
29969 </indexterm>
29970 </para>
29971 <informaltable frame="all">
29972 <tgroup cols="4" colsep="0" rowsep="0">
29973 <colspec colwidth="8*" align="left"/>
29974 <colspec colwidth="6*" align="center"/>
29975 <colspec colwidth="6*" align="center"/>
29976 <colspec colwidth="6*" align="right"/>
29977 <tbody>
29978 <row>
29979 <entry><option>smtp_check_spool_space</option></entry>
29980 <entry>Use: <emphasis>main</emphasis></entry>
29981 <entry>Type: <emphasis>boolean</emphasis></entry>
29982 <entry>Default: <emphasis>true</emphasis></entry>
29983 </row>
29984 </tbody>
29985 </tgroup>
29986 </informaltable>
29987 <para>
29988 <indexterm role="concept">
29989 <primary>checking disk space</primary>
29990 </indexterm>
29991 <indexterm role="concept">
29992 <primary>disk space, checking</primary>
29993 </indexterm>
29994 <indexterm role="concept">
29995 <primary>spool directory</primary>
29996 <secondary>checking space</secondary>
29997 </indexterm>
29998 When this option is set, if an incoming SMTP session encounters the SIZE
29999 option on a MAIL command, it checks that there is enough space in the
30000 spool directory&#x2019;s partition to accept a message of that size, while still
30001 leaving free the amount specified by <option>check_spool_space</option> (even if that value
30002 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
30003 </para>
30004 <para>
30005 <indexterm role="option">
30006 <primary><option>smtp_connect_backlog</option></primary>
30007 </indexterm>
30008 </para>
30009 <informaltable frame="all">
30010 <tgroup cols="4" colsep="0" rowsep="0">
30011 <colspec colwidth="8*" align="left"/>
30012 <colspec colwidth="6*" align="center"/>
30013 <colspec colwidth="6*" align="center"/>
30014 <colspec colwidth="6*" align="right"/>
30015 <tbody>
30016 <row>
30017 <entry><option>smtp_connect_backlog</option></entry>
30018 <entry>Use: <emphasis>main</emphasis></entry>
30019 <entry>Type: <emphasis>integer</emphasis></entry>
30020 <entry>Default: <emphasis>20</emphasis></entry>
30021 </row>
30022 </tbody>
30023 </tgroup>
30024 </informaltable>
30025 <para>
30026 <indexterm role="concept">
30027 <primary>connection backlog</primary>
30028 </indexterm>
30029 <indexterm role="concept">
30030 <primary>SMTP</primary>
30031 <secondary>connection backlog</secondary>
30032 </indexterm>
30033 <indexterm role="concept">
30034 <primary>backlog of connections</primary>
30035 </indexterm>
30036 This option specifies a maximum number of waiting SMTP connections. Exim passes
30037 this value to the TCP/IP system when it sets up its listener. Once this number
30038 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
30039 attempts are refused at the TCP/IP level. At least, that is what the manuals
30040 say; in some circumstances such connection attempts have been observed to time
30041 out instead. For large systems it is probably a good idea to increase the
30042 value (to 50, say). It also gives some protection against denial-of-service
30043 attacks by SYN flooding.
30044 </para>
30045 <para>
30046 <indexterm role="option">
30047 <primary><option>smtp_enforce_sync</option></primary>
30048 </indexterm>
30049 </para>
30050 <informaltable frame="all">
30051 <tgroup cols="4" colsep="0" rowsep="0">
30052 <colspec colwidth="8*" align="left"/>
30053 <colspec colwidth="6*" align="center"/>
30054 <colspec colwidth="6*" align="center"/>
30055 <colspec colwidth="6*" align="right"/>
30056 <tbody>
30057 <row>
30058 <entry><option>smtp_enforce_sync</option></entry>
30059 <entry>Use: <emphasis>main</emphasis></entry>
30060 <entry>Type: <emphasis>boolean</emphasis></entry>
30061 <entry>Default: <emphasis>true</emphasis></entry>
30062 </row>
30063 </tbody>
30064 </tgroup>
30065 </informaltable>
30066 <para>
30067 <indexterm role="concept">
30068 <primary>SMTP</primary>
30069 <secondary>synchronization checking</secondary>
30070 </indexterm>
30071 <indexterm role="concept">
30072 <primary>synchronization checking in SMTP</primary>
30073 </indexterm>
30074 The SMTP protocol specification requires the client to wait for a response from
30075 the server at certain points in the dialogue. Without PIPELINING these
30076 synchronization points are after every command; with PIPELINING they are
30077 fewer, but they still exist.
30078 </para>
30079 <para>
30080 Some spamming sites send out a complete set of SMTP commands without waiting
30081 for any response. Exim protects against this by rejecting a message if the
30082 client has sent further input when it should not have. The error response <quote>554
30083 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
30084 for this error cannot be perfect because of transmission delays (unexpected
30085 input may be on its way but not yet received when Exim checks). However, it
30086 does detect many instances.
30087 </para>
30088 <para>
30089 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
30090 If you want to disable the check selectively (for example, only for certain
30091 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
30092 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
30093 </para>
30094 <para>
30095 <indexterm role="option">
30096 <primary><option>smtp_etrn_command</option></primary>
30097 </indexterm>
30098 </para>
30099 <informaltable frame="all">
30100 <tgroup cols="4" colsep="0" rowsep="0">
30101 <colspec colwidth="8*" align="left"/>
30102 <colspec colwidth="6*" align="center"/>
30103 <colspec colwidth="6*" align="center"/>
30104 <colspec colwidth="6*" align="right"/>
30105 <tbody>
30106 <row>
30107 <entry><option>smtp_etrn_command</option></entry>
30108 <entry>Use: <emphasis>main</emphasis></entry>
30109 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30110 <entry>Default: <emphasis>unset</emphasis></entry>
30111 </row>
30112 </tbody>
30113 </tgroup>
30114 </informaltable>
30115 <para>
30116 <indexterm role="concept">
30117 <primary>ETRN</primary>
30118 <secondary>command to be run</secondary>
30119 </indexterm>
30120 <indexterm role="variable">
30121 <primary><varname>$domain</varname></primary>
30122 </indexterm>
30123 If this option is set, the given command is run whenever an SMTP ETRN
30124 command is received from a host that is permitted to issue such commands (see
30125 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
30126 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
30127 argument of the ETRN command, and no syntax checking is done on it. For
30128 example:
30129 </para>
30130 <literallayout class="monospaced">
30131 smtp_etrn_command = /etc/etrn_command $domain \
30132                     $sender_host_address
30133 </literallayout>
30134 <para>
30135 A new process is created to run the command, but Exim does not wait for it to
30136 complete. Consequently, its status cannot be checked. If the command cannot be
30137 run, a line is written to the panic log, but the ETRN caller still receives
30138 a 250 success response. Exim is normally running under its own uid when
30139 receiving SMTP, so it is not possible for it to change the uid before running
30140 the command.
30141 </para>
30142 <para>
30143 <indexterm role="option">
30144 <primary><option>smtp_etrn_serialize</option></primary>
30145 </indexterm>
30146 </para>
30147 <informaltable frame="all">
30148 <tgroup cols="4" colsep="0" rowsep="0">
30149 <colspec colwidth="8*" align="left"/>
30150 <colspec colwidth="6*" align="center"/>
30151 <colspec colwidth="6*" align="center"/>
30152 <colspec colwidth="6*" align="right"/>
30153 <tbody>
30154 <row>
30155 <entry><option>smtp_etrn_serialize</option></entry>
30156 <entry>Use: <emphasis>main</emphasis></entry>
30157 <entry>Type: <emphasis>boolean</emphasis></entry>
30158 <entry>Default: <emphasis>true</emphasis></entry>
30159 </row>
30160 </tbody>
30161 </tgroup>
30162 </informaltable>
30163 <para>
30164 <indexterm role="concept">
30165 <primary>ETRN</primary>
30166 <secondary>serializing</secondary>
30167 </indexterm>
30168 When this option is set, it prevents the simultaneous execution of more than
30169 one identical command as a result of ETRN in an SMTP connection. See
30170 section <xref linkend="SECTETRN"/> for details.
30171 </para>
30172 <para>
30173 <indexterm role="option">
30174 <primary><option>smtp_load_reserve</option></primary>
30175 </indexterm>
30176 </para>
30177 <informaltable frame="all">
30178 <tgroup cols="4" colsep="0" rowsep="0">
30179 <colspec colwidth="8*" align="left"/>
30180 <colspec colwidth="6*" align="center"/>
30181 <colspec colwidth="6*" align="center"/>
30182 <colspec colwidth="6*" align="right"/>
30183 <tbody>
30184 <row>
30185 <entry><option>smtp_load_reserve</option></entry>
30186 <entry>Use: <emphasis>main</emphasis></entry>
30187 <entry>Type: <emphasis>fixed-point</emphasis></entry>
30188 <entry>Default: <emphasis>unset</emphasis></entry>
30189 </row>
30190 </tbody>
30191 </tgroup>
30192 </informaltable>
30193 <para>
30194 <indexterm role="concept">
30195 <primary>load average</primary>
30196 </indexterm>
30197 If the system load average ever gets higher than this, incoming SMTP calls are
30198 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
30199 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
30200 the load is over the limit. The option has no effect on ancient operating
30201 systems on which Exim cannot determine the load average. See also
30202 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
30203 </para>
30204 <para>
30205 <indexterm role="option">
30206 <primary><option>smtp_max_synprot_errors</option></primary>
30207 </indexterm>
30208 </para>
30209 <informaltable frame="all">
30210 <tgroup cols="4" colsep="0" rowsep="0">
30211 <colspec colwidth="8*" align="left"/>
30212 <colspec colwidth="6*" align="center"/>
30213 <colspec colwidth="6*" align="center"/>
30214 <colspec colwidth="6*" align="right"/>
30215 <tbody>
30216 <row>
30217 <entry><option>smtp_max_synprot_errors</option></entry>
30218 <entry>Use: <emphasis>main</emphasis></entry>
30219 <entry>Type: <emphasis>integer</emphasis></entry>
30220 <entry>Default: <emphasis>3</emphasis></entry>
30221 </row>
30222 </tbody>
30223 </tgroup>
30224 </informaltable>
30225 <para>
30226 <indexterm role="concept">
30227 <primary>SMTP</primary>
30228 <secondary>limiting syntax and protocol errors</secondary>
30229 </indexterm>
30230 <indexterm role="concept">
30231 <primary>limit</primary>
30232 <secondary>SMTP syntax and protocol errors</secondary>
30233 </indexterm>
30234 Exim rejects SMTP commands that contain syntax or protocol errors. In
30235 particular, a syntactically invalid email address, as in this command:
30236 </para>
30237 <literallayout class="monospaced">
30238 RCPT TO:&lt;abc xyz@a.b.c&gt;
30239 </literallayout>
30240 <para>
30241 causes immediate rejection of the command, before any other tests are done.
30242 (The ACL cannot be run if there is no valid address to set up for it.) An
30243 example of a protocol error is receiving RCPT before MAIL. If there are
30244 too many syntax or protocol errors in one SMTP session, the connection is
30245 dropped. The limit is set by this option.
30246 </para>
30247 <para>
30248 <indexterm role="concept">
30249 <primary>PIPELINING</primary>
30250 <secondary>expected errors</secondary>
30251 </indexterm>
30252 When the PIPELINING extension to SMTP is in use, some protocol errors are
30253 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
30254 Exim assumes that PIPELINING will be used if it advertises it (see
30255 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
30256 not count towards the limit.
30257 </para>
30258 <para>
30259 <indexterm role="option">
30260 <primary><option>smtp_max_unknown_commands</option></primary>
30261 </indexterm>
30262 </para>
30263 <informaltable frame="all">
30264 <tgroup cols="4" colsep="0" rowsep="0">
30265 <colspec colwidth="8*" align="left"/>
30266 <colspec colwidth="6*" align="center"/>
30267 <colspec colwidth="6*" align="center"/>
30268 <colspec colwidth="6*" align="right"/>
30269 <tbody>
30270 <row>
30271 <entry><option>smtp_max_unknown_commands</option></entry>
30272 <entry>Use: <emphasis>main</emphasis></entry>
30273 <entry>Type: <emphasis>integer</emphasis></entry>
30274 <entry>Default: <emphasis>3</emphasis></entry>
30275 </row>
30276 </tbody>
30277 </tgroup>
30278 </informaltable>
30279 <para>
30280 <indexterm role="concept">
30281 <primary>SMTP</primary>
30282 <secondary>limiting unknown commands</secondary>
30283 </indexterm>
30284 <indexterm role="concept">
30285 <primary>limit</primary>
30286 <secondary>unknown SMTP commands</secondary>
30287 </indexterm>
30288 If there are too many unrecognized commands in an incoming SMTP session, an
30289 Exim server drops the connection. This is a defence against some kinds of abuse
30290 that subvert web
30291 clients
30292 into making connections to SMTP ports; in these circumstances, a number of
30293 non-SMTP command lines are sent first.
30294 </para>
30295 <para>
30296 <indexterm role="option">
30297 <primary><option>smtp_ratelimit_hosts</option></primary>
30298 </indexterm>
30299 </para>
30300 <informaltable frame="all">
30301 <tgroup cols="4" colsep="0" rowsep="0">
30302 <colspec colwidth="8*" align="left"/>
30303 <colspec colwidth="6*" align="center"/>
30304 <colspec colwidth="6*" align="center"/>
30305 <colspec colwidth="6*" align="right"/>
30306 <tbody>
30307 <row>
30308 <entry><option>smtp_ratelimit_hosts</option></entry>
30309 <entry>Use: <emphasis>main</emphasis></entry>
30310 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30311 <entry>Default: <emphasis>unset</emphasis></entry>
30312 </row>
30313 </tbody>
30314 </tgroup>
30315 </informaltable>
30316 <para>
30317 <indexterm role="concept">
30318 <primary>SMTP</primary>
30319 <secondary>rate limiting</secondary>
30320 </indexterm>
30321 <indexterm role="concept">
30322 <primary>limit</primary>
30323 <secondary>rate of message arrival</secondary>
30324 </indexterm>
30325 <indexterm role="concept">
30326 <primary>RCPT</primary>
30327 <secondary>rate limiting</secondary>
30328 </indexterm>
30329 Some sites find it helpful to be able to limit the rate at which certain hosts
30330 can send them messages, and the rate at which an individual message can specify
30331 recipients.
30332 </para>
30333 <para>
30334 Exim has two rate-limiting facilities. This section describes the older
30335 facility, which can limit rates within a single connection. The newer
30336 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
30337 <xref linkend="SECTratelimiting"/> for details of the newer facility.
30338 </para>
30339 <para>
30340 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
30341 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
30342 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
30343 respectively. Each option, if set, must contain a set of four comma-separated
30344 values:
30345 </para>
30346 <itemizedlist>
30347 <listitem>
30348 <para>
30349 A threshold, before which there is no rate limiting.
30350 </para>
30351 </listitem>
30352 <listitem>
30353 <para>
30354 An initial time delay. Unlike other times in Exim, numbers with decimal
30355 fractional parts are allowed here.
30356 </para>
30357 </listitem>
30358 <listitem>
30359 <para>
30360 A factor by which to increase the delay each time.
30361 </para>
30362 </listitem>
30363 <listitem>
30364 <para>
30365 A maximum value for the delay. This should normally be less than 5 minutes,
30366 because after that time, the client is liable to timeout the SMTP command.
30367 </para>
30368 </listitem>
30369 </itemizedlist>
30370 <para>
30371 For example, these settings have been used successfully at the site which
30372 first suggested this feature, for controlling mail from their customers:
30373 </para>
30374 <literallayout class="monospaced">
30375 smtp_ratelimit_mail = 2,0.5s,1.05,4m
30376 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
30377 </literallayout>
30378 <para>
30379 The first setting specifies delays that are applied to MAIL commands after
30380 two have been received over a single connection. The initial delay is 0.5
30381 seconds, increasing by a factor of 1.05 each time. The second setting applies
30382 delays to RCPT commands when more than four occur in a single message.
30383 </para>
30384 <para>
30385 <indexterm role="option">
30386 <primary><option>smtp_ratelimit_mail</option></primary>
30387 </indexterm>
30388 </para>
30389 <informaltable frame="all">
30390 <tgroup cols="4" colsep="0" rowsep="0">
30391 <colspec colwidth="8*" align="left"/>
30392 <colspec colwidth="6*" align="center"/>
30393 <colspec colwidth="6*" align="center"/>
30394 <colspec colwidth="6*" align="right"/>
30395 <tbody>
30396 <row>
30397 <entry><option>smtp_ratelimit_mail</option></entry>
30398 <entry>Use: <emphasis>main</emphasis></entry>
30399 <entry>Type: <emphasis>string</emphasis></entry>
30400 <entry>Default: <emphasis>unset</emphasis></entry>
30401 </row>
30402 </tbody>
30403 </tgroup>
30404 </informaltable>
30405 <para>
30406 See <option>smtp_ratelimit_hosts</option> above.
30407 </para>
30408 <para>
30409 <indexterm role="option">
30410 <primary><option>smtp_ratelimit_rcpt</option></primary>
30411 </indexterm>
30412 </para>
30413 <informaltable frame="all">
30414 <tgroup cols="4" colsep="0" rowsep="0">
30415 <colspec colwidth="8*" align="left"/>
30416 <colspec colwidth="6*" align="center"/>
30417 <colspec colwidth="6*" align="center"/>
30418 <colspec colwidth="6*" align="right"/>
30419 <tbody>
30420 <row>
30421 <entry><option>smtp_ratelimit_rcpt</option></entry>
30422 <entry>Use: <emphasis>main</emphasis></entry>
30423 <entry>Type: <emphasis>string</emphasis></entry>
30424 <entry>Default: <emphasis>unset</emphasis></entry>
30425 </row>
30426 </tbody>
30427 </tgroup>
30428 </informaltable>
30429 <para>
30430 See <option>smtp_ratelimit_hosts</option> above.
30431 </para>
30432 <para>
30433 <indexterm role="option">
30434 <primary><option>smtp_receive_timeout</option></primary>
30435 </indexterm>
30436 </para>
30437 <informaltable frame="all">
30438 <tgroup cols="4" colsep="0" rowsep="0">
30439 <colspec colwidth="8*" align="left"/>
30440 <colspec colwidth="6*" align="center"/>
30441 <colspec colwidth="6*" align="center"/>
30442 <colspec colwidth="6*" align="right"/>
30443 <tbody>
30444 <row>
30445 <entry><option>smtp_receive_timeout</option></entry>
30446 <entry>Use: <emphasis>main</emphasis></entry>
30447 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
30448 <entry>Default: <emphasis>5m</emphasis></entry>
30449 </row>
30450 </tbody>
30451 </tgroup>
30452 </informaltable>
30453 <para>
30454 <indexterm role="concept">
30455 <primary>timeout</primary>
30456 <secondary>for SMTP input</secondary>
30457 </indexterm>
30458 <indexterm role="concept">
30459 <primary>SMTP</primary>
30460 <secondary>input timeout</secondary>
30461 </indexterm>
30462 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
30463 input, including batch SMTP. If a line of input (either an SMTP command or a
30464 data line) is not received within this time, the SMTP connection is dropped and
30465 the message is abandoned.
30466 A line is written to the log containing one of the following messages:
30467 </para>
30468 <literallayout class="monospaced">
30469 SMTP command timeout on connection from...
30470 SMTP data timeout on connection from...
30471 </literallayout>
30472 <para>
30473 The former means that Exim was expecting to read an SMTP command; the latter
30474 means that it was in the DATA phase, reading the contents of a message.
30475 </para>
30476 <para>
30477 If the first character of the option is a <quote>$</quote> the option is
30478 expanded before use and may depend on
30479 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
30480 </para>
30481 <para>
30482 <indexterm role="option">
30483 <primary><option>-os</option></primary>
30484 </indexterm>
30485 The value set by this option can be overridden by the
30486 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
30487 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
30488 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
30489 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
30490 </para>
30491 <para>
30492 <indexterm role="option">
30493 <primary><option>smtp_reserve_hosts</option></primary>
30494 </indexterm>
30495 </para>
30496 <informaltable frame="all">
30497 <tgroup cols="4" colsep="0" rowsep="0">
30498 <colspec colwidth="8*" align="left"/>
30499 <colspec colwidth="6*" align="center"/>
30500 <colspec colwidth="6*" align="center"/>
30501 <colspec colwidth="6*" align="right"/>
30502 <tbody>
30503 <row>
30504 <entry><option>smtp_reserve_hosts</option></entry>
30505 <entry>Use: <emphasis>main</emphasis></entry>
30506 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30507 <entry>Default: <emphasis>unset</emphasis></entry>
30508 </row>
30509 </tbody>
30510 </tgroup>
30511 </informaltable>
30512 <para>
30513 This option defines hosts for which SMTP connections are reserved; see
30514 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
30515 </para>
30516 <para>
30517 <indexterm role="option">
30518 <primary><option>smtp_return_error_details</option></primary>
30519 </indexterm>
30520 </para>
30521 <informaltable frame="all">
30522 <tgroup cols="4" colsep="0" rowsep="0">
30523 <colspec colwidth="8*" align="left"/>
30524 <colspec colwidth="6*" align="center"/>
30525 <colspec colwidth="6*" align="center"/>
30526 <colspec colwidth="6*" align="right"/>
30527 <tbody>
30528 <row>
30529 <entry><option>smtp_return_error_details</option></entry>
30530 <entry>Use: <emphasis>main</emphasis></entry>
30531 <entry>Type: <emphasis>boolean</emphasis></entry>
30532 <entry>Default: <emphasis>false</emphasis></entry>
30533 </row>
30534 </tbody>
30535 </tgroup>
30536 </informaltable>
30537 <para>
30538 <indexterm role="concept">
30539 <primary>SMTP</primary>
30540 <secondary>details policy failures</secondary>
30541 </indexterm>
30542 <indexterm role="concept">
30543 <primary>policy control</primary>
30544 <secondary>rejection, returning details</secondary>
30545 </indexterm>
30546 In the default state, Exim uses bland messages such as
30547 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
30548 reasons. Many sysadmins like this because it gives away little information
30549 to spammers. However, some other sysadmins who are applying strict checking
30550 policies want to give out much fuller information about failures. Setting
30551 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
30552 example, instead of <quote>Administrative prohibition</quote>, it might give:
30553 </para>
30554 <literallayout class="monospaced">
30555 550-Rejected after DATA: '&gt;' missing at end of address:
30556 550 failing address in "From" header is: &lt;user@dom.ain
30557 </literallayout>
30558 <para>
30559 <indexterm role="option">
30560 <primary><option>smtputf8_advertise_hosts</option></primary>
30561 </indexterm>
30562 </para>
30563 <informaltable frame="all">
30564 <tgroup cols="4" colsep="0" rowsep="0">
30565 <colspec colwidth="8*" align="left"/>
30566 <colspec colwidth="6*" align="center"/>
30567 <colspec colwidth="6*" align="center"/>
30568 <colspec colwidth="6*" align="right"/>
30569 <tbody>
30570 <row>
30571 <entry><option>smtputf8_advertise_hosts</option></entry>
30572 <entry>Use: <emphasis>main</emphasis></entry>
30573 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30574 <entry>Default: <emphasis>*</emphasis></entry>
30575 </row>
30576 </tbody>
30577 </tgroup>
30578 </informaltable>
30579 <para>
30580 <indexterm role="concept">
30581 <primary>SMTPUTF8</primary>
30582 <secondary>advertising</secondary>
30583 </indexterm>
30584 When Exim is built with support for internationalised mail names,
30585 the availability thereof is advertised in
30586 response to EHLO only to those client hosts that match this option. See
30587 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
30588 </para>
30589 <para>
30590 <indexterm role="option">
30591 <primary><option>spamd_address</option></primary>
30592 </indexterm>
30593 </para>
30594 <informaltable frame="all">
30595 <tgroup cols="4" colsep="0" rowsep="0">
30596 <colspec colwidth="8*" align="left"/>
30597 <colspec colwidth="6*" align="center"/>
30598 <colspec colwidth="6*" align="center"/>
30599 <colspec colwidth="6*" align="right"/>
30600 <tbody>
30601 <row>
30602 <entry><option>spamd_address</option></entry>
30603 <entry>Use: <emphasis>main</emphasis></entry>
30604 <entry>Type: <emphasis>string</emphasis></entry>
30605 <entry>Default: <emphasis>see below</emphasis></entry>
30606 </row>
30607 </tbody>
30608 </tgroup>
30609 </informaltable>
30610 <para>
30611 This option is available when Exim is compiled with the content-scanning
30612 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
30613 The default value is
30614 </para>
30615 <literallayout class="monospaced">
30616 127.0.0.1 783
30617 </literallayout>
30618 <para>
30619 See section <xref linkend="SECTscanspamass"/> for more details.
30620 </para>
30621 <para>
30622 <indexterm role="option">
30623 <primary><option>split_spool_directory</option></primary>
30624 </indexterm>
30625 </para>
30626 <informaltable frame="all">
30627 <tgroup cols="4" colsep="0" rowsep="0">
30628 <colspec colwidth="8*" align="left"/>
30629 <colspec colwidth="6*" align="center"/>
30630 <colspec colwidth="6*" align="center"/>
30631 <colspec colwidth="6*" align="right"/>
30632 <tbody>
30633 <row>
30634 <entry><option>split_spool_directory</option></entry>
30635 <entry>Use: <emphasis>main</emphasis></entry>
30636 <entry>Type: <emphasis>boolean</emphasis></entry>
30637 <entry>Default: <emphasis>false</emphasis></entry>
30638 </row>
30639 </tbody>
30640 </tgroup>
30641 </informaltable>
30642 <para>
30643 <indexterm role="concept">
30644 <primary>multiple spool directories</primary>
30645 </indexterm>
30646 <indexterm role="concept">
30647 <primary>spool directory</primary>
30648 <secondary>split</secondary>
30649 </indexterm>
30650 <indexterm role="concept">
30651 <primary>directories, multiple</primary>
30652 </indexterm>
30653 If this option is set, it causes Exim to split its input directory into 62
30654 subdirectories, each with a single alphanumeric character as its name. The
30655 sixth character of the message id is used to allocate messages to
30656 subdirectories; this is the least significant base-62 digit of the time of
30657 arrival of the message.
30658 </para>
30659 <para>
30660 Splitting up the spool in this way may provide better performance on systems
30661 where there are long mail queues, by reducing the number of files in any one
30662 directory. The msglog directory is also split up in a similar way to the input
30663 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
30664 are still placed in the single directory <filename>msglog.OLD</filename>.
30665 </para>
30666 <para>
30667 It is not necessary to take any special action for existing messages when
30668 changing <option>split_spool_directory</option>. Exim notices messages that are in the
30669 <quote>wrong</quote> place, and continues to process them. If the option is turned off
30670 after a period of being on, the subdirectories will eventually empty and be
30671 automatically deleted.
30672 </para>
30673 <para>
30674 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
30675 changes. Instead of creating a list of all messages in the queue, and then
30676 trying to deliver each one in turn, it constructs a list of those in one
30677 sub-directory and tries to deliver them, before moving on to the next
30678 sub-directory. The sub-directories are processed in a random order. This
30679 spreads out the scanning of the input directories, and uses less memory. It is
30680 particularly beneficial when there are lots of messages on the queue. However,
30681 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
30682 entire queue has to be scanned and sorted before any deliveries can start.
30683 </para>
30684 <para>
30685 <indexterm role="option">
30686 <primary><option>spool_directory</option></primary>
30687 </indexterm>
30688 </para>
30689 <informaltable frame="all">
30690 <tgroup cols="4" colsep="0" rowsep="0">
30691 <colspec colwidth="8*" align="left"/>
30692 <colspec colwidth="6*" align="center"/>
30693 <colspec colwidth="6*" align="center"/>
30694 <colspec colwidth="6*" align="right"/>
30695 <tbody>
30696 <row>
30697 <entry><option>spool_directory</option></entry>
30698 <entry>Use: <emphasis>main</emphasis></entry>
30699 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30700 <entry>Default: <emphasis>set at compile time</emphasis></entry>
30701 </row>
30702 </tbody>
30703 </tgroup>
30704 </informaltable>
30705 <para>
30706 <indexterm role="concept">
30707 <primary>spool directory</primary>
30708 <secondary>path to</secondary>
30709 </indexterm>
30710 This defines the directory in which Exim keeps its spool, that is, the messages
30711 it is waiting to deliver. The default value is taken from the compile-time
30712 configuration setting, if there is one. If not, this option must be set. The
30713 string is expanded, so it can contain, for example, a reference to
30714 <varname>$primary_hostname</varname>.
30715 </para>
30716 <para>
30717 If the spool directory name is fixed on your installation, it is recommended
30718 that you set it at build time rather than from this option, particularly if the
30719 log files are being written to the spool directory (see <option>log_file_path</option>).
30720 Otherwise log files cannot be used for errors that are detected early on, such
30721 as failures in the configuration file.
30722 </para>
30723 <para>
30724 By using this option to override the compiled-in path, it is possible to run
30725 tests of Exim without using the standard spool.
30726 </para>
30727 <para>
30728 <indexterm role="option">
30729 <primary><option>sqlite_lock_timeout</option></primary>
30730 </indexterm>
30731 </para>
30732 <informaltable frame="all">
30733 <tgroup cols="4" colsep="0" rowsep="0">
30734 <colspec colwidth="8*" align="left"/>
30735 <colspec colwidth="6*" align="center"/>
30736 <colspec colwidth="6*" align="center"/>
30737 <colspec colwidth="6*" align="right"/>
30738 <tbody>
30739 <row>
30740 <entry><option>sqlite_lock_timeout</option></entry>
30741 <entry>Use: <emphasis>main</emphasis></entry>
30742 <entry>Type: <emphasis>time</emphasis></entry>
30743 <entry>Default: <emphasis>5s</emphasis></entry>
30744 </row>
30745 </tbody>
30746 </tgroup>
30747 </informaltable>
30748 <para>
30749 <indexterm role="concept">
30750 <primary>sqlite lookup type</primary>
30751 <secondary>lock timeout</secondary>
30752 </indexterm>
30753 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
30754 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
30755 </para>
30756 <para>
30757 <indexterm role="option">
30758 <primary><option>strict_acl_vars</option></primary>
30759 </indexterm>
30760 </para>
30761 <informaltable frame="all">
30762 <tgroup cols="4" colsep="0" rowsep="0">
30763 <colspec colwidth="8*" align="left"/>
30764 <colspec colwidth="6*" align="center"/>
30765 <colspec colwidth="6*" align="center"/>
30766 <colspec colwidth="6*" align="right"/>
30767 <tbody>
30768 <row>
30769 <entry><option>strict_acl_vars</option></entry>
30770 <entry>Use: <emphasis>main</emphasis></entry>
30771 <entry>Type: <emphasis>boolean</emphasis></entry>
30772 <entry>Default: <emphasis>false</emphasis></entry>
30773 </row>
30774 </tbody>
30775 </tgroup>
30776 </informaltable>
30777 <para>
30778 <indexterm role="concept">
30779 <primary>access control lists (ACLs)</primary>
30780 <secondary>variables, handling unset</secondary>
30781 </indexterm>
30782 This option controls what happens if a syntactically valid but undefined ACL
30783 variable is referenced. If it is false (the default), an empty string
30784 is substituted; if it is true, an error is generated. See section
30785 <xref linkend="SECTaclvariables"/> for details of ACL variables.
30786 </para>
30787 <para>
30788 <indexterm role="option">
30789 <primary><option>strip_excess_angle_brackets</option></primary>
30790 </indexterm>
30791 </para>
30792 <informaltable frame="all">
30793 <tgroup cols="4" colsep="0" rowsep="0">
30794 <colspec colwidth="8*" align="left"/>
30795 <colspec colwidth="6*" align="center"/>
30796 <colspec colwidth="6*" align="center"/>
30797 <colspec colwidth="6*" align="right"/>
30798 <tbody>
30799 <row>
30800 <entry><option>strip_excess_angle_brackets</option></entry>
30801 <entry>Use: <emphasis>main</emphasis></entry>
30802 <entry>Type: <emphasis>boolean</emphasis></entry>
30803 <entry>Default: <emphasis>false</emphasis></entry>
30804 </row>
30805 </tbody>
30806 </tgroup>
30807 </informaltable>
30808 <para>
30809 <indexterm role="concept">
30810 <primary>angle brackets, excess</primary>
30811 </indexterm>
30812 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
30813 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
30814 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
30815 passed on to another MTA, the excess angle brackets are not passed on. If this
30816 option is not set, multiple pairs of angle brackets cause a syntax error.
30817 </para>
30818 <para>
30819 <indexterm role="option">
30820 <primary><option>strip_trailing_dot</option></primary>
30821 </indexterm>
30822 </para>
30823 <informaltable frame="all">
30824 <tgroup cols="4" colsep="0" rowsep="0">
30825 <colspec colwidth="8*" align="left"/>
30826 <colspec colwidth="6*" align="center"/>
30827 <colspec colwidth="6*" align="center"/>
30828 <colspec colwidth="6*" align="right"/>
30829 <tbody>
30830 <row>
30831 <entry><option>strip_trailing_dot</option></entry>
30832 <entry>Use: <emphasis>main</emphasis></entry>
30833 <entry>Type: <emphasis>boolean</emphasis></entry>
30834 <entry>Default: <emphasis>false</emphasis></entry>
30835 </row>
30836 </tbody>
30837 </tgroup>
30838 </informaltable>
30839 <para>
30840 <indexterm role="concept">
30841 <primary>trailing dot on domain</primary>
30842 </indexterm>
30843 <indexterm role="concept">
30844 <primary>dot</primary>
30845 <secondary>trailing on domain</secondary>
30846 </indexterm>
30847 If this option is set, a trailing dot at the end of a domain in an address is
30848 ignored. If this is in the envelope and the message is passed on to another
30849 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
30850 domain causes a syntax error.
30851 However, addresses in header lines are checked only when an ACL requests header
30852 syntax checking.
30853 </para>
30854 <para>
30855 <indexterm role="option">
30856 <primary><option>syslog_duplication</option></primary>
30857 </indexterm>
30858 </para>
30859 <informaltable frame="all">
30860 <tgroup cols="4" colsep="0" rowsep="0">
30861 <colspec colwidth="8*" align="left"/>
30862 <colspec colwidth="6*" align="center"/>
30863 <colspec colwidth="6*" align="center"/>
30864 <colspec colwidth="6*" align="right"/>
30865 <tbody>
30866 <row>
30867 <entry><option>syslog_duplication</option></entry>
30868 <entry>Use: <emphasis>main</emphasis></entry>
30869 <entry>Type: <emphasis>boolean</emphasis></entry>
30870 <entry>Default: <emphasis>true</emphasis></entry>
30871 </row>
30872 </tbody>
30873 </tgroup>
30874 </informaltable>
30875 <para>
30876 <indexterm role="concept">
30877 <primary>syslog</primary>
30878 <secondary>duplicate log lines; suppressing</secondary>
30879 </indexterm>
30880 When Exim is logging to syslog, it writes the log lines for its three
30881 separate logs at different syslog priorities so that they can in principle
30882 be separated on the logging hosts. Some installations do not require this
30883 separation, and in those cases, the duplication of certain log lines is a
30884 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
30885 particular log line is written to syslog. For lines that normally go to
30886 both the main log and the reject log, the reject log version (possibly
30887 containing message header lines) is written, at LOG_NOTICE priority.
30888 Lines that normally go to both the main and the panic log are written at
30889 the LOG_ALERT priority.
30890 </para>
30891 <para>
30892 <indexterm role="option">
30893 <primary><option>syslog_facility</option></primary>
30894 </indexterm>
30895 </para>
30896 <informaltable frame="all">
30897 <tgroup cols="4" colsep="0" rowsep="0">
30898 <colspec colwidth="8*" align="left"/>
30899 <colspec colwidth="6*" align="center"/>
30900 <colspec colwidth="6*" align="center"/>
30901 <colspec colwidth="6*" align="right"/>
30902 <tbody>
30903 <row>
30904 <entry><option>syslog_facility</option></entry>
30905 <entry>Use: <emphasis>main</emphasis></entry>
30906 <entry>Type: <emphasis>string</emphasis></entry>
30907 <entry>Default: <emphasis>unset</emphasis></entry>
30908 </row>
30909 </tbody>
30910 </tgroup>
30911 </informaltable>
30912 <para>
30913 <indexterm role="concept">
30914 <primary>syslog</primary>
30915 <secondary>facility; setting</secondary>
30916 </indexterm>
30917 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
30918 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
30919 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
30920 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
30921 details of Exim&#x2019;s logging.
30922 </para>
30923 <para>
30924 <indexterm role="option">
30925 <primary><option>syslog_pid</option></primary>
30926 </indexterm>
30927 </para>
30928 <informaltable frame="all">
30929 <tgroup cols="4" colsep="0" rowsep="0">
30930 <colspec colwidth="8*" align="left"/>
30931 <colspec colwidth="6*" align="center"/>
30932 <colspec colwidth="6*" align="center"/>
30933 <colspec colwidth="6*" align="right"/>
30934 <tbody>
30935 <row>
30936 <entry><option>syslog_pid</option></entry>
30937 <entry>Use: <emphasis>main</emphasis></entry>
30938 <entry>Type: <emphasis>boolean</emphasis></entry>
30939 <entry>Default: <emphasis>true</emphasis></entry>
30940 </row>
30941 </tbody>
30942 </tgroup>
30943 </informaltable>
30944 <para>
30945 <indexterm role="concept">
30946 <primary>syslog</primary>
30947 <secondary>pid</secondary>
30948 </indexterm>
30949 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
30950 omitted when these lines are sent to syslog. (Syslog normally prefixes
30951 the log lines with the PID of the logging process automatically.) You need
30952 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
30953 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
30954 </para>
30955 <para>
30956 <indexterm role="option">
30957 <primary><option>syslog_processname</option></primary>
30958 </indexterm>
30959 </para>
30960 <informaltable frame="all">
30961 <tgroup cols="4" colsep="0" rowsep="0">
30962 <colspec colwidth="8*" align="left"/>
30963 <colspec colwidth="6*" align="center"/>
30964 <colspec colwidth="6*" align="center"/>
30965 <colspec colwidth="6*" align="right"/>
30966 <tbody>
30967 <row>
30968 <entry><option>syslog_processname</option></entry>
30969 <entry>Use: <emphasis>main</emphasis></entry>
30970 <entry>Type: <emphasis>string</emphasis></entry>
30971 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
30972 </row>
30973 </tbody>
30974 </tgroup>
30975 </informaltable>
30976 <para>
30977 <indexterm role="concept">
30978 <primary>syslog</primary>
30979 <secondary>process name; setting</secondary>
30980 </indexterm>
30981 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
30982 syslog. The value must be no longer than 32 characters. See chapter
30983 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
30984 </para>
30985 <para>
30986 <indexterm role="option">
30987 <primary><option>syslog_timestamp</option></primary>
30988 </indexterm>
30989 </para>
30990 <informaltable frame="all">
30991 <tgroup cols="4" colsep="0" rowsep="0">
30992 <colspec colwidth="8*" align="left"/>
30993 <colspec colwidth="6*" align="center"/>
30994 <colspec colwidth="6*" align="center"/>
30995 <colspec colwidth="6*" align="right"/>
30996 <tbody>
30997 <row>
30998 <entry><option>syslog_timestamp</option></entry>
30999 <entry>Use: <emphasis>main</emphasis></entry>
31000 <entry>Type: <emphasis>boolean</emphasis></entry>
31001 <entry>Default: <emphasis>true</emphasis></entry>
31002 </row>
31003 </tbody>
31004 </tgroup>
31005 </informaltable>
31006 <para>
31007 <indexterm role="concept">
31008 <primary>syslog</primary>
31009 <secondary>timestamps</secondary>
31010 </indexterm>
31011 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
31012 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
31013 details of Exim&#x2019;s logging.
31014 </para>
31015 <para>
31016 <indexterm role="option">
31017 <primary><option>system_filter</option></primary>
31018 </indexterm>
31019 </para>
31020 <informaltable frame="all">
31021 <tgroup cols="4" colsep="0" rowsep="0">
31022 <colspec colwidth="8*" align="left"/>
31023 <colspec colwidth="6*" align="center"/>
31024 <colspec colwidth="6*" align="center"/>
31025 <colspec colwidth="6*" align="right"/>
31026 <tbody>
31027 <row>
31028 <entry><option>system_filter</option></entry>
31029 <entry>Use: <emphasis>main</emphasis></entry>
31030 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31031 <entry>Default: <emphasis>unset</emphasis></entry>
31032 </row>
31033 </tbody>
31034 </tgroup>
31035 </informaltable>
31036 <para>
31037 <indexterm role="concept">
31038 <primary>filter</primary>
31039 <secondary>system filter</secondary>
31040 </indexterm>
31041 <indexterm role="concept">
31042 <primary>system filter</primary>
31043 <secondary>specifying</secondary>
31044 </indexterm>
31045 <indexterm role="concept">
31046 <primary>Sieve filter</primary>
31047 <secondary>not available for system filter</secondary>
31048 </indexterm>
31049 This option specifies an Exim filter file that is applied to all messages at
31050 the start of each delivery attempt, before any routing is done. System filters
31051 must be Exim filters; they cannot be Sieve filters. If the system filter
31052 generates any deliveries to files or pipes, or any new mail messages, the
31053 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
31054 which transports are to be used. Details of this facility are given in chapter
31055 <xref linkend="CHAPsystemfilter"/>.
31056 </para>
31057 <para revisionflag="changed">
31058 A forced expansion failure results in no filter operation.
31059 </para>
31060 <para>
31061 <indexterm role="option">
31062 <primary><option>system_filter_directory_transport</option></primary>
31063 </indexterm>
31064 </para>
31065 <informaltable frame="all">
31066 <tgroup cols="4" colsep="0" rowsep="0">
31067 <colspec colwidth="8*" align="left"/>
31068 <colspec colwidth="6*" align="center"/>
31069 <colspec colwidth="6*" align="center"/>
31070 <colspec colwidth="6*" align="right"/>
31071 <tbody>
31072 <row>
31073 <entry><option>system_filter_directory_transport</option></entry>
31074 <entry>Use: <emphasis>main</emphasis></entry>
31075 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31076 <entry>Default: <emphasis>unset</emphasis></entry>
31077 </row>
31078 </tbody>
31079 </tgroup>
31080 </informaltable>
31081 <para>
31082 <indexterm role="variable">
31083 <primary><varname>$address_file</varname></primary>
31084 </indexterm>
31085 This sets the name of the transport driver that is to be used when the
31086 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
31087 implying delivery of each message into a separate file in some directory.
31088 During the delivery, the variable <varname>$address_file</varname> contains the path name.
31089 </para>
31090 <para>
31091 <indexterm role="option">
31092 <primary><option>system_filter_file_transport</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>system_filter_file_transport</option></entry>
31104 <entry>Use: <emphasis>main</emphasis></entry>
31105 <entry>Type: <emphasis>string</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>file</primary>
31114 <secondary>transport for system filter</secondary>
31115 </indexterm>
31116 This sets the name of the transport driver that is to be used when the <option>save</option>
31117 command in a system message filter specifies a path not ending in <quote>/</quote>. During
31118 the delivery, the variable <varname>$address_file</varname> contains the path name.
31119 </para>
31120 <para>
31121 <indexterm role="option">
31122 <primary><option>system_filter_group</option></primary>
31123 </indexterm>
31124 </para>
31125 <informaltable frame="all">
31126 <tgroup cols="4" colsep="0" rowsep="0">
31127 <colspec colwidth="8*" align="left"/>
31128 <colspec colwidth="6*" align="center"/>
31129 <colspec colwidth="6*" align="center"/>
31130 <colspec colwidth="6*" align="right"/>
31131 <tbody>
31132 <row>
31133 <entry><option>system_filter_group</option></entry>
31134 <entry>Use: <emphasis>main</emphasis></entry>
31135 <entry>Type: <emphasis>string</emphasis></entry>
31136 <entry>Default: <emphasis>unset</emphasis></entry>
31137 </row>
31138 </tbody>
31139 </tgroup>
31140 </informaltable>
31141 <para>
31142 <indexterm role="concept">
31143 <primary>gid (group id)</primary>
31144 <secondary>system filter</secondary>
31145 </indexterm>
31146 This option is used only when <option>system_filter_user</option> is also set. It sets the
31147 gid under which the system filter is run, overriding any gid that is associated
31148 with the user. The value may be numerical or symbolic.
31149 </para>
31150 <para>
31151 <indexterm role="option">
31152 <primary><option>system_filter_pipe_transport</option></primary>
31153 </indexterm>
31154 </para>
31155 <informaltable frame="all">
31156 <tgroup cols="4" colsep="0" rowsep="0">
31157 <colspec colwidth="8*" align="left"/>
31158 <colspec colwidth="6*" align="center"/>
31159 <colspec colwidth="6*" align="center"/>
31160 <colspec colwidth="6*" align="right"/>
31161 <tbody>
31162 <row>
31163 <entry><option>system_filter_pipe_transport</option></entry>
31164 <entry>Use: <emphasis>main</emphasis></entry>
31165 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31166 <entry>Default: <emphasis>unset</emphasis></entry>
31167 </row>
31168 </tbody>
31169 </tgroup>
31170 </informaltable>
31171 <para>
31172 <indexterm role="concept">
31173 <primary><command>pipe</command> transport</primary>
31174 <secondary>for system filter</secondary>
31175 </indexterm>
31176 <indexterm role="variable">
31177 <primary><varname>$address_pipe</varname></primary>
31178 </indexterm>
31179 This specifies the transport driver that is to be used when a <option>pipe</option> command
31180 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
31181 contains the pipe command.
31182 </para>
31183 <para>
31184 <indexterm role="option">
31185 <primary><option>system_filter_reply_transport</option></primary>
31186 </indexterm>
31187 </para>
31188 <informaltable frame="all">
31189 <tgroup cols="4" colsep="0" rowsep="0">
31190 <colspec colwidth="8*" align="left"/>
31191 <colspec colwidth="6*" align="center"/>
31192 <colspec colwidth="6*" align="center"/>
31193 <colspec colwidth="6*" align="right"/>
31194 <tbody>
31195 <row>
31196 <entry><option>system_filter_reply_transport</option></entry>
31197 <entry>Use: <emphasis>main</emphasis></entry>
31198 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31199 <entry>Default: <emphasis>unset</emphasis></entry>
31200 </row>
31201 </tbody>
31202 </tgroup>
31203 </informaltable>
31204 <para>
31205 <indexterm role="concept">
31206 <primary><command>autoreply</command> transport</primary>
31207 <secondary>for system filter</secondary>
31208 </indexterm>
31209 This specifies the transport driver that is to be used when a <option>mail</option> command
31210 is used in a system filter.
31211 </para>
31212 <para>
31213 <indexterm role="option">
31214 <primary><option>system_filter_user</option></primary>
31215 </indexterm>
31216 </para>
31217 <informaltable frame="all">
31218 <tgroup cols="4" colsep="0" rowsep="0">
31219 <colspec colwidth="8*" align="left"/>
31220 <colspec colwidth="6*" align="center"/>
31221 <colspec colwidth="6*" align="center"/>
31222 <colspec colwidth="6*" align="right"/>
31223 <tbody>
31224 <row>
31225 <entry><option>system_filter_user</option></entry>
31226 <entry>Use: <emphasis>main</emphasis></entry>
31227 <entry>Type: <emphasis>string</emphasis></entry>
31228 <entry>Default: <emphasis>unset</emphasis></entry>
31229 </row>
31230 </tbody>
31231 </tgroup>
31232 </informaltable>
31233 <para>
31234 <indexterm role="concept">
31235 <primary>uid (user id)</primary>
31236 <secondary>system filter</secondary>
31237 </indexterm>
31238 If this option is set to root, the system filter is run in the main Exim
31239 delivery process, as root.  Otherwise, the system filter runs in a separate
31240 process, as the given user, defaulting to the Exim run-time user.
31241 Unless the string consists entirely of digits, it
31242 is looked up in the password data. Failure to find the named user causes a
31243 configuration error. The gid is either taken from the password data, or
31244 specified by <option>system_filter_group</option>. When the uid is specified numerically,
31245 <option>system_filter_group</option> is required to be set.
31246 </para>
31247 <para>
31248 If the system filter generates any pipe, file, or reply deliveries, the uid
31249 under which the filter is run is used when transporting them, unless a
31250 transport option overrides.
31251 </para>
31252 <para>
31253 <indexterm role="option">
31254 <primary><option>tcp_nodelay</option></primary>
31255 </indexterm>
31256 </para>
31257 <informaltable frame="all">
31258 <tgroup cols="4" colsep="0" rowsep="0">
31259 <colspec colwidth="8*" align="left"/>
31260 <colspec colwidth="6*" align="center"/>
31261 <colspec colwidth="6*" align="center"/>
31262 <colspec colwidth="6*" align="right"/>
31263 <tbody>
31264 <row>
31265 <entry><option>tcp_nodelay</option></entry>
31266 <entry>Use: <emphasis>main</emphasis></entry>
31267 <entry>Type: <emphasis>boolean</emphasis></entry>
31268 <entry>Default: <emphasis>true</emphasis></entry>
31269 </row>
31270 </tbody>
31271 </tgroup>
31272 </informaltable>
31273 <para>
31274 <indexterm role="concept">
31275 <primary>daemon</primary>
31276 <secondary>TCP_NODELAY on sockets</secondary>
31277 </indexterm>
31278 <indexterm role="concept">
31279 <primary>Nagle algorithm</primary>
31280 </indexterm>
31281 <indexterm role="concept">
31282 <primary>TCP_NODELAY on listening sockets</primary>
31283 </indexterm>
31284 If this option is set false, it stops the Exim daemon setting the
31285 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
31286 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
31287 performance in interactive (character-by-character) situations. Turning it off
31288 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
31289 However, it appears that some broken clients cannot cope, and time out. Hence
31290 this option. It affects only those sockets that are set up for listening by the
31291 daemon. Sockets created by the smtp transport for delivering mail always set
31292 TCP_NODELAY.
31293 </para>
31294 <para>
31295 <indexterm role="option">
31296 <primary><option>timeout_frozen_after</option></primary>
31297 </indexterm>
31298 </para>
31299 <informaltable frame="all">
31300 <tgroup cols="4" colsep="0" rowsep="0">
31301 <colspec colwidth="8*" align="left"/>
31302 <colspec colwidth="6*" align="center"/>
31303 <colspec colwidth="6*" align="center"/>
31304 <colspec colwidth="6*" align="right"/>
31305 <tbody>
31306 <row>
31307 <entry><option>timeout_frozen_after</option></entry>
31308 <entry>Use: <emphasis>main</emphasis></entry>
31309 <entry>Type: <emphasis>time</emphasis></entry>
31310 <entry>Default: <emphasis>0s</emphasis></entry>
31311 </row>
31312 </tbody>
31313 </tgroup>
31314 </informaltable>
31315 <para>
31316 <indexterm role="concept">
31317 <primary>frozen messages</primary>
31318 <secondary>timing out</secondary>
31319 </indexterm>
31320 <indexterm role="concept">
31321 <primary>timeout</primary>
31322 <secondary>frozen messages</secondary>
31323 </indexterm>
31324 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
31325 message of any kind that has been on the queue for longer than the given time
31326 is automatically cancelled at the next queue run. If the frozen message is a
31327 bounce message, it is just discarded; otherwise, a bounce is sent to the
31328 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
31329 If you want to timeout frozen bounce messages earlier than other kinds of
31330 frozen message, see <option>ignore_bounce_errors_after</option>.
31331 </para>
31332 <para>
31333 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
31334 frozen messages remain on the queue forever (except for any frozen bounce
31335 messages that are released by <option>ignore_bounce_errors_after</option>).
31336 </para>
31337 <para>
31338 <indexterm role="option">
31339 <primary><option>timezone</option></primary>
31340 </indexterm>
31341 </para>
31342 <informaltable frame="all">
31343 <tgroup cols="4" colsep="0" rowsep="0">
31344 <colspec colwidth="8*" align="left"/>
31345 <colspec colwidth="6*" align="center"/>
31346 <colspec colwidth="6*" align="center"/>
31347 <colspec colwidth="6*" align="right"/>
31348 <tbody>
31349 <row>
31350 <entry><option>timezone</option></entry>
31351 <entry>Use: <emphasis>main</emphasis></entry>
31352 <entry>Type: <emphasis>string</emphasis></entry>
31353 <entry>Default: <emphasis>unset</emphasis></entry>
31354 </row>
31355 </tbody>
31356 </tgroup>
31357 </informaltable>
31358 <para>
31359 <indexterm role="concept">
31360 <primary>timezone, setting</primary>
31361 </indexterm>
31362 <indexterm role="concept">
31363 <primary>environment</primary>
31364 <secondary>values from</secondary>
31365 </indexterm>
31366 The value of <option>timezone</option> is used to set the environment variable TZ while
31367 running Exim (if it is different on entry). This ensures that all timestamps
31368 created by Exim are in the required timezone. If you want all your timestamps
31369 to be in UTC (aka GMT) you should set
31370 </para>
31371 <literallayout class="monospaced">
31372 timezone = UTC
31373 </literallayout>
31374 <para>
31375 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
31376 or, if that is not set, from the value of the TZ environment variable when Exim
31377 is built. If <option>timezone</option> is set to the empty string, either at build or run
31378 time, any existing TZ variable is removed from the environment when Exim
31379 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
31380 unfortunately not all, operating systems.
31381 </para>
31382 <para>
31383 <indexterm role="option">
31384 <primary><option>tls_advertise_hosts</option></primary>
31385 </indexterm>
31386 </para>
31387 <informaltable frame="all">
31388 <tgroup cols="4" colsep="0" rowsep="0">
31389 <colspec colwidth="8*" align="left"/>
31390 <colspec colwidth="6*" align="center"/>
31391 <colspec colwidth="6*" align="center"/>
31392 <colspec colwidth="6*" align="right"/>
31393 <tbody>
31394 <row>
31395 <entry><option>tls_advertise_hosts</option></entry>
31396 <entry>Use: <emphasis>main</emphasis></entry>
31397 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31398 <entry>Default: <emphasis>*</emphasis></entry>
31399 </row>
31400 </tbody>
31401 </tgroup>
31402 </informaltable>
31403 <para>
31404 <indexterm role="concept">
31405 <primary>TLS</primary>
31406 <secondary>advertising</secondary>
31407 </indexterm>
31408 <indexterm role="concept">
31409 <primary>encryption</primary>
31410 <secondary>on SMTP connection</secondary>
31411 </indexterm>
31412 <indexterm role="concept">
31413 <primary>SMTP</primary>
31414 <secondary>encrypted connection</secondary>
31415 </indexterm>
31416 When Exim is built with support for TLS encrypted connections, the availability
31417 of the STARTTLS command to set up an encrypted session is advertised in
31418 response to EHLO only to those client hosts that match this option. See
31419 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
31420 Note that the default value requires that a certificate be supplied
31421 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
31422 is not required the <option>tls_advertise_hosts</option> option should be set empty.
31423 </para>
31424 <para>
31425 <indexterm role="option">
31426 <primary><option>tls_certificate</option></primary>
31427 </indexterm>
31428 </para>
31429 <informaltable frame="all">
31430 <tgroup cols="4" colsep="0" rowsep="0">
31431 <colspec colwidth="8*" align="left"/>
31432 <colspec colwidth="6*" align="center"/>
31433 <colspec colwidth="6*" align="center"/>
31434 <colspec colwidth="6*" align="right"/>
31435 <tbody>
31436 <row>
31437 <entry><option>tls_certificate</option></entry>
31438 <entry>Use: <emphasis>main</emphasis></entry>
31439 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31440 <entry>Default: <emphasis>unset</emphasis></entry>
31441 </row>
31442 </tbody>
31443 </tgroup>
31444 </informaltable>
31445 <para>
31446 <indexterm role="concept">
31447 <primary>TLS</primary>
31448 <secondary>server certificate; location of</secondary>
31449 </indexterm>
31450 <indexterm role="concept">
31451 <primary>certificate</primary>
31452 <secondary>server, location of</secondary>
31453 </indexterm>
31454 The value of this option is expanded, and must then be the absolute path to a
31455 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
31456 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
31457 <xref linkend="CHAPTLS"/> for further details.
31458 </para>
31459 <para>
31460 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
31461 receiving incoming messages as a server. If you want to supply certificates for
31462 use when sending messages as a client, you must set the <option>tls_certificate</option>
31463 option in the relevant <command>smtp</command> transport.
31464 </para>
31465 <para>
31466 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
31467 if the OpenSSL build supports TLS extensions and the TLS client sends the
31468 Server Name Indication extension, then this option and others documented in
31469 <xref linkend="SECTtlssni"/> will be re-expanded.
31470 </para>
31471 <para>
31472 If this option is unset or empty a fresh self-signed certificate will be
31473 generated for every connection.
31474 </para>
31475 <para>
31476 <indexterm role="option">
31477 <primary><option>tls_crl</option></primary>
31478 </indexterm>
31479 </para>
31480 <informaltable frame="all">
31481 <tgroup cols="4" colsep="0" rowsep="0">
31482 <colspec colwidth="8*" align="left"/>
31483 <colspec colwidth="6*" align="center"/>
31484 <colspec colwidth="6*" align="center"/>
31485 <colspec colwidth="6*" align="right"/>
31486 <tbody>
31487 <row>
31488 <entry><option>tls_crl</option></entry>
31489 <entry>Use: <emphasis>main</emphasis></entry>
31490 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31491 <entry>Default: <emphasis>unset</emphasis></entry>
31492 </row>
31493 </tbody>
31494 </tgroup>
31495 </informaltable>
31496 <para>
31497 <indexterm role="concept">
31498 <primary>TLS</primary>
31499 <secondary>server certificate revocation list</secondary>
31500 </indexterm>
31501 <indexterm role="concept">
31502 <primary>certificate</primary>
31503 <secondary>revocation list for server</secondary>
31504 </indexterm>
31505 This option specifies a certificate revocation list. The expanded value must
31506 be the name of a file that contains a CRL in PEM format.
31507 </para>
31508 <para>
31509 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31510 </para>
31511 <para>
31512 <indexterm role="option">
31513 <primary><option>tls_dh_max_bits</option></primary>
31514 </indexterm>
31515 </para>
31516 <informaltable frame="all">
31517 <tgroup cols="4" colsep="0" rowsep="0">
31518 <colspec colwidth="8*" align="left"/>
31519 <colspec colwidth="6*" align="center"/>
31520 <colspec colwidth="6*" align="center"/>
31521 <colspec colwidth="6*" align="right"/>
31522 <tbody>
31523 <row>
31524 <entry><option>tls_dh_max_bits</option></entry>
31525 <entry>Use: <emphasis>main</emphasis></entry>
31526 <entry>Type: <emphasis>integer</emphasis></entry>
31527 <entry>Default: <emphasis>2236</emphasis></entry>
31528 </row>
31529 </tbody>
31530 </tgroup>
31531 </informaltable>
31532 <para>
31533 <indexterm role="concept">
31534 <primary>TLS</primary>
31535 <secondary>D-H bit count</secondary>
31536 </indexterm>
31537 The number of bits used for Diffie-Hellman key-exchange may be suggested by
31538 the chosen TLS library.  That value might prove to be too high for
31539 interoperability.  This option provides a maximum clamp on the value
31540 suggested, trading off security for interoperability.
31541 </para>
31542 <para>
31543 The value must be at least 1024.
31544 </para>
31545 <para>
31546 The value 2236 was chosen because, at time of adding the option, it was the
31547 hard-coded maximum value supported by the NSS cryptographic library, as used
31548 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
31549 </para>
31550 <para>
31551 If you prefer more security and are willing to break some clients, raise this
31552 number.
31553 </para>
31554 <para>
31555 Note that the value passed to GnuTLS for *generating* a new prime may be a
31556 little less than this figure, because GnuTLS is inexact and may produce a
31557 larger prime than requested.
31558 </para>
31559 <para>
31560 <indexterm role="option">
31561 <primary><option>tls_dhparam</option></primary>
31562 </indexterm>
31563 </para>
31564 <informaltable frame="all">
31565 <tgroup cols="4" colsep="0" rowsep="0">
31566 <colspec colwidth="8*" align="left"/>
31567 <colspec colwidth="6*" align="center"/>
31568 <colspec colwidth="6*" align="center"/>
31569 <colspec colwidth="6*" align="right"/>
31570 <tbody>
31571 <row>
31572 <entry><option>tls_dhparam</option></entry>
31573 <entry>Use: <emphasis>main</emphasis></entry>
31574 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31575 <entry>Default: <emphasis>unset</emphasis></entry>
31576 </row>
31577 </tbody>
31578 </tgroup>
31579 </informaltable>
31580 <para>
31581 <indexterm role="concept">
31582 <primary>TLS</primary>
31583 <secondary>D-H parameters for server</secondary>
31584 </indexterm>
31585 The value of this option is expanded and indicates the source of DH parameters
31586 to be used by Exim.
31587 </para>
31588 <para>
31589 <emphasis role="bold">Note: The Exim Maintainers strongly recommend using a filename with site-generated
31590 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
31591 other specific constants available are a fallback so that even when
31592 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
31593 </para>
31594 <para>
31595 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
31596 then it names a file from which DH
31597 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
31598 PKCS#3 representation of the DH prime.  If the file does not exist, for
31599 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
31600 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
31601 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
31602 and treated as though the <option>tls_dhparam</option> were set to "none".
31603 </para>
31604 <para>
31605 If this option expands to the string "none", then no DH parameters will be
31606 loaded by Exim.
31607 </para>
31608 <para>
31609 If this option expands to the string "historic" and Exim is using GnuTLS, then
31610 Exim will attempt to load a file from inside the spool directory.  If the file
31611 does not exist, Exim will attempt to create it.
31612 See section <xref linkend="SECTgnutlsparam"/> for further details.
31613 </para>
31614 <para>
31615 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
31616 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
31617 </para>
31618 <para>
31619 In older versions of Exim the default was the 2048 bit prime described in section
31620 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
31621 in IKE is assigned number 23.
31622 </para>
31623 <para>
31624 Otherwise, the option must expand to the name used by Exim for any of a number
31625 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
31626 sources.  As names, Exim uses a standard specified name, else "ike" followed by
31627 the number used by IKE, or "default" which corresponds to
31628 <literal>exim.dev.20160529.3</literal>.
31629 </para>
31630 <para>
31631 The available standard primes are:
31632 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
31633 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
31634 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
31635 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
31636 </para>
31637 <para>
31638 The available additional primes are:
31639 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
31640 </para>
31641 <para>
31642 Some of these will be too small to be accepted by clients.
31643 Some may be too large to be accepted by clients.
31644 The open cryptographic community has suspicions about the integrity of some
31645 of the later IKE values, which led into RFC7919 providing new fixed constants
31646 (the "ffdhe" identifiers).
31647 </para>
31648 <para>
31649 At this point, all of the "ike" values should be considered obsolete;
31650 they&#x2019;re still in Exim to avoid breaking unusual configurations, but are
31651 candidates for removal the next time we have backwards-incompatible changes.
31652 </para>
31653 <para>
31654 The TLS protocol does not negotiate an acceptable size for this; clients tend
31655 to hard-drop connections if what is offered by the server is unacceptable,
31656 whether too large or too small, and there&#x2019;s no provision for the client to
31657 tell the server what these constraints are.  Thus, as a server operator, you
31658 need to make an educated guess as to what is most likely to work for your
31659 userbase.
31660 </para>
31661 <para>
31662 Some known size constraints suggest that a bit-size in the range 2048 to 2236
31663 is most likely to maximise interoperability.  The upper bound comes from
31664 applications using the Mozilla Network Security Services (NSS) library, which
31665 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
31666 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
31667 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
31668 acceptable bound from 1024 to 2048.
31669 </para>
31670 <para>
31671 <indexterm role="option">
31672 <primary><option>tls_eccurve</option></primary>
31673 </indexterm>
31674 </para>
31675 <informaltable frame="all">
31676 <tgroup cols="4" colsep="0" rowsep="0">
31677 <colspec colwidth="8*" align="left"/>
31678 <colspec colwidth="6*" align="center"/>
31679 <colspec colwidth="6*" align="center"/>
31680 <colspec colwidth="6*" align="right"/>
31681 <tbody>
31682 <row>
31683 <entry><option>tls_eccurve</option></entry>
31684 <entry>Use: <emphasis>main</emphasis></entry>
31685 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31686 <entry>Default: <emphasis><literal>auto</literal></emphasis></entry>
31687 </row>
31688 </tbody>
31689 </tgroup>
31690 </informaltable>
31691 <para>
31692 <indexterm role="concept">
31693 <primary>TLS</primary>
31694 <secondary>EC cryptography</secondary>
31695 </indexterm>
31696 This option selects a EC curve for use by Exim.
31697 </para>
31698 <para>
31699 After expansion it must contain a valid EC curve parameter, such as
31700 <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-512</literal>. Consult your OpenSSL manual
31701 for valid selections.
31702 </para>
31703 <para>
31704 For OpenSSL versions before (and not including) 1.0.2, the string
31705 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
31706 <literal>auto</literal> tells the library to choose.
31707 </para>
31708 <para>
31709 If the option expands to an empty string, no EC curves will be enabled.
31710 </para>
31711 <para>
31712 <indexterm role="option">
31713 <primary><option>tls_ocsp_file</option></primary>
31714 </indexterm>
31715 </para>
31716 <informaltable frame="all">
31717 <tgroup cols="4" colsep="0" rowsep="0">
31718 <colspec colwidth="8*" align="left"/>
31719 <colspec colwidth="6*" align="center"/>
31720 <colspec colwidth="6*" align="center"/>
31721 <colspec colwidth="6*" align="right"/>
31722 <tbody>
31723 <row>
31724 <entry><option>tls_ocsp_file</option></entry>
31725 <entry>Use: <emphasis>main</emphasis></entry>
31726 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31727 <entry>Default: <emphasis>unset</emphasis></entry>
31728 </row>
31729 </tbody>
31730 </tgroup>
31731 </informaltable>
31732 <para>
31733 <indexterm role="concept">
31734 <primary>TLS</primary>
31735 <secondary>certificate status</secondary>
31736 </indexterm>
31737 <indexterm role="concept">
31738 <primary>TLS</primary>
31739 <secondary>OCSP proof file</secondary>
31740 </indexterm>
31741 This option
31742 must if set expand to the absolute path to a file which contains a current
31743 status proof for the server&#x2019;s certificate, as obtained from the
31744 Certificate Authority.
31745 </para>
31746 <para>
31747 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
31748 </para>
31749 <para>
31750 <indexterm role="option">
31751 <primary><option>tls_on_connect_ports</option></primary>
31752 </indexterm>
31753 </para>
31754 <informaltable frame="all">
31755 <tgroup cols="4" colsep="0" rowsep="0">
31756 <colspec colwidth="8*" align="left"/>
31757 <colspec colwidth="6*" align="center"/>
31758 <colspec colwidth="6*" align="center"/>
31759 <colspec colwidth="6*" align="right"/>
31760 <tbody>
31761 <row>
31762 <entry><option>tls_on_connect_ports</option></entry>
31763 <entry>Use: <emphasis>main</emphasis></entry>
31764 <entry>Type: <emphasis>string list</emphasis></entry>
31765 <entry>Default: <emphasis>unset</emphasis></entry>
31766 </row>
31767 </tbody>
31768 </tgroup>
31769 </informaltable>
31770 <para>
31771 <indexterm role="concept">
31772 <primary>SSMTP</primary>
31773 </indexterm>
31774 <indexterm role="concept">
31775 <primary>SMTPS</primary>
31776 </indexterm>
31777 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
31778 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
31779 set up without waiting for the client to issue a STARTTLS command. For
31780 further details, see section <xref linkend="SECTsupobssmt"/>.
31781 </para>
31782 <para>
31783 <indexterm role="option">
31784 <primary><option>tls_privatekey</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>tls_privatekey</option></entry>
31796 <entry>Use: <emphasis>main</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>TLS</primary>
31806 <secondary>server private key; location of</secondary>
31807 </indexterm>
31808 The value of this option is expanded, and must then be the absolute path to a
31809 file which contains the server&#x2019;s private key. If this option is unset, or if
31810 the expansion is forced to fail, or the result is an empty string, the private
31811 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
31812 <xref linkend="CHAPTLS"/> for further details.
31813 </para>
31814 <para>
31815 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31816 </para>
31817 <para>
31818 <indexterm role="option">
31819 <primary><option>tls_remember_esmtp</option></primary>
31820 </indexterm>
31821 </para>
31822 <informaltable frame="all">
31823 <tgroup cols="4" colsep="0" rowsep="0">
31824 <colspec colwidth="8*" align="left"/>
31825 <colspec colwidth="6*" align="center"/>
31826 <colspec colwidth="6*" align="center"/>
31827 <colspec colwidth="6*" align="right"/>
31828 <tbody>
31829 <row>
31830 <entry><option>tls_remember_esmtp</option></entry>
31831 <entry>Use: <emphasis>main</emphasis></entry>
31832 <entry>Type: <emphasis>boolean</emphasis></entry>
31833 <entry>Default: <emphasis>false</emphasis></entry>
31834 </row>
31835 </tbody>
31836 </tgroup>
31837 </informaltable>
31838 <para>
31839 <indexterm role="concept">
31840 <primary>TLS</primary>
31841 <secondary>esmtp state; remembering</secondary>
31842 </indexterm>
31843 <indexterm role="concept">
31844 <primary>TLS</primary>
31845 <secondary>broken clients</secondary>
31846 </indexterm>
31847 If this option is set true, Exim violates the RFCs by remembering that it is in
31848 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
31849 support for broken clients that fail to send a new EHLO after starting a
31850 TLS session.
31851 </para>
31852 <para>
31853 <indexterm role="option">
31854 <primary><option>tls_require_ciphers</option></primary>
31855 </indexterm>
31856 </para>
31857 <informaltable frame="all">
31858 <tgroup cols="4" colsep="0" rowsep="0">
31859 <colspec colwidth="8*" align="left"/>
31860 <colspec colwidth="6*" align="center"/>
31861 <colspec colwidth="6*" align="center"/>
31862 <colspec colwidth="6*" align="right"/>
31863 <tbody>
31864 <row>
31865 <entry><option>tls_require_ciphers</option></entry>
31866 <entry>Use: <emphasis>main</emphasis></entry>
31867 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31868 <entry>Default: <emphasis>unset</emphasis></entry>
31869 </row>
31870 </tbody>
31871 </tgroup>
31872 </informaltable>
31873 <para>
31874 <indexterm role="concept">
31875 <primary>TLS</primary>
31876 <secondary>requiring specific ciphers</secondary>
31877 </indexterm>
31878 <indexterm role="concept">
31879 <primary>cipher</primary>
31880 <secondary>requiring specific</secondary>
31881 </indexterm>
31882 This option controls which ciphers can be used for incoming TLS connections.
31883 The <command>smtp</command> transport has an option of the same name for controlling outgoing
31884 connections. This option is expanded for each connection, so can be varied for
31885 different clients if required. The value of this option must be a list of
31886 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
31887 in somewhat different ways. If GnuTLS is being used, the client controls the
31888 preference order of the available ciphers. Details are given in sections
31889 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
31890 </para>
31891 <para>
31892 <indexterm role="option">
31893 <primary><option>tls_try_verify_hosts</option></primary>
31894 </indexterm>
31895 </para>
31896 <informaltable frame="all">
31897 <tgroup cols="4" colsep="0" rowsep="0">
31898 <colspec colwidth="8*" align="left"/>
31899 <colspec colwidth="6*" align="center"/>
31900 <colspec colwidth="6*" align="center"/>
31901 <colspec colwidth="6*" align="right"/>
31902 <tbody>
31903 <row>
31904 <entry><option>tls_try_verify_hosts</option></entry>
31905 <entry>Use: <emphasis>main</emphasis></entry>
31906 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31907 <entry>Default: <emphasis>unset</emphasis></entry>
31908 </row>
31909 </tbody>
31910 </tgroup>
31911 </informaltable>
31912 <para>
31913 <indexterm role="concept">
31914 <primary>TLS</primary>
31915 <secondary>client certificate verification</secondary>
31916 </indexterm>
31917 <indexterm role="concept">
31918 <primary>certificate</primary>
31919 <secondary>verification of client</secondary>
31920 </indexterm>
31921 See <option>tls_verify_hosts</option> below.
31922 </para>
31923 <para>
31924 <indexterm role="option">
31925 <primary><option>tls_verify_certificates</option></primary>
31926 </indexterm>
31927 </para>
31928 <informaltable frame="all">
31929 <tgroup cols="4" colsep="0" rowsep="0">
31930 <colspec colwidth="8*" align="left"/>
31931 <colspec colwidth="6*" align="center"/>
31932 <colspec colwidth="6*" align="center"/>
31933 <colspec colwidth="6*" align="right"/>
31934 <tbody>
31935 <row>
31936 <entry><option>tls_verify_certificates</option></entry>
31937 <entry>Use: <emphasis>main</emphasis></entry>
31938 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31939 <entry>Default: <emphasis>system</emphasis></entry>
31940 </row>
31941 </tbody>
31942 </tgroup>
31943 </informaltable>
31944 <para>
31945 <indexterm role="concept">
31946 <primary>TLS</primary>
31947 <secondary>client certificate verification</secondary>
31948 </indexterm>
31949 <indexterm role="concept">
31950 <primary>certificate</primary>
31951 <secondary>verification of client</secondary>
31952 </indexterm>
31953 The value of this option is expanded, and must then be either the
31954 word "system"
31955 or the absolute path to
31956 a file or directory containing permitted certificates for clients that
31957 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
31958 </para>
31959 <para>
31960 The "system" value for the option will use a
31961 system default location compiled into the SSL library.
31962 This is not available for GnuTLS versions preceding 3.0.20,
31963 and will be taken as empty; an explicit location
31964 must be specified.
31965 </para>
31966 <para>
31967 The use of a directory for the option value is not available for GnuTLS versions
31968 preceding 3.3.6 and a single file must be used.
31969 </para>
31970 <para>
31971 With OpenSSL the certificates specified
31972 explicitly
31973 either by file or directory
31974 are added to those given by the system default location.
31975 </para>
31976 <para>
31977 These certificates should be for the certificate authorities trusted, rather
31978 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
31979 the value is a file then the certificates are sent by Exim as a server to
31980 connecting clients, defining the list of accepted certificate authorities.
31981 Thus the values defined should be considered public data.  To avoid this,
31982 use the explicit directory version.
31983 </para>
31984 <para>
31985 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
31986 </para>
31987 <para>
31988 A forced expansion failure or setting to an empty string is equivalent to
31989 being unset.
31990 </para>
31991 <para>
31992 <indexterm role="option">
31993 <primary><option>tls_verify_hosts</option></primary>
31994 </indexterm>
31995 </para>
31996 <informaltable frame="all">
31997 <tgroup cols="4" colsep="0" rowsep="0">
31998 <colspec colwidth="8*" align="left"/>
31999 <colspec colwidth="6*" align="center"/>
32000 <colspec colwidth="6*" align="center"/>
32001 <colspec colwidth="6*" align="right"/>
32002 <tbody>
32003 <row>
32004 <entry><option>tls_verify_hosts</option></entry>
32005 <entry>Use: <emphasis>main</emphasis></entry>
32006 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32007 <entry>Default: <emphasis>unset</emphasis></entry>
32008 </row>
32009 </tbody>
32010 </tgroup>
32011 </informaltable>
32012 <para>
32013 <indexterm role="concept">
32014 <primary>TLS</primary>
32015 <secondary>client certificate verification</secondary>
32016 </indexterm>
32017 <indexterm role="concept">
32018 <primary>certificate</primary>
32019 <secondary>verification of client</secondary>
32020 </indexterm>
32021 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
32022 certificates from clients. The expected certificates are defined by
32023 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
32024 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
32025 <option>tls_verify_certificates</option> is not set.
32026 </para>
32027 <para>
32028 Any client that matches <option>tls_verify_hosts</option> is constrained by
32029 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
32030 present one of the listed certificates. If it does not, the connection is
32031 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
32032 the host to use TLS. It can still send SMTP commands through unencrypted
32033 connections. Forcing a client to use TLS has to be done separately using an
32034 ACL to reject inappropriate commands when the connection is not encrypted.
32035 </para>
32036 <para>
32037 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
32038 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
32039 certificate and checks it against <option>tls_verify_certificates</option>, but does not
32040 abort the connection if there is no certificate or if it does not match. This
32041 state can be detected in an ACL, which makes it possible to implement policies
32042 such as <quote>accept for relay only if a verified certificate has been received,
32043 but accept for local delivery if encrypted, even without a verified
32044 certificate</quote>.
32045 </para>
32046 <para>
32047 Client hosts that match neither of these lists are not asked to present
32048 certificates.
32049 </para>
32050 <para>
32051 <indexterm role="option">
32052 <primary><option>trusted_groups</option></primary>
32053 </indexterm>
32054 </para>
32055 <informaltable frame="all">
32056 <tgroup cols="4" colsep="0" rowsep="0">
32057 <colspec colwidth="8*" align="left"/>
32058 <colspec colwidth="6*" align="center"/>
32059 <colspec colwidth="6*" align="center"/>
32060 <colspec colwidth="6*" align="right"/>
32061 <tbody>
32062 <row>
32063 <entry><option>trusted_groups</option></entry>
32064 <entry>Use: <emphasis>main</emphasis></entry>
32065 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32066 <entry>Default: <emphasis>unset</emphasis></entry>
32067 </row>
32068 </tbody>
32069 </tgroup>
32070 </informaltable>
32071 <para>
32072 <indexterm role="concept">
32073 <primary>trusted groups</primary>
32074 </indexterm>
32075 <indexterm role="concept">
32076 <primary>groups</primary>
32077 <secondary>trusted</secondary>
32078 </indexterm>
32079 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32080 option is set, any process that is running in one of the listed groups, or
32081 which has one of them as a supplementary group, is trusted. The groups can be
32082 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
32083 details of what trusted callers are permitted to do. If neither
32084 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
32085 are trusted.
32086 </para>
32087 <para>
32088 <indexterm role="option">
32089 <primary><option>trusted_users</option></primary>
32090 </indexterm>
32091 </para>
32092 <informaltable frame="all">
32093 <tgroup cols="4" colsep="0" rowsep="0">
32094 <colspec colwidth="8*" align="left"/>
32095 <colspec colwidth="6*" align="center"/>
32096 <colspec colwidth="6*" align="center"/>
32097 <colspec colwidth="6*" align="right"/>
32098 <tbody>
32099 <row>
32100 <entry><option>trusted_users</option></entry>
32101 <entry>Use: <emphasis>main</emphasis></entry>
32102 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
32103 <entry>Default: <emphasis>unset</emphasis></entry>
32104 </row>
32105 </tbody>
32106 </tgroup>
32107 </informaltable>
32108 <para>
32109 <indexterm role="concept">
32110 <primary>trusted users</primary>
32111 </indexterm>
32112 <indexterm role="concept">
32113 <primary>user</primary>
32114 <secondary>trusted</secondary>
32115 </indexterm>
32116 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
32117 option is set, any process that is running as one of the listed users is
32118 trusted. The users can be specified numerically or by name. See section
32119 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
32120 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
32121 Exim user are trusted.
32122 </para>
32123 <para>
32124 <indexterm role="option">
32125 <primary><option>unknown_login</option></primary>
32126 </indexterm>
32127 </para>
32128 <informaltable frame="all">
32129 <tgroup cols="4" colsep="0" rowsep="0">
32130 <colspec colwidth="8*" align="left"/>
32131 <colspec colwidth="6*" align="center"/>
32132 <colspec colwidth="6*" align="center"/>
32133 <colspec colwidth="6*" align="right"/>
32134 <tbody>
32135 <row>
32136 <entry><option>unknown_login</option></entry>
32137 <entry>Use: <emphasis>main</emphasis></entry>
32138 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32139 <entry>Default: <emphasis>unset</emphasis></entry>
32140 </row>
32141 </tbody>
32142 </tgroup>
32143 </informaltable>
32144 <para>
32145 <indexterm role="concept">
32146 <primary>uid (user id)</primary>
32147 <secondary>unknown caller</secondary>
32148 </indexterm>
32149 <indexterm role="variable">
32150 <primary><varname>$caller_uid</varname></primary>
32151 </indexterm>
32152 This is a specialized feature for use in unusual configurations. By default, if
32153 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
32154 gives up. The <option>unknown_login</option> option can be used to set a login name to be
32155 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
32156 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
32157 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
32158 <option>-F</option> option.
32159 </para>
32160 <para>
32161 <indexterm role="option">
32162 <primary><option>unknown_username</option></primary>
32163 </indexterm>
32164 </para>
32165 <informaltable frame="all">
32166 <tgroup cols="4" colsep="0" rowsep="0">
32167 <colspec colwidth="8*" align="left"/>
32168 <colspec colwidth="6*" align="center"/>
32169 <colspec colwidth="6*" align="center"/>
32170 <colspec colwidth="6*" align="right"/>
32171 <tbody>
32172 <row>
32173 <entry><option>unknown_username</option></entry>
32174 <entry>Use: <emphasis>main</emphasis></entry>
32175 <entry>Type: <emphasis>string</emphasis></entry>
32176 <entry>Default: <emphasis>unset</emphasis></entry>
32177 </row>
32178 </tbody>
32179 </tgroup>
32180 </informaltable>
32181 <para>
32182 See <option>unknown_login</option>.
32183 </para>
32184 <para>
32185 <indexterm role="option">
32186 <primary><option>untrusted_set_sender</option></primary>
32187 </indexterm>
32188 </para>
32189 <informaltable frame="all">
32190 <tgroup cols="4" colsep="0" rowsep="0">
32191 <colspec colwidth="8*" align="left"/>
32192 <colspec colwidth="6*" align="center"/>
32193 <colspec colwidth="6*" align="center"/>
32194 <colspec colwidth="6*" align="right"/>
32195 <tbody>
32196 <row>
32197 <entry><option>untrusted_set_sender</option></entry>
32198 <entry>Use: <emphasis>main</emphasis></entry>
32199 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
32200 <entry>Default: <emphasis>unset</emphasis></entry>
32201 </row>
32202 </tbody>
32203 </tgroup>
32204 </informaltable>
32205 <para>
32206 <indexterm role="concept">
32207 <primary>trusted users</primary>
32208 </indexterm>
32209 <indexterm role="concept">
32210 <primary>sender</primary>
32211 <secondary>setting by untrusted user</secondary>
32212 </indexterm>
32213 <indexterm role="concept">
32214 <primary>untrusted user setting sender</primary>
32215 </indexterm>
32216 <indexterm role="concept">
32217 <primary>user</primary>
32218 <secondary>untrusted setting sender</secondary>
32219 </indexterm>
32220 <indexterm role="concept">
32221 <primary>envelope sender</primary>
32222 </indexterm>
32223 When an untrusted user submits a message to Exim using the standard input, Exim
32224 normally creates an envelope sender address from the user&#x2019;s login and the
32225 default qualification domain. Data from the <option>-f</option> option (for setting envelope
32226 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
32227 is used) is ignored.
32228 </para>
32229 <para>
32230 However, untrusted users are permitted to set an empty envelope sender address,
32231 to declare that a message should never generate any bounces. For example:
32232 </para>
32233 <literallayout class="monospaced">
32234 exim -f '&lt;&gt;' user@domain.example
32235 </literallayout>
32236 <para>
32237 <indexterm role="variable">
32238 <primary><varname>$sender_ident</varname></primary>
32239 </indexterm>
32240 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
32241 other envelope sender addresses in a controlled way. When it is set, untrusted
32242 users are allowed to set envelope sender addresses that match any of the
32243 patterns in the list. Like all address lists, the string is expanded. The
32244 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
32245 users to setting senders that start with their login ids
32246 followed by a hyphen
32247 by a setting like this:
32248 </para>
32249 <literallayout class="monospaced">
32250 untrusted_set_sender = ^$sender_ident-
32251 </literallayout>
32252 <para>
32253 If you want to allow untrusted users to set envelope sender addresses without
32254 restriction, you can use
32255 </para>
32256 <literallayout class="monospaced">
32257 untrusted_set_sender = *
32258 </literallayout>
32259 <para>
32260 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
32261 only to the setting of the envelope sender. It does not permit untrusted users
32262 to use the other options which trusted user can use to override message
32263 parameters. Furthermore, it does not stop Exim from removing an existing
32264 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
32265 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
32266 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
32267 described in section <xref linkend="SECTthesenhea"/>.
32268 </para>
32269 <para>
32270 The log line for a message&#x2019;s arrival shows the envelope sender following
32271 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
32272 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
32273 envelope sender address, the user&#x2019;s login is shown in parentheses after the
32274 sender address.
32275 </para>
32276 <para>
32277 <indexterm role="option">
32278 <primary><option>uucp_from_pattern</option></primary>
32279 </indexterm>
32280 </para>
32281 <informaltable frame="all">
32282 <tgroup cols="4" colsep="0" rowsep="0">
32283 <colspec colwidth="8*" align="left"/>
32284 <colspec colwidth="6*" align="center"/>
32285 <colspec colwidth="6*" align="center"/>
32286 <colspec colwidth="6*" align="right"/>
32287 <tbody>
32288 <row>
32289 <entry><option>uucp_from_pattern</option></entry>
32290 <entry>Use: <emphasis>main</emphasis></entry>
32291 <entry>Type: <emphasis>string</emphasis></entry>
32292 <entry>Default: <emphasis>see below</emphasis></entry>
32293 </row>
32294 </tbody>
32295 </tgroup>
32296 </informaltable>
32297 <para>
32298 <indexterm role="concept">
32299 <primary><quote>From</quote> line</primary>
32300 </indexterm>
32301 <indexterm role="concept">
32302 <primary>UUCP</primary>
32303 <secondary><quote>From</quote> line</secondary>
32304 </indexterm>
32305 Some applications that pass messages to an MTA via a command line interface use
32306 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
32307 particular, this is used by UUCP software. Exim recognizes such a line by means
32308 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
32309 matches, the sender address is constructed by expanding the contents of
32310 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
32311 default pattern recognizes lines in the following two forms:
32312 </para>
32313 <literallayout class="monospaced">
32314 From ph10 Fri Jan  5 12:35 GMT 1996
32315 From ph10 Fri, 7 Jan 97 14:00:00 GMT
32316 </literallayout>
32317 <para>
32318 The pattern can be seen by running
32319 </para>
32320 <literallayout class="monospaced">
32321 exim -bP uucp_from_pattern
32322 </literallayout>
32323 <para>
32324 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
32325 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
32326 regular expression by a parenthesized subpattern. The default value for
32327 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
32328 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
32329 <option>ignore_fromline_hosts</option>.
32330 </para>
32331 <para>
32332 <indexterm role="option">
32333 <primary><option>uucp_from_sender</option></primary>
32334 </indexterm>
32335 </para>
32336 <informaltable frame="all">
32337 <tgroup cols="4" colsep="0" rowsep="0">
32338 <colspec colwidth="8*" align="left"/>
32339 <colspec colwidth="6*" align="center"/>
32340 <colspec colwidth="6*" align="center"/>
32341 <colspec colwidth="6*" align="right"/>
32342 <tbody>
32343 <row>
32344 <entry><option>uucp_from_sender</option></entry>
32345 <entry>Use: <emphasis>main</emphasis></entry>
32346 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32347 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
32348 </row>
32349 </tbody>
32350 </tgroup>
32351 </informaltable>
32352 <para>
32353 See <option>uucp_from_pattern</option> above.
32354 </para>
32355 <para>
32356 <indexterm role="option">
32357 <primary><option>warn_message_file</option></primary>
32358 </indexterm>
32359 </para>
32360 <informaltable frame="all">
32361 <tgroup cols="4" colsep="0" rowsep="0">
32362 <colspec colwidth="8*" align="left"/>
32363 <colspec colwidth="6*" align="center"/>
32364 <colspec colwidth="6*" align="center"/>
32365 <colspec colwidth="6*" align="right"/>
32366 <tbody>
32367 <row>
32368 <entry><option>warn_message_file</option></entry>
32369 <entry>Use: <emphasis>main</emphasis></entry>
32370 <entry>Type: <emphasis>string</emphasis></entry>
32371 <entry>Default: <emphasis>unset</emphasis></entry>
32372 </row>
32373 </tbody>
32374 </tgroup>
32375 </informaltable>
32376 <para>
32377 <indexterm role="concept">
32378 <primary>warning of delay</primary>
32379 <secondary>customizing the message</secondary>
32380 </indexterm>
32381 <indexterm role="concept">
32382 <primary>customizing</primary>
32383 <secondary>warning message</secondary>
32384 </indexterm>
32385 This option defines a template file containing paragraphs of text to be used
32386 for constructing the warning message which is sent by Exim when a message has
32387 been on the queue for a specified amount of time, as specified by
32388 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
32389 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
32390 </para>
32391 <para>
32392 <indexterm role="option">
32393 <primary><option>write_rejectlog</option></primary>
32394 </indexterm>
32395 </para>
32396 <informaltable frame="all">
32397 <tgroup cols="4" colsep="0" rowsep="0">
32398 <colspec colwidth="8*" align="left"/>
32399 <colspec colwidth="6*" align="center"/>
32400 <colspec colwidth="6*" align="center"/>
32401 <colspec colwidth="6*" align="right"/>
32402 <tbody>
32403 <row>
32404 <entry><option>write_rejectlog</option></entry>
32405 <entry>Use: <emphasis>main</emphasis></entry>
32406 <entry>Type: <emphasis>boolean</emphasis></entry>
32407 <entry>Default: <emphasis>true</emphasis></entry>
32408 </row>
32409 </tbody>
32410 </tgroup>
32411 </informaltable>
32412 <para>
32413 <indexterm role="concept">
32414 <primary>reject log</primary>
32415 <secondary>disabling</secondary>
32416 </indexterm>
32417 If this option is set false, Exim no longer writes anything to the reject log.
32418 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
32419 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
32420 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
32421 </para>
32422 </section>
32423 </chapter>
32424
32425 <chapter id="CHAProutergeneric">
32426 <title>Generic options for routers</title>
32427 <para>
32428 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
32429 <primary>options</primary>
32430 <secondary>generic; for routers</secondary>
32431 </indexterm>
32432 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
32433 <primary>generic options</primary>
32434 <secondary>router</secondary>
32435 </indexterm>
32436 This chapter describes the generic options that apply to all routers.
32437 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
32438 </para>
32439 <para>
32440 For a general description of how a router operates, see sections
32441 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
32442 which the preconditions are tested. The order of expansion of the options that
32443 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
32444 <option>headers_remove</option>, <option>transport</option>.
32445 </para>
32446 <para>
32447 <indexterm role="option">
32448 <primary><option>address_data</option></primary>
32449 </indexterm>
32450 </para>
32451 <informaltable frame="all">
32452 <tgroup cols="4" colsep="0" rowsep="0">
32453 <colspec colwidth="8*" align="left"/>
32454 <colspec colwidth="6*" align="center"/>
32455 <colspec colwidth="6*" align="center"/>
32456 <colspec colwidth="6*" align="right"/>
32457 <tbody>
32458 <row>
32459 <entry><option>address_data</option></entry>
32460 <entry>Use: <emphasis>routers</emphasis></entry>
32461 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32462 <entry>Default: <emphasis>unset</emphasis></entry>
32463 </row>
32464 </tbody>
32465 </tgroup>
32466 </informaltable>
32467 <para>
32468 <indexterm role="concept">
32469 <primary>router</primary>
32470 <secondary>data attached to address</secondary>
32471 </indexterm>
32472 The string is expanded just before the router is run, that is, after all the
32473 precondition tests have succeeded. If the expansion is forced to fail, the
32474 router declines, the value of <option>address_data</option> remains unchanged, and the
32475 <option>more</option> option controls what happens next. Other expansion failures cause
32476 delivery of the address to be deferred.
32477 </para>
32478 <para>
32479 <indexterm role="variable">
32480 <primary><varname>$address_data</varname></primary>
32481 </indexterm>
32482 When the expansion succeeds, the value is retained with the address, and can be
32483 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
32484 routers, and the eventual transport.
32485 </para>
32486 <para>
32487 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
32488 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
32489 in the filter. This is not normally a problem, because such data is usually
32490 either not confidential or it <quote>belongs</quote> to the current user, but if you do
32491 put confidential data into <varname>$address_data</varname> you need to remember this point.
32492 </para>
32493 <para>
32494 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
32495 with the address, though it can be changed by another <option>address_data</option> setting
32496 on a subsequent router. If a router generates child addresses, the value of
32497 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
32498 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
32499 </para>
32500 <para>
32501 The idea of <option>address_data</option> is that you can use it to look up a lot of data
32502 for the address once, and then pick out parts of the data later. For example,
32503 you could use a single LDAP lookup to return a string of the form
32504 </para>
32505 <literallayout class="monospaced">
32506 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
32507 </literallayout>
32508 <para>
32509 In the transport you could pick out the mailbox by a setting such as
32510 </para>
32511 <literallayout class="monospaced">
32512 file = ${extract{mailbox}{$address_data}}
32513 </literallayout>
32514 <para>
32515 This makes the configuration file less messy, and also reduces the number of
32516 lookups (though Exim does cache lookups).
32517 </para>
32518 <para>
32519 <indexterm role="variable">
32520 <primary><varname>$sender_address_data</varname></primary>
32521 </indexterm>
32522 <indexterm role="variable">
32523 <primary><varname>$address_data</varname></primary>
32524 </indexterm>
32525 The <option>address_data</option> facility is also useful as a means of passing information
32526 from one router to another, and from a router to a transport. In addition, if
32527 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
32528 ACL, it remains available for use in the rest of the ACL statement. After
32529 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
32530 </para>
32531 <para>
32532 <indexterm role="option">
32533 <primary><option>address_test</option></primary>
32534 </indexterm>
32535 </para>
32536 <informaltable frame="all">
32537 <tgroup cols="4" colsep="0" rowsep="0">
32538 <colspec colwidth="8*" align="left"/>
32539 <colspec colwidth="6*" align="center"/>
32540 <colspec colwidth="6*" align="center"/>
32541 <colspec colwidth="6*" align="right"/>
32542 <tbody>
32543 <row>
32544 <entry><option>address_test</option></entry>
32545 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32546 <entry>Type: <emphasis>boolean</emphasis></entry>
32547 <entry>Default: <emphasis>true</emphasis></entry>
32548 </row>
32549 </tbody>
32550 </tgroup>
32551 </informaltable>
32552 <para>
32553 <indexterm role="option">
32554 <primary><option>-bt</option></primary>
32555 </indexterm>
32556 <indexterm role="concept">
32557 <primary>router</primary>
32558 <secondary>skipping when address testing</secondary>
32559 </indexterm>
32560 If this option is set false, the router is skipped when routing is being tested
32561 by means of the <option>-bt</option> command line option. This can be a convenience when
32562 your first router sends messages to an external scanner, because it saves you
32563 having to set the <quote>already scanned</quote> indicator when testing real address
32564 routing.
32565 </para>
32566 <para>
32567 <indexterm role="option">
32568 <primary><option>cannot_route_message</option></primary>
32569 </indexterm>
32570 </para>
32571 <informaltable frame="all">
32572 <tgroup cols="4" colsep="0" rowsep="0">
32573 <colspec colwidth="8*" align="left"/>
32574 <colspec colwidth="6*" align="center"/>
32575 <colspec colwidth="6*" align="center"/>
32576 <colspec colwidth="6*" align="right"/>
32577 <tbody>
32578 <row>
32579 <entry><option>cannot_route_message</option></entry>
32580 <entry>Use: <emphasis>routers</emphasis></entry>
32581 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32582 <entry>Default: <emphasis>unset</emphasis></entry>
32583 </row>
32584 </tbody>
32585 </tgroup>
32586 </informaltable>
32587 <para>
32588 <indexterm role="concept">
32589 <primary>router</primary>
32590 <secondary>customizing <quote>cannot route</quote> message</secondary>
32591 </indexterm>
32592 <indexterm role="concept">
32593 <primary>customizing</primary>
32594 <secondary><quote>cannot route</quote> message</secondary>
32595 </indexterm>
32596 This option specifies a text message that is used when an address cannot be
32597 routed because Exim has run out of routers. The default message is
32598 <quote>Unrouteable address</quote>. This option is useful only on routers that have
32599 <option>more</option> set false, or on the very last router in a configuration, because the
32600 value that is used is taken from the last router that is considered. This
32601 includes a router that is skipped because its preconditions are not met, as
32602 well as a router that declines. For example, using the default configuration,
32603 you could put:
32604 </para>
32605 <literallayout class="monospaced">
32606 cannot_route_message = Remote domain not found in DNS
32607 </literallayout>
32608 <para>
32609 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
32610 and
32611 </para>
32612 <literallayout class="monospaced">
32613 cannot_route_message = Unknown local user
32614 </literallayout>
32615 <para>
32616 on the final router that checks for local users. If string expansion fails for
32617 this option, the default message is used. Unless the expansion failure was
32618 explicitly forced, a message about the failure is written to the main and panic
32619 logs, in addition to the normal message about the routing failure.
32620 </para>
32621 <para>
32622 <indexterm role="option">
32623 <primary><option>caseful_local_part</option></primary>
32624 </indexterm>
32625 </para>
32626 <informaltable frame="all">
32627 <tgroup cols="4" colsep="0" rowsep="0">
32628 <colspec colwidth="8*" align="left"/>
32629 <colspec colwidth="6*" align="center"/>
32630 <colspec colwidth="6*" align="center"/>
32631 <colspec colwidth="6*" align="right"/>
32632 <tbody>
32633 <row>
32634 <entry><option>caseful_local_part</option></entry>
32635 <entry>Use: <emphasis>routers</emphasis></entry>
32636 <entry>Type: <emphasis>boolean</emphasis></entry>
32637 <entry>Default: <emphasis>false</emphasis></entry>
32638 </row>
32639 </tbody>
32640 </tgroup>
32641 </informaltable>
32642 <para>
32643 <indexterm role="concept">
32644 <primary>case of local parts</primary>
32645 </indexterm>
32646 <indexterm role="concept">
32647 <primary>router</primary>
32648 <secondary>case of local parts</secondary>
32649 </indexterm>
32650 By default, routers handle the local parts of addresses in a case-insensitive
32651 manner, though the actual case is preserved for transmission with the message.
32652 If you want the case of letters to be significant in a router, you must set
32653 this option true. For individual router options that contain address or local
32654 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
32655 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
32656 more details.
32657 </para>
32658 <para>
32659 <indexterm role="variable">
32660 <primary><varname>$local_part</varname></primary>
32661 </indexterm>
32662 <indexterm role="variable">
32663 <primary><varname>$original_local_part</varname></primary>
32664 </indexterm>
32665 <indexterm role="variable">
32666 <primary><varname>$parent_local_part</varname></primary>
32667 </indexterm>
32668 The value of the <varname>$local_part</varname> variable is forced to lower case while a
32669 router is running unless <option>caseful_local_part</option> is set. When a router assigns
32670 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
32671 is the same as it was in the router. Similarly, when a router generates child
32672 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
32673 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
32674 </para>
32675 <para>
32676 This option applies to the processing of an address by a router. When a
32677 recipient address is being processed in an ACL, there is a separate <option>control</option>
32678 modifier that can be used to specify case-sensitive processing within the ACL
32679 (see section <xref linkend="SECTcontrols"/>).
32680 </para>
32681 <para>
32682 <indexterm role="option">
32683 <primary><option>check_local_user</option></primary>
32684 </indexterm>
32685 </para>
32686 <informaltable frame="all">
32687 <tgroup cols="4" colsep="0" rowsep="0">
32688 <colspec colwidth="8*" align="left"/>
32689 <colspec colwidth="6*" align="center"/>
32690 <colspec colwidth="6*" align="center"/>
32691 <colspec colwidth="6*" align="right"/>
32692 <tbody>
32693 <row>
32694 <entry><option>check_local_user</option></entry>
32695 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32696 <entry>Type: <emphasis>boolean</emphasis></entry>
32697 <entry>Default: <emphasis>false</emphasis></entry>
32698 </row>
32699 </tbody>
32700 </tgroup>
32701 </informaltable>
32702 <para>
32703 <indexterm role="concept">
32704 <primary>local user, checking in router</primary>
32705 </indexterm>
32706 <indexterm role="concept">
32707 <primary>router</primary>
32708 <secondary>checking for local user</secondary>
32709 </indexterm>
32710 <indexterm role="concept">
32711 <primary><filename>/etc/passwd</filename></primary>
32712 </indexterm>
32713 <indexterm role="variable">
32714 <primary><varname>$home</varname></primary>
32715 </indexterm>
32716 When this option is true, Exim checks that the local part of the recipient
32717 address (with affixes removed if relevant) is the name of an account on the
32718 local system. The check is done by calling the <function>getpwnam()</function> function rather
32719 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
32720 holding password data (such as NIS) are supported. If the local part is a local
32721 user, <varname>$home</varname> is set from the password data, and can be tested in other
32722 preconditions that are evaluated after this one (the order of evaluation is
32723 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
32724 overridden by <option>router_home_directory</option>. If the local part is not a local user,
32725 the router is skipped.
32726 </para>
32727 <para>
32728 If you want to check that the local part is either the name of a local user
32729 or matches something else, you cannot combine <option>check_local_user</option> with a
32730 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
32731 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
32732 setting to achieve this. For example:
32733 </para>
32734 <literallayout class="monospaced">
32735 local_parts = passwd;$local_part : lsearch;/etc/other/users
32736 </literallayout>
32737 <para>
32738 Note, however, that the side effects of <option>check_local_user</option> (such as setting
32739 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
32740 <option>local_parts</option> (or any other) precondition.
32741 </para>
32742 <para>
32743 <indexterm role="option">
32744 <primary><option>condition</option></primary>
32745 </indexterm>
32746 </para>
32747 <informaltable frame="all">
32748 <tgroup cols="4" colsep="0" rowsep="0">
32749 <colspec colwidth="8*" align="left"/>
32750 <colspec colwidth="6*" align="center"/>
32751 <colspec colwidth="6*" align="center"/>
32752 <colspec colwidth="6*" align="right"/>
32753 <tbody>
32754 <row>
32755 <entry><option>condition</option></entry>
32756 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
32757 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32758 <entry>Default: <emphasis>unset</emphasis></entry>
32759 </row>
32760 </tbody>
32761 </tgroup>
32762 </informaltable>
32763 <para>
32764 <indexterm role="concept">
32765 <primary>router</primary>
32766 <secondary>customized precondition</secondary>
32767 </indexterm>
32768 This option specifies a general precondition test that has to succeed for the
32769 router to be called. The <option>condition</option> option is the last precondition to be
32770 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
32771 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
32772 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
32773 router is skipped, and the address is offered to the next one.
32774 </para>
32775 <para>
32776 If the result is any other value, the router is run (as this is the last
32777 precondition to be evaluated, all the other preconditions must be true).
32778 </para>
32779 <para>
32780 This option is unusual in that multiple <option>condition</option> options may be present.
32781 All <option>condition</option> options must succeed.
32782 </para>
32783 <para>
32784 The <option>condition</option> option provides a means of applying custom conditions to the
32785 running of routers. Note that in the case of a simple conditional expansion,
32786 the default expansion values are exactly what is wanted. For example:
32787 </para>
32788 <literallayout class="monospaced">
32789 condition = ${if &gt;{$message_age}{600}}
32790 </literallayout>
32791 <para>
32792 Because of the default behaviour of the string expansion, this is equivalent to
32793 </para>
32794 <literallayout class="monospaced">
32795 condition = ${if &gt;{$message_age}{600}{true}{}}
32796 </literallayout>
32797 <para>
32798 A multiple condition example, which succeeds:
32799 </para>
32800 <literallayout class="monospaced">
32801 condition = ${if &gt;{$message_age}{600}}
32802 condition = ${if !eq{${lc:$local_part}}{postmaster}}
32803 condition = foobar
32804 </literallayout>
32805 <para>
32806 If the expansion fails (other than forced failure) delivery is deferred. Some
32807 of the other precondition options are common special cases that could in fact
32808 be specified using <option>condition</option>.
32809 </para>
32810 <para>
32811 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
32812 are far older, and use one set of semantics.  ACLs are newer and when
32813 they were created, the ACL <option>condition</option> process was given far stricter
32814 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
32815 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
32816 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
32817 Router rules processing behavior.
32818 </para>
32819 <para>
32820 This is best illustrated in an example:
32821 </para>
32822 <literallayout class="monospaced">
32823 # If used in an ACL condition will fail with a syntax error, but
32824 # in a router condition any extra characters are treated as a string
32825
32826 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
32827 true {yes} {no}}
32828
32829 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
32830  {yes} {no}}
32831 </literallayout>
32832 <para>
32833 In each example above, the <option>if</option> statement actually ends after
32834 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
32835 default <option>if</option> behavior is to return a boolean true or a null answer
32836 (which evaluates to false). The rest of the line is then treated as a
32837 string. So the first example resulted in the boolean answer <quote>true</quote>
32838 with the string <quote> {yes} {no}}</quote> appended to it. The second example
32839 resulted in the null output (indicating false) with the string
32840 <quote> {yes} {no}}</quote> appended to it.
32841 </para>
32842 <para>
32843 In fact you can put excess forward braces in too.  In the router
32844 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
32845 mean something, like after a <quote>$</quote> or when required as part of a
32846 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
32847 string characters.
32848 </para>
32849 <para>
32850 Thus, in a Router, the above expansion strings will both always evaluate
32851 true, as the result of expansion is a non-empty string which doesn&#x2019;t
32852 match an explicit false value.  This can be tricky to debug.  By
32853 contrast, in an ACL either of those strings will always result in an
32854 expansion error because the result doesn&#x2019;t look sufficiently boolean.
32855 </para>
32856 <para>
32857 <indexterm role="option">
32858 <primary><option>debug_print</option></primary>
32859 </indexterm>
32860 </para>
32861 <informaltable frame="all">
32862 <tgroup cols="4" colsep="0" rowsep="0">
32863 <colspec colwidth="8*" align="left"/>
32864 <colspec colwidth="6*" align="center"/>
32865 <colspec colwidth="6*" align="center"/>
32866 <colspec colwidth="6*" align="right"/>
32867 <tbody>
32868 <row>
32869 <entry><option>debug_print</option></entry>
32870 <entry>Use: <emphasis>routers</emphasis></entry>
32871 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32872 <entry>Default: <emphasis>unset</emphasis></entry>
32873 </row>
32874 </tbody>
32875 </tgroup>
32876 </informaltable>
32877 <para>
32878 <indexterm role="concept">
32879 <primary>testing</primary>
32880 <secondary>variables in drivers</secondary>
32881 </indexterm>
32882 If this option is set and debugging is enabled (see the <option>-d</option> command line
32883 option) or in address-testing mode (see the <option>-bt</option> command line option),
32884 the string is expanded and included in the debugging output.
32885 If expansion of the string fails, the error message is written to the debugging
32886 output, and Exim carries on processing.
32887 This option is provided to help with checking out the values of variables and
32888 so on when debugging router configurations. For example, if a <option>condition</option>
32889 option appears not to be working, <option>debug_print</option> can be used to output the
32890 variables it references. The output happens after checks for <option>domains</option>,
32891 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
32892 are tested. A newline is added to the text if it does not end with one.
32893 The variable <varname>$router_name</varname> contains the name of the router.
32894 </para>
32895 <para>
32896 <indexterm role="option">
32897 <primary><option>disable_logging</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>disable_logging</option></entry>
32909 <entry>Use: <emphasis>routers</emphasis></entry>
32910 <entry>Type: <emphasis>boolean</emphasis></entry>
32911 <entry>Default: <emphasis>false</emphasis></entry>
32912 </row>
32913 </tbody>
32914 </tgroup>
32915 </informaltable>
32916 <para>
32917 If this option is set true, nothing is logged for any routing errors
32918 or for any deliveries caused by this router. You should not set this option
32919 unless you really, really know what you are doing. See also the generic
32920 transport option of the same name.
32921 </para>
32922 <para>
32923 <indexterm role="option">
32924 <primary><option>dnssec_request_domains</option></primary>
32925 </indexterm>
32926 </para>
32927 <informaltable frame="all">
32928 <tgroup cols="4" colsep="0" rowsep="0">
32929 <colspec colwidth="8*" align="left"/>
32930 <colspec colwidth="6*" align="center"/>
32931 <colspec colwidth="6*" align="center"/>
32932 <colspec colwidth="6*" align="right"/>
32933 <tbody>
32934 <row>
32935 <entry><option>dnssec_request_domains</option></entry>
32936 <entry>Use: <emphasis>routers</emphasis></entry>
32937 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32938 <entry>Default: <emphasis>unset</emphasis></entry>
32939 </row>
32940 </tbody>
32941 </tgroup>
32942 </informaltable>
32943 <para>
32944 <indexterm role="concept">
32945 <primary>MX record</primary>
32946 <secondary>security</secondary>
32947 </indexterm>
32948 <indexterm role="concept">
32949 <primary>DNSSEC</primary>
32950 <secondary>MX lookup</secondary>
32951 </indexterm>
32952 <indexterm role="concept">
32953 <primary>security</primary>
32954 <secondary>MX lookup</secondary>
32955 </indexterm>
32956 <indexterm role="concept">
32957 <primary>DNS</primary>
32958 <secondary>DNSSEC</secondary>
32959 </indexterm>
32960 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
32961 the dnssec request bit set.
32962 This applies to all of the SRV, MX, AAAA, A lookup sequence.
32963 </para>
32964 <para>
32965 <indexterm role="option">
32966 <primary><option>dnssec_require_domains</option></primary>
32967 </indexterm>
32968 </para>
32969 <informaltable frame="all">
32970 <tgroup cols="4" colsep="0" rowsep="0">
32971 <colspec colwidth="8*" align="left"/>
32972 <colspec colwidth="6*" align="center"/>
32973 <colspec colwidth="6*" align="center"/>
32974 <colspec colwidth="6*" align="right"/>
32975 <tbody>
32976 <row>
32977 <entry><option>dnssec_require_domains</option></entry>
32978 <entry>Use: <emphasis>routers</emphasis></entry>
32979 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32980 <entry>Default: <emphasis>unset</emphasis></entry>
32981 </row>
32982 </tbody>
32983 </tgroup>
32984 </informaltable>
32985 <para>
32986 <indexterm role="concept">
32987 <primary>MX record</primary>
32988 <secondary>security</secondary>
32989 </indexterm>
32990 <indexterm role="concept">
32991 <primary>DNSSEC</primary>
32992 <secondary>MX lookup</secondary>
32993 </indexterm>
32994 <indexterm role="concept">
32995 <primary>security</primary>
32996 <secondary>MX lookup</secondary>
32997 </indexterm>
32998 <indexterm role="concept">
32999 <primary>DNS</primary>
33000 <secondary>DNSSEC</secondary>
33001 </indexterm>
33002 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
33003 the dnssec request bit set.  Any returns not having the Authenticated Data bit
33004 (AD bit) set will be ignored and logged as a host-lookup failure.
33005 This applies to all of the SRV, MX, AAAA, A lookup sequence.
33006 </para>
33007 <para>
33008 <indexterm role="option">
33009 <primary><option>domains</option></primary>
33010 </indexterm>
33011 </para>
33012 <informaltable frame="all">
33013 <tgroup cols="4" colsep="0" rowsep="0">
33014 <colspec colwidth="8*" align="left"/>
33015 <colspec colwidth="6*" align="center"/>
33016 <colspec colwidth="6*" align="center"/>
33017 <colspec colwidth="6*" align="right"/>
33018 <tbody>
33019 <row>
33020 <entry><option>domains</option></entry>
33021 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33022 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
33023 <entry>Default: <emphasis>unset</emphasis></entry>
33024 </row>
33025 </tbody>
33026 </tgroup>
33027 </informaltable>
33028 <para>
33029 <indexterm role="concept">
33030 <primary>router</primary>
33031 <secondary>restricting to specific domains</secondary>
33032 </indexterm>
33033 <indexterm role="variable">
33034 <primary><varname>$domain_data</varname></primary>
33035 </indexterm>
33036 If this option is set, the router is skipped unless the current domain matches
33037 the list. If the match is achieved by means of a file lookup, the data that the
33038 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
33039 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
33040 a list of the order in which preconditions are evaluated.
33041 </para>
33042 <para>
33043 <indexterm role="option">
33044 <primary><option>driver</option></primary>
33045 </indexterm>
33046 </para>
33047 <informaltable frame="all">
33048 <tgroup cols="4" colsep="0" rowsep="0">
33049 <colspec colwidth="8*" align="left"/>
33050 <colspec colwidth="6*" align="center"/>
33051 <colspec colwidth="6*" align="center"/>
33052 <colspec colwidth="6*" align="right"/>
33053 <tbody>
33054 <row>
33055 <entry><option>driver</option></entry>
33056 <entry>Use: <emphasis>routers</emphasis></entry>
33057 <entry>Type: <emphasis>string</emphasis></entry>
33058 <entry>Default: <emphasis>unset</emphasis></entry>
33059 </row>
33060 </tbody>
33061 </tgroup>
33062 </informaltable>
33063 <para>
33064 This option must always be set. It specifies which of the available routers is
33065 to be used.
33066 </para>
33067 <para>
33068 <indexterm role="option">
33069 <primary><option>dsn_lasthop</option></primary>
33070 </indexterm>
33071 </para>
33072 <informaltable frame="all">
33073 <tgroup cols="4" colsep="0" rowsep="0">
33074 <colspec colwidth="8*" align="left"/>
33075 <colspec colwidth="6*" align="center"/>
33076 <colspec colwidth="6*" align="center"/>
33077 <colspec colwidth="6*" align="right"/>
33078 <tbody>
33079 <row>
33080 <entry><option>dsn_lasthop</option></entry>
33081 <entry>Use: <emphasis>routers</emphasis></entry>
33082 <entry>Type: <emphasis>boolean</emphasis></entry>
33083 <entry>Default: <emphasis>false</emphasis></entry>
33084 </row>
33085 </tbody>
33086 </tgroup>
33087 </informaltable>
33088 <para>
33089 <indexterm role="concept">
33090 <primary>DSN</primary>
33091 <secondary>success</secondary>
33092 </indexterm>
33093 <indexterm role="concept">
33094 <primary>Delivery Status Notification</primary>
33095 <secondary>success</secondary>
33096 </indexterm>
33097 If this option is set true, and extended DSN (RFC3461) processing is in effect,
33098 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
33099 instead send a success DSN as if the next hop does not support DSN.
33100 Not effective on redirect routers.
33101 </para>
33102 <para>
33103 <indexterm role="option">
33104 <primary><option>errors_to</option></primary>
33105 </indexterm>
33106 </para>
33107 <informaltable frame="all">
33108 <tgroup cols="4" colsep="0" rowsep="0">
33109 <colspec colwidth="8*" align="left"/>
33110 <colspec colwidth="6*" align="center"/>
33111 <colspec colwidth="6*" align="center"/>
33112 <colspec colwidth="6*" align="right"/>
33113 <tbody>
33114 <row>
33115 <entry><option>errors_to</option></entry>
33116 <entry>Use: <emphasis>routers</emphasis></entry>
33117 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33118 <entry>Default: <emphasis>unset</emphasis></entry>
33119 </row>
33120 </tbody>
33121 </tgroup>
33122 </informaltable>
33123 <para>
33124 <indexterm role="concept">
33125 <primary>envelope sender</primary>
33126 </indexterm>
33127 <indexterm role="concept">
33128 <primary>router</primary>
33129 <secondary>changing address for errors</secondary>
33130 </indexterm>
33131 If a router successfully handles an address, it may assign the address to a
33132 transport for delivery or it may generate child addresses. In both cases, if
33133 there is a delivery problem during later processing, the resulting bounce
33134 message is sent to the address that results from expanding this string,
33135 provided that the address verifies successfully. The <option>errors_to</option> option is
33136 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
33137 </para>
33138 <para>
33139 The <option>errors_to</option> setting associated with an address can be overridden if it
33140 subsequently passes through other routers that have their own <option>errors_to</option>
33141 settings, or if the message is delivered by a transport with a <option>return_path</option>
33142 setting.
33143 </para>
33144 <para>
33145 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
33146 the expansion fails to verify, the errors address associated with the incoming
33147 address is used. At top level, this is the envelope sender. A non-forced
33148 expansion failure causes delivery to be deferred.
33149 </para>
33150 <para>
33151 If an address for which <option>errors_to</option> has been set ends up being delivered over
33152 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
33153 any bounces that are generated by other MTAs on the delivery route are also
33154 sent there. You can set <option>errors_to</option> to the empty string by either of these
33155 settings:
33156 </para>
33157 <literallayout class="monospaced">
33158 errors_to =
33159 errors_to = ""
33160 </literallayout>
33161 <para>
33162 An expansion item that yields an empty string has the same effect. If you do
33163 this, a locally detected delivery error for addresses processed by this router
33164 no longer gives rise to a bounce message; the error is discarded. If the
33165 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
33166 overridden by the <option>return_path</option> option on the transport.
33167 </para>
33168 <para>
33169 <indexterm role="variable">
33170 <primary><varname>$address_data</varname></primary>
33171 </indexterm>
33172 If for some reason you want to discard local errors, but use a non-empty
33173 MAIL command for remote delivery, you can preserve the original return
33174 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
33175 setting <option>return_path</option>.
33176 </para>
33177 <para>
33178 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
33179 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
33180 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
33181 </para>
33182 <para>
33183 <indexterm role="option">
33184 <primary><option>expn</option></primary>
33185 </indexterm>
33186 </para>
33187 <informaltable frame="all">
33188 <tgroup cols="4" colsep="0" rowsep="0">
33189 <colspec colwidth="8*" align="left"/>
33190 <colspec colwidth="6*" align="center"/>
33191 <colspec colwidth="6*" align="center"/>
33192 <colspec colwidth="6*" align="right"/>
33193 <tbody>
33194 <row>
33195 <entry><option>expn</option></entry>
33196 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33197 <entry>Type: <emphasis>boolean</emphasis></entry>
33198 <entry>Default: <emphasis>true</emphasis></entry>
33199 </row>
33200 </tbody>
33201 </tgroup>
33202 </informaltable>
33203 <para>
33204 <indexterm role="concept">
33205 <primary>address</primary>
33206 <secondary>testing</secondary>
33207 </indexterm>
33208 <indexterm role="concept">
33209 <primary>testing</primary>
33210 <secondary>addresses</secondary>
33211 </indexterm>
33212 <indexterm role="concept">
33213 <primary>EXPN</primary>
33214 <secondary>router skipping</secondary>
33215 </indexterm>
33216 <indexterm role="concept">
33217 <primary>router</primary>
33218 <secondary>skipping for EXPN</secondary>
33219 </indexterm>
33220 If this option is turned off, the router is skipped when testing an address
33221 as a result of processing an SMTP EXPN command. You might, for example,
33222 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
33223 on for the system alias file.
33224 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33225 are evaluated.
33226 </para>
33227 <para>
33228 The use of the SMTP EXPN command is controlled by an ACL (see chapter
33229 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
33230 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
33231 </para>
33232 <para>
33233 <indexterm role="option">
33234 <primary><option>fail_verify</option></primary>
33235 </indexterm>
33236 </para>
33237 <informaltable frame="all">
33238 <tgroup cols="4" colsep="0" rowsep="0">
33239 <colspec colwidth="8*" align="left"/>
33240 <colspec colwidth="6*" align="center"/>
33241 <colspec colwidth="6*" align="center"/>
33242 <colspec colwidth="6*" align="right"/>
33243 <tbody>
33244 <row>
33245 <entry><option>fail_verify</option></entry>
33246 <entry>Use: <emphasis>routers</emphasis></entry>
33247 <entry>Type: <emphasis>boolean</emphasis></entry>
33248 <entry>Default: <emphasis>false</emphasis></entry>
33249 </row>
33250 </tbody>
33251 </tgroup>
33252 </informaltable>
33253 <para>
33254 <indexterm role="concept">
33255 <primary>router</primary>
33256 <secondary>forcing verification failure</secondary>
33257 </indexterm>
33258 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
33259 <option>fail_verify_recipient</option> to the same value.
33260 </para>
33261 <para>
33262 <indexterm role="option">
33263 <primary><option>fail_verify_recipient</option></primary>
33264 </indexterm>
33265 </para>
33266 <informaltable frame="all">
33267 <tgroup cols="4" colsep="0" rowsep="0">
33268 <colspec colwidth="8*" align="left"/>
33269 <colspec colwidth="6*" align="center"/>
33270 <colspec colwidth="6*" align="center"/>
33271 <colspec colwidth="6*" align="right"/>
33272 <tbody>
33273 <row>
33274 <entry><option>fail_verify_recipient</option></entry>
33275 <entry>Use: <emphasis>routers</emphasis></entry>
33276 <entry>Type: <emphasis>boolean</emphasis></entry>
33277 <entry>Default: <emphasis>false</emphasis></entry>
33278 </row>
33279 </tbody>
33280 </tgroup>
33281 </informaltable>
33282 <para>
33283 If this option is true and an address is accepted by this router when
33284 verifying a recipient, verification fails.
33285 </para>
33286 <para>
33287 <indexterm role="option">
33288 <primary><option>fail_verify_sender</option></primary>
33289 </indexterm>
33290 </para>
33291 <informaltable frame="all">
33292 <tgroup cols="4" colsep="0" rowsep="0">
33293 <colspec colwidth="8*" align="left"/>
33294 <colspec colwidth="6*" align="center"/>
33295 <colspec colwidth="6*" align="center"/>
33296 <colspec colwidth="6*" align="right"/>
33297 <tbody>
33298 <row>
33299 <entry><option>fail_verify_sender</option></entry>
33300 <entry>Use: <emphasis>routers</emphasis></entry>
33301 <entry>Type: <emphasis>boolean</emphasis></entry>
33302 <entry>Default: <emphasis>false</emphasis></entry>
33303 </row>
33304 </tbody>
33305 </tgroup>
33306 </informaltable>
33307 <para>
33308 If this option is true and an address is accepted by this router when
33309 verifying a sender, verification fails.
33310 </para>
33311 <para>
33312 <indexterm role="option">
33313 <primary><option>fallback_hosts</option></primary>
33314 </indexterm>
33315 </para>
33316 <informaltable frame="all">
33317 <tgroup cols="4" colsep="0" rowsep="0">
33318 <colspec colwidth="8*" align="left"/>
33319 <colspec colwidth="6*" align="center"/>
33320 <colspec colwidth="6*" align="center"/>
33321 <colspec colwidth="6*" align="right"/>
33322 <tbody>
33323 <row>
33324 <entry><option>fallback_hosts</option></entry>
33325 <entry>Use: <emphasis>routers</emphasis></entry>
33326 <entry>Type: <emphasis>string list</emphasis></entry>
33327 <entry>Default: <emphasis>unset</emphasis></entry>
33328 </row>
33329 </tbody>
33330 </tgroup>
33331 </informaltable>
33332 <para>
33333 <indexterm role="concept">
33334 <primary>router</primary>
33335 <secondary>fallback hosts</secondary>
33336 </indexterm>
33337 <indexterm role="concept">
33338 <primary>fallback</primary>
33339 <secondary>hosts specified on router</secondary>
33340 </indexterm>
33341 String expansion is not applied to this option. The argument must be a
33342 colon-separated list of host names or IP addresses. The list separator can be
33343 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
33344 each name or address. In fact, the format of each item is exactly the same as
33345 defined for the list of hosts in a <command>manualroute</command> router (see section
33346 <xref linkend="SECTformatonehostitem"/>).
33347 </para>
33348 <para>
33349 If a router queues an address for a remote transport, this host list is
33350 associated with the address, and used instead of the transport&#x2019;s fallback host
33351 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
33352 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
33353 transport for further details.
33354 </para>
33355 <para>
33356 <indexterm role="option">
33357 <primary><option>group</option></primary>
33358 </indexterm>
33359 </para>
33360 <informaltable frame="all">
33361 <tgroup cols="4" colsep="0" rowsep="0">
33362 <colspec colwidth="8*" align="left"/>
33363 <colspec colwidth="6*" align="center"/>
33364 <colspec colwidth="6*" align="center"/>
33365 <colspec colwidth="6*" align="right"/>
33366 <tbody>
33367 <row>
33368 <entry><option>group</option></entry>
33369 <entry>Use: <emphasis>routers</emphasis></entry>
33370 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33371 <entry>Default: <emphasis>see below</emphasis></entry>
33372 </row>
33373 </tbody>
33374 </tgroup>
33375 </informaltable>
33376 <para>
33377 <indexterm role="concept">
33378 <primary>gid (group id)</primary>
33379 <secondary>local delivery</secondary>
33380 </indexterm>
33381 <indexterm role="concept">
33382 <primary>local transports</primary>
33383 <secondary>uid and gid</secondary>
33384 </indexterm>
33385 <indexterm role="concept">
33386 <primary>transport</primary>
33387 <secondary>local</secondary>
33388 </indexterm>
33389 <indexterm role="concept">
33390 <primary>router</primary>
33391 <secondary>setting group</secondary>
33392 </indexterm>
33393 When a router queues an address for a transport, and the transport does not
33394 specify a group, the group given here is used when running the delivery
33395 process.
33396 The group may be specified numerically or by name. If expansion fails, the
33397 error is logged and delivery is deferred.
33398 The default is unset, unless <option>check_local_user</option> is set, when the default
33399 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
33400 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
33401 </para>
33402 <para>
33403 <indexterm role="option">
33404 <primary><option>headers_add</option></primary>
33405 </indexterm>
33406 </para>
33407 <informaltable frame="all">
33408 <tgroup cols="4" colsep="0" rowsep="0">
33409 <colspec colwidth="8*" align="left"/>
33410 <colspec colwidth="6*" align="center"/>
33411 <colspec colwidth="6*" align="center"/>
33412 <colspec colwidth="6*" align="right"/>
33413 <tbody>
33414 <row>
33415 <entry><option>headers_add</option></entry>
33416 <entry>Use: <emphasis>routers</emphasis></entry>
33417 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33418 <entry>Default: <emphasis>unset</emphasis></entry>
33419 </row>
33420 </tbody>
33421 </tgroup>
33422 </informaltable>
33423 <para>
33424 <indexterm role="concept">
33425 <primary>header lines</primary>
33426 <secondary>adding</secondary>
33427 </indexterm>
33428 <indexterm role="concept">
33429 <primary>router</primary>
33430 <secondary>adding header lines</secondary>
33431 </indexterm>
33432 This option specifies a list of text headers,
33433 newline-separated (by default, changeable in the usual way),
33434 that is associated with any addresses that are accepted by the router.
33435 Each item is separately expanded, at routing time.  However, this
33436 option has no effect when an address is just being verified. The way in which
33437 the text is used to add header lines at transport time is described in section
33438 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
33439 message is in the process of being transported. This means that references to
33440 header lines in string expansions in the transport&#x2019;s configuration do not
33441 <quote>see</quote> the added header lines.
33442 </para>
33443 <para>
33444 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
33445 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
33446 an item expansion is forced to fail, the item has no effect. Other expansion
33447 failures are treated as configuration errors.
33448 </para>
33449 <para>
33450 Unlike most options, <option>headers_add</option> can be specified multiple times
33451 for a router; all listed headers are added.
33452 </para>
33453 <para>
33454 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
33455 router that has the <option>one_time</option> option set.
33456 </para>
33457 <para>
33458 <indexterm role="concept">
33459 <primary>duplicate addresses</primary>
33460 </indexterm>
33461 <indexterm role="option">
33462 <primary><option>unseen</option></primary>
33463 </indexterm>
33464 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33465 additions are deleted when the address is passed on to subsequent routers.
33466 For a <option>redirect</option> router, if a generated address is the same as the incoming
33467 address, this can lead to duplicate addresses with different header
33468 modifications. Exim does not do duplicate deliveries (except, in certain
33469 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
33470 which of the duplicates is discarded, so this ambiguous situation should be
33471 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
33472 </para>
33473 <para>
33474 <indexterm role="option">
33475 <primary><option>headers_remove</option></primary>
33476 </indexterm>
33477 </para>
33478 <informaltable frame="all">
33479 <tgroup cols="4" colsep="0" rowsep="0">
33480 <colspec colwidth="8*" align="left"/>
33481 <colspec colwidth="6*" align="center"/>
33482 <colspec colwidth="6*" align="center"/>
33483 <colspec colwidth="6*" align="right"/>
33484 <tbody>
33485 <row>
33486 <entry><option>headers_remove</option></entry>
33487 <entry>Use: <emphasis>routers</emphasis></entry>
33488 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33489 <entry>Default: <emphasis>unset</emphasis></entry>
33490 </row>
33491 </tbody>
33492 </tgroup>
33493 </informaltable>
33494 <para>
33495 <indexterm role="concept">
33496 <primary>header lines</primary>
33497 <secondary>removing</secondary>
33498 </indexterm>
33499 <indexterm role="concept">
33500 <primary>router</primary>
33501 <secondary>removing header lines</secondary>
33502 </indexterm>
33503 This option specifies a list of text headers,
33504 colon-separated (by default, changeable in the usual way),
33505 that is associated with any addresses that are accepted by the router.
33506 Each item is separately expanded, at routing time.  However, this
33507 option has no effect when an address is just being verified. The way in which
33508 the text is used to remove header lines at transport time is described in
33509 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
33510 the message is in the process of being transported. This means that references
33511 to header lines in string expansions in the transport&#x2019;s configuration still
33512 <quote>see</quote> the original header lines.
33513 </para>
33514 <para>
33515 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
33516 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
33517 the item has no effect. Other expansion failures are treated as configuration
33518 errors.
33519 </para>
33520 <para>
33521 Unlike most options, <option>headers_remove</option> can be specified multiple times
33522 for a router; all listed headers are removed.
33523 </para>
33524 <para>
33525 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
33526 router that has the <option>one_time</option> option set.
33527 </para>
33528 <para>
33529 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
33530 removal requests are deleted when the address is passed on to subsequent
33531 routers, and this can lead to problems with duplicates -- see the similar
33532 warning for <option>headers_add</option> above.
33533 </para>
33534 <para>
33535 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
33536 items that contain a list separator must have it doubled.
33537 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
33538 </para>
33539 <para>
33540 <indexterm role="option">
33541 <primary><option>ignore_target_hosts</option></primary>
33542 </indexterm>
33543 </para>
33544 <informaltable frame="all">
33545 <tgroup cols="4" colsep="0" rowsep="0">
33546 <colspec colwidth="8*" align="left"/>
33547 <colspec colwidth="6*" align="center"/>
33548 <colspec colwidth="6*" align="center"/>
33549 <colspec colwidth="6*" align="right"/>
33550 <tbody>
33551 <row>
33552 <entry><option>ignore_target_hosts</option></entry>
33553 <entry>Use: <emphasis>routers</emphasis></entry>
33554 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33555 <entry>Default: <emphasis>unset</emphasis></entry>
33556 </row>
33557 </tbody>
33558 </tgroup>
33559 </informaltable>
33560 <para>
33561 <indexterm role="concept">
33562 <primary>IP address</primary>
33563 <secondary>discarding</secondary>
33564 </indexterm>
33565 <indexterm role="concept">
33566 <primary>router</primary>
33567 <secondary>discarding IP addresses</secondary>
33568 </indexterm>
33569 Although this option is a host list, it should normally contain IP address
33570 entries rather than names. If any host that is looked up by the router has an
33571 IP address that matches an item in this list, Exim behaves as if that IP
33572 address did not exist. This option allows you to cope with rogue DNS entries
33573 like
33574 </para>
33575 <literallayout class="monospaced">
33576 remote.domain.example.  A  127.0.0.1
33577 </literallayout>
33578 <para>
33579 by setting
33580 </para>
33581 <literallayout class="monospaced">
33582 ignore_target_hosts = 127.0.0.1
33583 </literallayout>
33584 <para>
33585 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
33586 discarded in this way, the router declines. In a conventional configuration, an
33587 attempt to mail to such a domain would normally provoke the <quote>unrouteable
33588 domain</quote> error, and an attempt to verify an address in the domain would fail.
33589 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
33590 router declines if presented with one of the listed addresses.
33591 </para>
33592 <para>
33593 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
33594 means of the first or the second of the following settings, respectively:
33595 </para>
33596 <literallayout class="monospaced">
33597 ignore_target_hosts = 0.0.0.0/0
33598 ignore_target_hosts = &lt;; 0::0/0
33599 </literallayout>
33600 <para>
33601 The pattern in the first line matches all IPv4 addresses, whereas the pattern
33602 in the second line matches all IPv6 addresses.
33603 </para>
33604 <para>
33605 This option may also be useful for ignoring link-local and site-local IPv6
33606 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
33607 is expanded before use as a list, it is possible to make it dependent on the
33608 domain that is being routed.
33609 </para>
33610 <para>
33611 <indexterm role="variable">
33612 <primary><varname>$host_address</varname></primary>
33613 </indexterm>
33614 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
33615 checked.
33616 </para>
33617 <para>
33618 <indexterm role="option">
33619 <primary><option>initgroups</option></primary>
33620 </indexterm>
33621 </para>
33622 <informaltable frame="all">
33623 <tgroup cols="4" colsep="0" rowsep="0">
33624 <colspec colwidth="8*" align="left"/>
33625 <colspec colwidth="6*" align="center"/>
33626 <colspec colwidth="6*" align="center"/>
33627 <colspec colwidth="6*" align="right"/>
33628 <tbody>
33629 <row>
33630 <entry><option>initgroups</option></entry>
33631 <entry>Use: <emphasis>routers</emphasis></entry>
33632 <entry>Type: <emphasis>boolean</emphasis></entry>
33633 <entry>Default: <emphasis>false</emphasis></entry>
33634 </row>
33635 </tbody>
33636 </tgroup>
33637 </informaltable>
33638 <para>
33639 <indexterm role="concept">
33640 <primary>additional groups</primary>
33641 </indexterm>
33642 <indexterm role="concept">
33643 <primary>groups</primary>
33644 <secondary>additional</secondary>
33645 </indexterm>
33646 <indexterm role="concept">
33647 <primary>local transports</primary>
33648 <secondary>uid and gid</secondary>
33649 </indexterm>
33650 <indexterm role="concept">
33651 <primary>transport</primary>
33652 <secondary>local</secondary>
33653 </indexterm>
33654 If the router queues an address for a transport, and this option is true, and
33655 the uid supplied by the router is not overridden by the transport, the
33656 <function>initgroups()</function> function is called when running the transport to ensure that
33657 any additional groups associated with the uid are set up. See also <option>group</option>
33658 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
33659 </para>
33660 <para>
33661 <indexterm role="option">
33662 <primary><option>local_part_prefix</option></primary>
33663 </indexterm>
33664 </para>
33665 <informaltable frame="all">
33666 <tgroup cols="4" colsep="0" rowsep="0">
33667 <colspec colwidth="8*" align="left"/>
33668 <colspec colwidth="6*" align="center"/>
33669 <colspec colwidth="6*" align="center"/>
33670 <colspec colwidth="6*" align="right"/>
33671 <tbody>
33672 <row>
33673 <entry><option>local_part_prefix</option></entry>
33674 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33675 <entry>Type: <emphasis>string list</emphasis></entry>
33676 <entry>Default: <emphasis>unset</emphasis></entry>
33677 </row>
33678 </tbody>
33679 </tgroup>
33680 </informaltable>
33681 <para>
33682 <indexterm role="concept">
33683 <primary>router</primary>
33684 <secondary>prefix for local part</secondary>
33685 </indexterm>
33686 <indexterm role="concept">
33687 <primary>prefix</primary>
33688 <secondary>for local part, used in router</secondary>
33689 </indexterm>
33690 If this option is set, the router is skipped unless the local part starts with
33691 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
33692 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
33693 evaluated.
33694 </para>
33695 <para>
33696 The list is scanned from left to right, and the first prefix that matches is
33697 used. A limited form of wildcard is available; if the prefix begins with an
33698 asterisk, it matches the longest possible sequence of arbitrary characters at
33699 the start of the local part. An asterisk should therefore always be followed by
33700 some character that does not occur in normal local parts.
33701 <indexterm role="concept">
33702 <primary>multiple mailboxes</primary>
33703 </indexterm>
33704 <indexterm role="concept">
33705 <primary>mailbox</primary>
33706 <secondary>multiple</secondary>
33707 </indexterm>
33708 Wildcarding can be used to set up multiple user mailboxes, as described in
33709 section <xref linkend="SECTmulbox"/>.
33710 </para>
33711 <para>
33712 <indexterm role="variable">
33713 <primary><varname>$local_part</varname></primary>
33714 </indexterm>
33715 <indexterm role="variable">
33716 <primary><varname>$local_part_prefix</varname></primary>
33717 </indexterm>
33718 During the testing of the <option>local_parts</option> option, and while the router is
33719 running, the prefix is removed from the local part, and is available in the
33720 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
33721 the router accepts the address, this remains true during subsequent delivery by
33722 a transport. In particular, the local part that is transmitted in the RCPT
33723 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
33724 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
33725 the relevant transport.
33726 </para>
33727 <para>
33728 When an address is being verified, <option>local_part_prefix</option> affects only the
33729 behaviour of the router. If the callout feature of verification is in use, this
33730 means that the full address, including the prefix, will be used during the
33731 callout.
33732 </para>
33733 <para>
33734 The prefix facility is commonly used to handle local parts of the form
33735 <option>owner-something</option>. Another common use is to support local parts of the form
33736 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
33737 to tell a user their forwarding is broken &ndash; by placing a router like this one
33738 immediately before the router that handles <filename>.forward</filename> files:
33739 </para>
33740 <literallayout class="monospaced">
33741 real_localuser:
33742   driver = accept
33743   local_part_prefix = real-
33744   check_local_user
33745   transport = local_delivery
33746 </literallayout>
33747 <para>
33748 For security, it would probably be a good idea to restrict the use of this
33749 router to locally-generated messages, using a condition such as this:
33750 </para>
33751 <literallayout class="monospaced">
33752   condition = ${if match {$sender_host_address}\
33753                          {\N^(|127\.0\.0\.1)$\N}}
33754 </literallayout>
33755 <para>
33756 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
33757 both conditions must be met if not optional. Care must be taken if wildcards
33758 are used in both a prefix and a suffix on the same router. Different
33759 separator characters must be used to avoid ambiguity.
33760 </para>
33761 <para>
33762 <indexterm role="option">
33763 <primary><option>local_part_prefix_optional</option></primary>
33764 </indexterm>
33765 </para>
33766 <informaltable frame="all">
33767 <tgroup cols="4" colsep="0" rowsep="0">
33768 <colspec colwidth="8*" align="left"/>
33769 <colspec colwidth="6*" align="center"/>
33770 <colspec colwidth="6*" align="center"/>
33771 <colspec colwidth="6*" align="right"/>
33772 <tbody>
33773 <row>
33774 <entry><option>local_part_prefix_optional</option></entry>
33775 <entry>Use: <emphasis>routers</emphasis></entry>
33776 <entry>Type: <emphasis>boolean</emphasis></entry>
33777 <entry>Default: <emphasis>false</emphasis></entry>
33778 </row>
33779 </tbody>
33780 </tgroup>
33781 </informaltable>
33782 <para>
33783 See <option>local_part_prefix</option> above.
33784 </para>
33785 <para>
33786 <indexterm role="option">
33787 <primary><option>local_part_suffix</option></primary>
33788 </indexterm>
33789 </para>
33790 <informaltable frame="all">
33791 <tgroup cols="4" colsep="0" rowsep="0">
33792 <colspec colwidth="8*" align="left"/>
33793 <colspec colwidth="6*" align="center"/>
33794 <colspec colwidth="6*" align="center"/>
33795 <colspec colwidth="6*" align="right"/>
33796 <tbody>
33797 <row>
33798 <entry><option>local_part_suffix</option></entry>
33799 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33800 <entry>Type: <emphasis>string list</emphasis></entry>
33801 <entry>Default: <emphasis>unset</emphasis></entry>
33802 </row>
33803 </tbody>
33804 </tgroup>
33805 </informaltable>
33806 <para>
33807 <indexterm role="concept">
33808 <primary>router</primary>
33809 <secondary>suffix for local part</secondary>
33810 </indexterm>
33811 <indexterm role="concept">
33812 <primary>suffix for local part</primary>
33813 <secondary>used in router</secondary>
33814 </indexterm>
33815 This option operates in the same way as <option>local_part_prefix</option>, except that the
33816 local part must end (rather than start) with the given string, the
33817 <option>local_part_suffix_optional</option> option determines whether the suffix is
33818 mandatory, and the wildcard * character, if present, must be the last
33819 character of the suffix. This option facility is commonly used to handle local
33820 parts of the form <option>something-request</option> and multiple user mailboxes of the form
33821 <option>username-foo</option>.
33822 </para>
33823 <para>
33824 <indexterm role="option">
33825 <primary><option>local_part_suffix_optional</option></primary>
33826 </indexterm>
33827 </para>
33828 <informaltable frame="all">
33829 <tgroup cols="4" colsep="0" rowsep="0">
33830 <colspec colwidth="8*" align="left"/>
33831 <colspec colwidth="6*" align="center"/>
33832 <colspec colwidth="6*" align="center"/>
33833 <colspec colwidth="6*" align="right"/>
33834 <tbody>
33835 <row>
33836 <entry><option>local_part_suffix_optional</option></entry>
33837 <entry>Use: <emphasis>routers</emphasis></entry>
33838 <entry>Type: <emphasis>boolean</emphasis></entry>
33839 <entry>Default: <emphasis>false</emphasis></entry>
33840 </row>
33841 </tbody>
33842 </tgroup>
33843 </informaltable>
33844 <para>
33845 See <option>local_part_suffix</option> above.
33846 </para>
33847 <para>
33848 <indexterm role="option">
33849 <primary><option>local_parts</option></primary>
33850 </indexterm>
33851 </para>
33852 <informaltable frame="all">
33853 <tgroup cols="4" colsep="0" rowsep="0">
33854 <colspec colwidth="8*" align="left"/>
33855 <colspec colwidth="6*" align="center"/>
33856 <colspec colwidth="6*" align="center"/>
33857 <colspec colwidth="6*" align="right"/>
33858 <tbody>
33859 <row>
33860 <entry><option>local_parts</option></entry>
33861 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
33862 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
33863 <entry>Default: <emphasis>unset</emphasis></entry>
33864 </row>
33865 </tbody>
33866 </tgroup>
33867 </informaltable>
33868 <para>
33869 <indexterm role="concept">
33870 <primary>router</primary>
33871 <secondary>restricting to specific local parts</secondary>
33872 </indexterm>
33873 <indexterm role="concept">
33874 <primary>local part</primary>
33875 <secondary>checking in router</secondary>
33876 </indexterm>
33877 The router is run only if the local part of the address matches the list.
33878 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
33879 are evaluated, and
33880 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
33881 string is expanded, it is possible to make it depend on the domain, for
33882 example:
33883 </para>
33884 <literallayout class="monospaced">
33885 local_parts = dbm;/usr/local/specials/$domain
33886 </literallayout>
33887 <para>
33888 <indexterm role="variable">
33889 <primary><varname>$local_part_data</varname></primary>
33890 </indexterm>
33891 If the match is achieved by a lookup, the data that the lookup returned
33892 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
33893 expansions of the router&#x2019;s private options. You might use this option, for
33894 example, if you have a large number of local virtual domains, and you want to
33895 send all postmaster mail to the same place without having to set up an alias in
33896 each virtual domain:
33897 </para>
33898 <literallayout class="monospaced">
33899 postmaster:
33900   driver = redirect
33901   local_parts = postmaster
33902   data = postmaster@real.domain.example
33903 </literallayout>
33904 <para>
33905 <indexterm role="option">
33906 <primary><option>log_as_local</option></primary>
33907 </indexterm>
33908 </para>
33909 <informaltable frame="all">
33910 <tgroup cols="4" colsep="0" rowsep="0">
33911 <colspec colwidth="8*" align="left"/>
33912 <colspec colwidth="6*" align="center"/>
33913 <colspec colwidth="6*" align="center"/>
33914 <colspec colwidth="6*" align="right"/>
33915 <tbody>
33916 <row>
33917 <entry><option>log_as_local</option></entry>
33918 <entry>Use: <emphasis>routers</emphasis></entry>
33919 <entry>Type: <emphasis>boolean</emphasis></entry>
33920 <entry>Default: <emphasis>see below</emphasis></entry>
33921 </row>
33922 </tbody>
33923 </tgroup>
33924 </informaltable>
33925 <para>
33926 <indexterm role="concept">
33927 <primary>log</primary>
33928 <secondary>delivery line</secondary>
33929 </indexterm>
33930 <indexterm role="concept">
33931 <primary>delivery</primary>
33932 <secondary>log line format</secondary>
33933 </indexterm>
33934 Exim has two logging styles for delivery, the idea being to make local
33935 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
33936 recipient address is given just as the local part, without a domain. The use of
33937 this style is controlled by this option. It defaults to true for the <command>accept</command>
33938 router, and false for all the others. This option applies only when a
33939 router assigns an address to a transport. It has no effect on routers that
33940 redirect addresses.
33941 </para>
33942 <para>
33943 <indexterm role="option">
33944 <primary><option>more</option></primary>
33945 </indexterm>
33946 </para>
33947 <informaltable frame="all">
33948 <tgroup cols="4" colsep="0" rowsep="0">
33949 <colspec colwidth="8*" align="left"/>
33950 <colspec colwidth="6*" align="center"/>
33951 <colspec colwidth="6*" align="center"/>
33952 <colspec colwidth="6*" align="right"/>
33953 <tbody>
33954 <row>
33955 <entry><option>more</option></entry>
33956 <entry>Use: <emphasis>routers</emphasis></entry>
33957 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
33958 <entry>Default: <emphasis>true</emphasis></entry>
33959 </row>
33960 </tbody>
33961 </tgroup>
33962 </informaltable>
33963 <para>
33964 The result of string expansion for this option must be a valid boolean value,
33965 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
33966 result causes an error, and delivery is deferred. If the expansion is forced to
33967 fail, the default value for the option (true) is used. Other failures cause
33968 delivery to be deferred.
33969 </para>
33970 <para>
33971 If this option is set false, and the router declines to handle the address, no
33972 further routers are tried, routing fails, and the address is bounced.
33973 <indexterm role="option">
33974 <primary><option>self</option></primary>
33975 </indexterm>
33976 However, if the router explicitly passes an address to the following router by
33977 means of the setting
33978 </para>
33979 <literallayout class="monospaced">
33980 self = pass
33981 </literallayout>
33982 <para>
33983 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
33984 does not affect the behaviour if one of the precondition tests fails. In that
33985 case, the address is always passed to the next router.
33986 </para>
33987 <para>
33988 Note that <option>address_data</option> is not considered to be a precondition. If its
33989 expansion is forced to fail, the router declines, and the value of <option>more</option>
33990 controls what happens next.
33991 </para>
33992 <para>
33993 <indexterm role="option">
33994 <primary><option>pass_on_timeout</option></primary>
33995 </indexterm>
33996 </para>
33997 <informaltable frame="all">
33998 <tgroup cols="4" colsep="0" rowsep="0">
33999 <colspec colwidth="8*" align="left"/>
34000 <colspec colwidth="6*" align="center"/>
34001 <colspec colwidth="6*" align="center"/>
34002 <colspec colwidth="6*" align="right"/>
34003 <tbody>
34004 <row>
34005 <entry><option>pass_on_timeout</option></entry>
34006 <entry>Use: <emphasis>routers</emphasis></entry>
34007 <entry>Type: <emphasis>boolean</emphasis></entry>
34008 <entry>Default: <emphasis>false</emphasis></entry>
34009 </row>
34010 </tbody>
34011 </tgroup>
34012 </informaltable>
34013 <para>
34014 <indexterm role="concept">
34015 <primary>timeout</primary>
34016 <secondary>of router</secondary>
34017 </indexterm>
34018 <indexterm role="concept">
34019 <primary>router</primary>
34020 <secondary>timeout</secondary>
34021 </indexterm>
34022 If a router times out during a host lookup, it normally causes deferral of the
34023 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
34024 router, overriding <option>no_more</option>. This may be helpful for systems that are
34025 intermittently connected to the Internet, or those that want to pass to a smart
34026 host any messages that cannot immediately be delivered.
34027 </para>
34028 <para>
34029 There are occasional other temporary errors that can occur while doing DNS
34030 lookups. They are treated in the same way as a timeout, and this option
34031 applies to all of them.
34032 </para>
34033 <para>
34034 <indexterm role="option">
34035 <primary><option>pass_router</option></primary>
34036 </indexterm>
34037 </para>
34038 <informaltable frame="all">
34039 <tgroup cols="4" colsep="0" rowsep="0">
34040 <colspec colwidth="8*" align="left"/>
34041 <colspec colwidth="6*" align="center"/>
34042 <colspec colwidth="6*" align="center"/>
34043 <colspec colwidth="6*" align="right"/>
34044 <tbody>
34045 <row>
34046 <entry><option>pass_router</option></entry>
34047 <entry>Use: <emphasis>routers</emphasis></entry>
34048 <entry>Type: <emphasis>string</emphasis></entry>
34049 <entry>Default: <emphasis>unset</emphasis></entry>
34050 </row>
34051 </tbody>
34052 </tgroup>
34053 </informaltable>
34054 <para>
34055 <indexterm role="concept">
34056 <primary>router</primary>
34057 <secondary>go to after <quote>pass</quote></secondary>
34058 </indexterm>
34059 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
34060 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
34061 routing to continue, and overriding a false setting of <option>more</option>. When one of
34062 these routers returns <quote>pass</quote>, the address is normally handed on to the next
34063 router in sequence. This can be changed by setting <option>pass_router</option> to the name
34064 of another router. However (unlike <option>redirect_router</option>) the named router must
34065 be below the current router, to avoid loops. Note that this option applies only
34066 to the special case of <quote>pass</quote>. It does not apply when a router returns
34067 <quote>decline</quote> because it cannot handle an address.
34068 </para>
34069 <para>
34070 <indexterm role="option">
34071 <primary><option>redirect_router</option></primary>
34072 </indexterm>
34073 </para>
34074 <informaltable frame="all">
34075 <tgroup cols="4" colsep="0" rowsep="0">
34076 <colspec colwidth="8*" align="left"/>
34077 <colspec colwidth="6*" align="center"/>
34078 <colspec colwidth="6*" align="center"/>
34079 <colspec colwidth="6*" align="right"/>
34080 <tbody>
34081 <row>
34082 <entry><option>redirect_router</option></entry>
34083 <entry>Use: <emphasis>routers</emphasis></entry>
34084 <entry>Type: <emphasis>string</emphasis></entry>
34085 <entry>Default: <emphasis>unset</emphasis></entry>
34086 </row>
34087 </tbody>
34088 </tgroup>
34089 </informaltable>
34090 <para>
34091 <indexterm role="concept">
34092 <primary>router</primary>
34093 <secondary>start at after redirection</secondary>
34094 </indexterm>
34095 Sometimes an administrator knows that it is pointless to reprocess addresses
34096 generated from alias or forward files with the same router again. For
34097 example, if an alias file translates real names into login ids there is no
34098 point searching the alias file a second time, especially if it is a large file.
34099 </para>
34100 <para>
34101 The <option>redirect_router</option> option can be set to the name of any router instance.
34102 It causes the routing of any generated addresses to start at the named router
34103 instead of at the first router. This option has no effect if the router in
34104 which it is set does not generate new addresses.
34105 </para>
34106 <para>
34107 <indexterm role="option">
34108 <primary><option>require_files</option></primary>
34109 </indexterm>
34110 </para>
34111 <informaltable frame="all">
34112 <tgroup cols="4" colsep="0" rowsep="0">
34113 <colspec colwidth="8*" align="left"/>
34114 <colspec colwidth="6*" align="center"/>
34115 <colspec colwidth="6*" align="center"/>
34116 <colspec colwidth="6*" align="right"/>
34117 <tbody>
34118 <row>
34119 <entry><option>require_files</option></entry>
34120 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34121 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34122 <entry>Default: <emphasis>unset</emphasis></entry>
34123 </row>
34124 </tbody>
34125 </tgroup>
34126 </informaltable>
34127 <para>
34128 <indexterm role="concept">
34129 <primary>file</primary>
34130 <secondary>requiring for router</secondary>
34131 </indexterm>
34132 <indexterm role="concept">
34133 <primary>router</primary>
34134 <secondary>requiring file existence</secondary>
34135 </indexterm>
34136 This option provides a general mechanism for predicating the running of a
34137 router on the existence or non-existence of certain files or directories.
34138 Before running a router, as one of its precondition tests, Exim works its way
34139 through the <option>require_files</option> list, expanding each item separately.
34140 </para>
34141 <para>
34142 Because the list is split before expansion, any colons in expansion items must
34143 be doubled, or the facility for using a different list separator must be used.
34144 If any expansion is forced to fail, the item is ignored. Other expansion
34145 failures cause routing of the address to be deferred.
34146 </para>
34147 <para>
34148 If any expanded string is empty, it is ignored. Otherwise, except as described
34149 below, each string must be a fully qualified file path, optionally preceded by
34150 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
34151 existence of the files or directories. The router is skipped if any paths not
34152 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
34153 </para>
34154 <para>
34155 <indexterm role="concept">
34156 <primary>NFS</primary>
34157 </indexterm>
34158 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
34159 the message is deferred. This can happen when NFS-mounted filesystems are
34160 unavailable.
34161 </para>
34162 <para>
34163 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
34164 options, so you cannot use it to check for the existence of a file in which to
34165 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
34166 full list of the order in which preconditions are evaluated.) However, as
34167 these options are all expanded, you can use the <option>exists</option> expansion condition
34168 to make such tests. The <option>require_files</option> option is intended for checking files
34169 that the router may be going to use internally, or which are needed by a
34170 transport (for example <filename>.procmailrc</filename>).
34171 </para>
34172 <para>
34173 During delivery, the <function>stat()</function> function is run as root, but there is a
34174 facility for some checking of the accessibility of a file by another user.
34175 This is not a proper permissions check, but just a <quote>rough</quote> check that
34176 operates as follows:
34177 </para>
34178 <para>
34179 If an item in a <option>require_files</option> list does not contain any forward slash
34180 characters, it is taken to be the user (and optional group, separated by a
34181 comma) to be checked for subsequent files in the list. If no group is specified
34182 but the user is specified symbolically, the gid associated with the uid is
34183 used. For example:
34184 </para>
34185 <literallayout class="monospaced">
34186 require_files = mail:/some/file
34187 require_files = $local_part:$home/.procmailrc
34188 </literallayout>
34189 <para>
34190 If a user or group name in a <option>require_files</option> list does not exist, the
34191 <option>require_files</option> condition fails.
34192 </para>
34193 <para>
34194 Exim performs the check by scanning along the components of the file path, and
34195 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
34196 directories, and <quote>r</quote> access on the final file. Note that this means that file
34197 access control lists, if the operating system has them, are ignored.
34198 </para>
34199 <para>
34200 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
34201 incoming SMTP message, Exim is not running as root, but under its own uid. This
34202 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
34203 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
34204 user is not permitted to read one of the directories on the file&#x2019;s path.
34205 </para>
34206 <para>
34207 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
34208 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
34209 without root access. In this case, if a check for access by a particular user
34210 is requested, Exim creates a subprocess that runs as that user, and tries the
34211 check again in that process.
34212 </para>
34213 <para>
34214 The default action for handling an unresolved EACCES is to consider it to
34215 be caused by a configuration error, and routing is deferred because the
34216 existence or non-existence of the file cannot be determined. However, in some
34217 circumstances it may be desirable to treat this condition as if the file did
34218 not exist. If the file name (or the exclamation mark that precedes the file
34219 name for non-existence) is preceded by a plus sign, the EACCES error is treated
34220 as if the file did not exist. For example:
34221 </para>
34222 <literallayout class="monospaced">
34223 require_files = +/some/file
34224 </literallayout>
34225 <para>
34226 If the router is not an essential part of verification (for example, it
34227 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
34228 option false so that the router is skipped when verifying.
34229 </para>
34230 <para>
34231 <indexterm role="option">
34232 <primary><option>retry_use_local_part</option></primary>
34233 </indexterm>
34234 </para>
34235 <informaltable frame="all">
34236 <tgroup cols="4" colsep="0" rowsep="0">
34237 <colspec colwidth="8*" align="left"/>
34238 <colspec colwidth="6*" align="center"/>
34239 <colspec colwidth="6*" align="center"/>
34240 <colspec colwidth="6*" align="right"/>
34241 <tbody>
34242 <row>
34243 <entry><option>retry_use_local_part</option></entry>
34244 <entry>Use: <emphasis>routers</emphasis></entry>
34245 <entry>Type: <emphasis>boolean</emphasis></entry>
34246 <entry>Default: <emphasis>see below</emphasis></entry>
34247 </row>
34248 </tbody>
34249 </tgroup>
34250 </informaltable>
34251 <para>
34252 <indexterm role="concept">
34253 <primary>hints database</primary>
34254 <secondary>retry keys</secondary>
34255 </indexterm>
34256 <indexterm role="concept">
34257 <primary>local part</primary>
34258 <secondary>in retry keys</secondary>
34259 </indexterm>
34260 When a delivery suffers a temporary routing failure, a retry record is created
34261 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
34262 domain, the key for the retry record should not involve the local part, but for
34263 other addresses, both the domain and the local part should be included.
34264 Usually, remote routing is of the former kind, and local routing is of the
34265 latter kind.
34266 </para>
34267 <para>
34268 This option controls whether the local part is used to form the key for retry
34269 hints for addresses that suffer temporary errors while being handled by this
34270 router. The default value is true for any router that has <option>check_local_user</option>
34271 set, and false otherwise. Note that this option does not apply to hints keys
34272 for transport delays; they are controlled by a generic transport option of the
34273 same name.
34274 </para>
34275 <para>
34276 The setting of <option>retry_use_local_part</option> applies only to the router on which it
34277 appears. If the router generates child addresses, they are routed
34278 independently; this setting does not become attached to them.
34279 </para>
34280 <para>
34281 <indexterm role="option">
34282 <primary><option>router_home_directory</option></primary>
34283 </indexterm>
34284 </para>
34285 <informaltable frame="all">
34286 <tgroup cols="4" colsep="0" rowsep="0">
34287 <colspec colwidth="8*" align="left"/>
34288 <colspec colwidth="6*" align="center"/>
34289 <colspec colwidth="6*" align="center"/>
34290 <colspec colwidth="6*" align="right"/>
34291 <tbody>
34292 <row>
34293 <entry><option>router_home_directory</option></entry>
34294 <entry>Use: <emphasis>routers</emphasis></entry>
34295 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34296 <entry>Default: <emphasis>unset</emphasis></entry>
34297 </row>
34298 </tbody>
34299 </tgroup>
34300 </informaltable>
34301 <para>
34302 <indexterm role="concept">
34303 <primary>router</primary>
34304 <secondary>home directory for</secondary>
34305 </indexterm>
34306 <indexterm role="concept">
34307 <primary>home directory</primary>
34308 <secondary>for router</secondary>
34309 </indexterm>
34310 <indexterm role="variable">
34311 <primary><varname>$home</varname></primary>
34312 </indexterm>
34313 This option sets a home directory for use while the router is running. (Compare
34314 <option>transport_home_directory</option>, which sets a home directory for later
34315 transporting.) In particular, if used on a <command>redirect</command> router, this option
34316 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
34317 forced expansion failure causes the option to be ignored &ndash; other failures
34318 cause the router to defer.
34319 </para>
34320 <para>
34321 Expansion of <option>router_home_directory</option> happens immediately after the
34322 <option>check_local_user</option> test (if configured), before any further expansions take
34323 place.
34324 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34325 are evaluated.)
34326 While the router is running, <option>router_home_directory</option> overrides the value of
34327 <varname>$home</varname> that came from <option>check_local_user</option>.
34328 </para>
34329 <para>
34330 When a router accepts an address and assigns it to a local transport (including
34331 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
34332 delivery), the home directory setting for the transport is taken from the first
34333 of these values that is set:
34334 </para>
34335 <itemizedlist>
34336 <listitem>
34337 <para>
34338 The <option>home_directory</option> option on the transport;
34339 </para>
34340 </listitem>
34341 <listitem>
34342 <para>
34343 The <option>transport_home_directory</option> option on the router;
34344 </para>
34345 </listitem>
34346 <listitem>
34347 <para>
34348 The password data if <option>check_local_user</option> is set on the router;
34349 </para>
34350 </listitem>
34351 <listitem>
34352 <para>
34353 The <option>router_home_directory</option> option on the router.
34354 </para>
34355 </listitem>
34356 </itemizedlist>
34357 <para>
34358 In other words, <option>router_home_directory</option> overrides the password data for the
34359 router, but not for the transport.
34360 </para>
34361 <para>
34362 <indexterm role="option">
34363 <primary><option>self</option></primary>
34364 </indexterm>
34365 </para>
34366 <informaltable frame="all">
34367 <tgroup cols="4" colsep="0" rowsep="0">
34368 <colspec colwidth="8*" align="left"/>
34369 <colspec colwidth="6*" align="center"/>
34370 <colspec colwidth="6*" align="center"/>
34371 <colspec colwidth="6*" align="right"/>
34372 <tbody>
34373 <row>
34374 <entry><option>self</option></entry>
34375 <entry>Use: <emphasis>routers</emphasis></entry>
34376 <entry>Type: <emphasis>string</emphasis></entry>
34377 <entry>Default: <emphasis>freeze</emphasis></entry>
34378 </row>
34379 </tbody>
34380 </tgroup>
34381 </informaltable>
34382 <para>
34383 <indexterm role="concept">
34384 <primary>MX record</primary>
34385 <secondary>pointing to local host</secondary>
34386 </indexterm>
34387 <indexterm role="concept">
34388 <primary>local host</primary>
34389 <secondary>MX pointing to</secondary>
34390 </indexterm>
34391 This option applies to those routers that use a recipient address to find a
34392 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
34393 and <command>manualroute</command> routers.
34394 Certain configurations of the <command>queryprogram</command> router can also specify a list
34395 of remote hosts.
34396 Usually such routers are configured to send the message to a remote host via an
34397 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
34398 host on the list turns out to be the local host.
34399 The way in which Exim checks for the local host is described in section
34400 <xref linkend="SECTreclocipadd"/>.
34401 </para>
34402 <para>
34403 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
34404 example, the router should be configured not to process this domain), or an
34405 error in the DNS (for example, the MX should not point to this host). For this
34406 reason, the default action is to log the incident, defer the address, and
34407 freeze the message. The following alternatives are provided for use in special
34408 cases:
34409 </para>
34410 <variablelist>
34411 <varlistentry>
34412 <term><option>defer</option></term>
34413 <listitem>
34414 <para>
34415 Delivery of the message is tried again later, but the message is not frozen.
34416 </para>
34417 </listitem></varlistentry>
34418 <varlistentry>
34419 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
34420 <listitem>
34421 <para>
34422 The domain is changed to the given domain, and the address is passed back to
34423 be reprocessed by the routers. No rewriting of headers takes place. This
34424 behaviour is essentially a redirection.
34425 </para>
34426 </listitem></varlistentry>
34427 <varlistentry>
34428 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
34429 <listitem>
34430 <para>
34431 The domain is changed to the given domain, and the address is passed back to be
34432 reprocessed by the routers. Any headers that contain the original domain are
34433 rewritten.
34434 </para>
34435 </listitem></varlistentry>
34436 <varlistentry>
34437 <term><option>pass</option></term>
34438 <listitem>
34439 <para>
34440 <indexterm role="option">
34441 <primary><option>more</option></primary>
34442 </indexterm>
34443 <indexterm role="variable">
34444 <primary><varname>$self_hostname</varname></primary>
34445 </indexterm>
34446 The router passes the address to the next router, or to the router named in the
34447 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
34448 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
34449 name of the local host that the router encountered. This can be used to
34450 distinguish between different cases for hosts with multiple names. The
34451 combination
34452 </para>
34453 <literallayout class="monospaced">
34454 self = pass
34455 no_more
34456 </literallayout>
34457 <para>
34458 ensures that only those addresses that routed to the local host are passed on.
34459 Without <option>no_more</option>, addresses that were declined for other reasons would also
34460 be passed to the next router.
34461 </para>
34462 </listitem></varlistentry>
34463 <varlistentry>
34464 <term><option>fail</option></term>
34465 <listitem>
34466 <para>
34467 Delivery fails and an error report is generated.
34468 </para>
34469 </listitem></varlistentry>
34470 <varlistentry>
34471 <term><option>send</option></term>
34472 <listitem>
34473 <para>
34474 <indexterm role="concept">
34475 <primary>local host</primary>
34476 <secondary>sending to</secondary>
34477 </indexterm>
34478 The anomaly is ignored and the address is queued for the transport. This
34479 setting should be used with extreme caution. For an <command>smtp</command> transport, it
34480 makes sense only in cases where the program that is listening on the SMTP port
34481 is not this version of Exim. That is, it must be some other MTA, or Exim with a
34482 different configuration file that handles the domain in another way.
34483 </para>
34484 </listitem></varlistentry>
34485 </variablelist>
34486 <para>
34487 <indexterm role="option">
34488 <primary><option>senders</option></primary>
34489 </indexterm>
34490 </para>
34491 <informaltable frame="all">
34492 <tgroup cols="4" colsep="0" rowsep="0">
34493 <colspec colwidth="8*" align="left"/>
34494 <colspec colwidth="6*" align="center"/>
34495 <colspec colwidth="6*" align="center"/>
34496 <colspec colwidth="6*" align="right"/>
34497 <tbody>
34498 <row>
34499 <entry><option>senders</option></entry>
34500 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34501 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
34502 <entry>Default: <emphasis>unset</emphasis></entry>
34503 </row>
34504 </tbody>
34505 </tgroup>
34506 </informaltable>
34507 <para>
34508 <indexterm role="concept">
34509 <primary>router</primary>
34510 <secondary>checking senders</secondary>
34511 </indexterm>
34512 If this option is set, the router is skipped unless the message&#x2019;s sender
34513 address matches something on the list.
34514 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34515 are evaluated.
34516 </para>
34517 <para>
34518 There are issues concerning verification when the running of routers is
34519 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
34520 setting, it sets the sender to the null string. When using the <option>-bt</option> option
34521 to check a configuration file, it is necessary also to use the <option>-f</option> option to
34522 set an appropriate sender. For incoming mail, the sender is unset when
34523 verifying the sender, but is available when verifying any recipients. If the
34524 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
34525 matters.
34526 </para>
34527 <para>
34528 <indexterm role="option">
34529 <primary><option>translate_ip_address</option></primary>
34530 </indexterm>
34531 </para>
34532 <informaltable frame="all">
34533 <tgroup cols="4" colsep="0" rowsep="0">
34534 <colspec colwidth="8*" align="left"/>
34535 <colspec colwidth="6*" align="center"/>
34536 <colspec colwidth="6*" align="center"/>
34537 <colspec colwidth="6*" align="right"/>
34538 <tbody>
34539 <row>
34540 <entry><option>translate_ip_address</option></entry>
34541 <entry>Use: <emphasis>routers</emphasis></entry>
34542 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34543 <entry>Default: <emphasis>unset</emphasis></entry>
34544 </row>
34545 </tbody>
34546 </tgroup>
34547 </informaltable>
34548 <para>
34549 <indexterm role="concept">
34550 <primary>IP address</primary>
34551 <secondary>translating</secondary>
34552 </indexterm>
34553 <indexterm role="concept">
34554 <primary>packet radio</primary>
34555 </indexterm>
34556 <indexterm role="concept">
34557 <primary>router</primary>
34558 <secondary>IP address translation</secondary>
34559 </indexterm>
34560 There exist some rare networking situations (for example, packet radio) where
34561 it is helpful to be able to translate IP addresses generated by normal routing
34562 mechanisms into other IP addresses, thus performing a kind of manual IP
34563 routing. This should be done only if the normal IP routing of the TCP/IP stack
34564 is inadequate or broken. Because this is an extremely uncommon requirement, the
34565 code to support this option is not included in the Exim binary unless
34566 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
34567 </para>
34568 <para>
34569 <indexterm role="variable">
34570 <primary><varname>$host_address</varname></primary>
34571 </indexterm>
34572 The <option>translate_ip_address</option> string is expanded for every IP address generated
34573 by the router, with the generated address set in <varname>$host_address</varname>. If the
34574 expansion is forced to fail, no action is taken.
34575 For any other expansion error, delivery of the message is deferred.
34576 If the result of the expansion is an IP address, that replaces the original
34577 address; otherwise the result is assumed to be a host name &ndash; this is looked
34578 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
34579 produce one or more replacement IP addresses. For example, to subvert all IP
34580 addresses in some specific networks, this could be added to a router:
34581 </para>
34582 <literallayout class="monospaced">
34583 translate_ip_address = \
34584   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
34585     {$value}fail}}
34586 </literallayout>
34587 <para>
34588 The file would contain lines like
34589 </para>
34590 <literallayout class="monospaced">
34591 10.2.3.128/26    some.host
34592 10.8.4.34/26     10.44.8.15
34593 </literallayout>
34594 <para>
34595 You should not make use of this facility unless you really understand what you
34596 are doing.
34597 </para>
34598 <para>
34599 <indexterm role="option">
34600 <primary><option>transport</option></primary>
34601 </indexterm>
34602 </para>
34603 <informaltable frame="all">
34604 <tgroup cols="4" colsep="0" rowsep="0">
34605 <colspec colwidth="8*" align="left"/>
34606 <colspec colwidth="6*" align="center"/>
34607 <colspec colwidth="6*" align="center"/>
34608 <colspec colwidth="6*" align="right"/>
34609 <tbody>
34610 <row>
34611 <entry><option>transport</option></entry>
34612 <entry>Use: <emphasis>routers</emphasis></entry>
34613 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34614 <entry>Default: <emphasis>unset</emphasis></entry>
34615 </row>
34616 </tbody>
34617 </tgroup>
34618 </informaltable>
34619 <para>
34620 This option specifies the transport to be used when a router accepts an address
34621 and sets it up for delivery. A transport is never needed if a router is used
34622 only for verification. The value of the option is expanded at routing time,
34623 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
34624 and result must be the name of one of the configured transports. If it is not,
34625 delivery is deferred.
34626 </para>
34627 <para>
34628 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
34629 have some private options that set up transports for pipe and file deliveries
34630 (see chapter <xref linkend="CHAPredirect"/>).
34631 </para>
34632 <para>
34633 <indexterm role="option">
34634 <primary><option>transport_current_directory</option></primary>
34635 </indexterm>
34636 </para>
34637 <informaltable frame="all">
34638 <tgroup cols="4" colsep="0" rowsep="0">
34639 <colspec colwidth="8*" align="left"/>
34640 <colspec colwidth="6*" align="center"/>
34641 <colspec colwidth="6*" align="center"/>
34642 <colspec colwidth="6*" align="right"/>
34643 <tbody>
34644 <row>
34645 <entry><option>transport_current_directory</option></entry>
34646 <entry>Use: <emphasis>routers</emphasis></entry>
34647 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34648 <entry>Default: <emphasis>unset</emphasis></entry>
34649 </row>
34650 </tbody>
34651 </tgroup>
34652 </informaltable>
34653 <para>
34654 <indexterm role="concept">
34655 <primary>current directory for local transport</primary>
34656 </indexterm>
34657 This option associates a current directory with any address that is routed
34658 to a local transport. This can happen either because a transport is
34659 explicitly configured for the router, or because it generates a delivery to a
34660 file or a pipe. During the delivery process (that is, at transport time), this
34661 option string is expanded and is set as the current directory, unless
34662 overridden by a setting on the transport.
34663 If the expansion fails for any reason, including forced failure, an error is
34664 logged, and delivery is deferred.
34665 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
34666 environment.
34667 </para>
34668 <para>
34669 <indexterm role="option">
34670 <primary><option>transport_home_directory</option></primary>
34671 </indexterm>
34672 </para>
34673 <informaltable frame="all">
34674 <tgroup cols="4" colsep="0" rowsep="0">
34675 <colspec colwidth="8*" align="left"/>
34676 <colspec colwidth="6*" align="center"/>
34677 <colspec colwidth="6*" align="center"/>
34678 <colspec colwidth="6*" align="right"/>
34679 <tbody>
34680 <row>
34681 <entry><option>transport_home_directory</option></entry>
34682 <entry>Use: <emphasis>routers</emphasis></entry>
34683 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34684 <entry>Default: <emphasis>see below</emphasis></entry>
34685 </row>
34686 </tbody>
34687 </tgroup>
34688 </informaltable>
34689 <para>
34690 <indexterm role="concept">
34691 <primary>home directory</primary>
34692 <secondary>for local transport</secondary>
34693 </indexterm>
34694 This option associates a home directory with any address that is routed to a
34695 local transport. This can happen either because a transport is explicitly
34696 configured for the router, or because it generates a delivery to a file or a
34697 pipe. During the delivery process (that is, at transport time), the option
34698 string is expanded and is set as the home directory, unless overridden by a
34699 setting of <option>home_directory</option> on the transport.
34700 If the expansion fails for any reason, including forced failure, an error is
34701 logged, and delivery is deferred.
34702 </para>
34703 <para>
34704 If the transport does not specify a home directory, and
34705 <option>transport_home_directory</option> is not set for the router, the home directory for
34706 the transport is taken from the password data if <option>check_local_user</option> is set for
34707 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
34708 is set; if not, no home directory is set for the transport.
34709 </para>
34710 <para>
34711 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
34712 environment.
34713 </para>
34714 <para>
34715 <indexterm role="option">
34716 <primary><option>unseen</option></primary>
34717 </indexterm>
34718 </para>
34719 <informaltable frame="all">
34720 <tgroup cols="4" colsep="0" rowsep="0">
34721 <colspec colwidth="8*" align="left"/>
34722 <colspec colwidth="6*" align="center"/>
34723 <colspec colwidth="6*" align="center"/>
34724 <colspec colwidth="6*" align="right"/>
34725 <tbody>
34726 <row>
34727 <entry><option>unseen</option></entry>
34728 <entry>Use: <emphasis>routers</emphasis></entry>
34729 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
34730 <entry>Default: <emphasis>false</emphasis></entry>
34731 </row>
34732 </tbody>
34733 </tgroup>
34734 </informaltable>
34735 <para>
34736 <indexterm role="concept">
34737 <primary>router</primary>
34738 <secondary>carrying on after success</secondary>
34739 </indexterm>
34740 The result of string expansion for this option must be a valid boolean value,
34741 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
34742 result causes an error, and delivery is deferred. If the expansion is forced to
34743 fail, the default value for the option (false) is used. Other failures cause
34744 delivery to be deferred.
34745 </para>
34746 <para>
34747 When this option is set true, routing does not cease if the router accepts the
34748 address. Instead, a copy of the incoming address is passed to the next router,
34749 overriding a false setting of <option>more</option>. There is little point in setting
34750 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
34751 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
34752 sometimes true and sometimes false).
34753 </para>
34754 <para>
34755 <indexterm role="concept">
34756 <primary>copy of message (<option>unseen</option> option)</primary>
34757 </indexterm>
34758 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
34759 qualifier in filter files. It can be used to cause copies of messages to be
34760 delivered to some other destination, while also carrying out a normal delivery.
34761 In effect, the current address is made into a <quote>parent</quote> that has two children
34762 &ndash; one that is delivered as specified by this router, and a clone that goes on
34763 to be routed further. For this reason, <option>unseen</option> may not be combined with the
34764 <option>one_time</option> option in a <command>redirect</command> router.
34765 </para>
34766 <para>
34767 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
34768 this router or by previous routers affect the <quote>unseen</quote> copy of the message
34769 only. The clone that continues to be processed by further routers starts with
34770 no added headers and none specified for removal. For a <option>redirect</option> router, if
34771 a generated address is the same as the incoming address, this can lead to
34772 duplicate addresses with different header modifications. Exim does not do
34773 duplicate deliveries (except, in certain circumstances, to pipes -- see section
34774 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
34775 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
34776 <option>redirect</option> router may be of help.
34777 </para>
34778 <para>
34779 Unlike the handling of header modifications, any data that was set by the
34780 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
34781 subsequent routers.
34782 </para>
34783 <para>
34784 <indexterm role="option">
34785 <primary><option>user</option></primary>
34786 </indexterm>
34787 </para>
34788 <informaltable frame="all">
34789 <tgroup cols="4" colsep="0" rowsep="0">
34790 <colspec colwidth="8*" align="left"/>
34791 <colspec colwidth="6*" align="center"/>
34792 <colspec colwidth="6*" align="center"/>
34793 <colspec colwidth="6*" align="right"/>
34794 <tbody>
34795 <row>
34796 <entry><option>user</option></entry>
34797 <entry>Use: <emphasis>routers</emphasis></entry>
34798 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34799 <entry>Default: <emphasis>see below</emphasis></entry>
34800 </row>
34801 </tbody>
34802 </tgroup>
34803 </informaltable>
34804 <para>
34805 <indexterm role="concept">
34806 <primary>uid (user id)</primary>
34807 <secondary>local delivery</secondary>
34808 </indexterm>
34809 <indexterm role="concept">
34810 <primary>local transports</primary>
34811 <secondary>uid and gid</secondary>
34812 </indexterm>
34813 <indexterm role="concept">
34814 <primary>transport</primary>
34815 <secondary>local</secondary>
34816 </indexterm>
34817 <indexterm role="concept">
34818 <primary>router</primary>
34819 <secondary>user for filter processing</secondary>
34820 </indexterm>
34821 <indexterm role="concept">
34822 <primary>filter</primary>
34823 <secondary>user for processing</secondary>
34824 </indexterm>
34825 When a router queues an address for a transport, and the transport does not
34826 specify a user, the user given here is used when running the delivery process.
34827 The user may be specified numerically or by name. If expansion fails, the
34828 error is logged and delivery is deferred.
34829 This user is also used by the <command>redirect</command> router when running a filter file.
34830 The default is unset, except when <option>check_local_user</option> is set. In this case,
34831 the default is taken from the password information. If the user is specified as
34832 a name, and <option>group</option> is not set, the group associated with the user is used.
34833 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
34834 <xref linkend="CHAPenvironment"/>.
34835 </para>
34836 <para>
34837 <indexterm role="option">
34838 <primary><option>verify</option></primary>
34839 </indexterm>
34840 </para>
34841 <informaltable frame="all">
34842 <tgroup cols="4" colsep="0" rowsep="0">
34843 <colspec colwidth="8*" align="left"/>
34844 <colspec colwidth="6*" align="center"/>
34845 <colspec colwidth="6*" align="center"/>
34846 <colspec colwidth="6*" align="right"/>
34847 <tbody>
34848 <row>
34849 <entry><option>verify</option></entry>
34850 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34851 <entry>Type: <emphasis>boolean</emphasis></entry>
34852 <entry>Default: <emphasis>true</emphasis></entry>
34853 </row>
34854 </tbody>
34855 </tgroup>
34856 </informaltable>
34857 <para>
34858 Setting this option has the effect of setting <option>verify_sender</option> and
34859 <option>verify_recipient</option> to the same value.
34860 </para>
34861 <para>
34862 <indexterm role="option">
34863 <primary><option>verify_only</option></primary>
34864 </indexterm>
34865 </para>
34866 <informaltable frame="all">
34867 <tgroup cols="4" colsep="0" rowsep="0">
34868 <colspec colwidth="8*" align="left"/>
34869 <colspec colwidth="6*" align="center"/>
34870 <colspec colwidth="6*" align="center"/>
34871 <colspec colwidth="6*" align="right"/>
34872 <tbody>
34873 <row>
34874 <entry><option>verify_only</option></entry>
34875 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34876 <entry>Type: <emphasis>boolean</emphasis></entry>
34877 <entry>Default: <emphasis>false</emphasis></entry>
34878 </row>
34879 </tbody>
34880 </tgroup>
34881 </informaltable>
34882 <para>
34883 <indexterm role="concept">
34884 <primary>EXPN</primary>
34885 <secondary>with <option>verify_only</option></secondary>
34886 </indexterm>
34887 <indexterm role="option">
34888 <primary><option>-bv</option></primary>
34889 </indexterm>
34890 <indexterm role="concept">
34891 <primary>router</primary>
34892 <secondary>used only when verifying</secondary>
34893 </indexterm>
34894 If this option is set, the router is used only when verifying an address,
34895 delivering in cutthrough mode or
34896 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
34897 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
34898 restricted to verifying only senders or recipients by means of
34899 <option>verify_sender</option> and <option>verify_recipient</option>.
34900 </para>
34901 <para>
34902 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
34903 SMTP message, Exim is not running as root, but under its own uid. If the router
34904 accesses any files, you need to make sure that they are accessible to the Exim
34905 user or group.
34906 </para>
34907 <para>
34908 <indexterm role="option">
34909 <primary><option>verify_recipient</option></primary>
34910 </indexterm>
34911 </para>
34912 <informaltable frame="all">
34913 <tgroup cols="4" colsep="0" rowsep="0">
34914 <colspec colwidth="8*" align="left"/>
34915 <colspec colwidth="6*" align="center"/>
34916 <colspec colwidth="6*" align="center"/>
34917 <colspec colwidth="6*" align="right"/>
34918 <tbody>
34919 <row>
34920 <entry><option>verify_recipient</option></entry>
34921 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34922 <entry>Type: <emphasis>boolean</emphasis></entry>
34923 <entry>Default: <emphasis>true</emphasis></entry>
34924 </row>
34925 </tbody>
34926 </tgroup>
34927 </informaltable>
34928 <para>
34929 If this option is false, the router is skipped when verifying recipient
34930 addresses,
34931 delivering in cutthrough mode
34932 or testing recipient verification using <option>-bv</option>.
34933 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34934 are evaluated.
34935 See also the <varname>$verify_mode</varname> variable.
34936 </para>
34937 <para>
34938 <indexterm role="option">
34939 <primary><option>verify_sender</option></primary>
34940 </indexterm>
34941 </para>
34942 <informaltable frame="all">
34943 <tgroup cols="4" colsep="0" rowsep="0">
34944 <colspec colwidth="8*" align="left"/>
34945 <colspec colwidth="6*" align="center"/>
34946 <colspec colwidth="6*" align="center"/>
34947 <colspec colwidth="6*" align="right"/>
34948 <tbody>
34949 <row>
34950 <entry><option>verify_sender</option></entry>
34951 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34952 <entry>Type: <emphasis>boolean</emphasis></entry>
34953 <entry>Default: <emphasis>true</emphasis></entry>
34954 </row>
34955 </tbody>
34956 </tgroup>
34957 </informaltable>
34958 <para>
34959 If this option is false, the router is skipped when verifying sender addresses
34960 or testing sender verification using <option>-bvs</option>.
34961 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
34962 are evaluated.
34963 See also the <varname>$verify_mode</varname> variable.
34964 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
34965 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
34966 </para>
34967 </chapter>
34968
34969 <chapter id="CHID4">
34970 <title>The accept router</title>
34971 <para>
34972 <indexterm role="concept">
34973 <primary><command>accept</command> router</primary>
34974 </indexterm>
34975 <indexterm role="concept">
34976 <primary>routers</primary>
34977 <secondary><command>accept</command></secondary>
34978 </indexterm>
34979 The <command>accept</command> router has no private options of its own. Unless it is being
34980 used purely for verification (see <option>verify_only</option>) a transport is required to
34981 be defined by the generic <option>transport</option> option. If the preconditions that are
34982 specified by generic options are met, the router accepts the address and queues
34983 it for the given transport. The most common use of this router is for setting
34984 up deliveries to local mailboxes. For example:
34985 </para>
34986 <literallayout class="monospaced">
34987 localusers:
34988   driver = accept
34989   domains = mydomain.example
34990   check_local_user
34991   transport = local_delivery
34992 </literallayout>
34993 <para>
34994 The <option>domains</option> condition in this example checks the domain of the address, and
34995 <option>check_local_user</option> checks that the local part is the login of a local user.
34996 When both preconditions are met, the <command>accept</command> router runs, and queues the
34997 address for the <command>local_delivery</command> transport.
34998 </para>
34999 </chapter>
35000
35001 <chapter id="CHAPdnslookup">
35002 <title>The dnslookup router</title>
35003 <para>
35004 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
35005 <primary><command>dnslookup</command> router</primary>
35006 </indexterm>
35007 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
35008 <primary>routers</primary>
35009 <secondary><command>dnslookup</command></secondary>
35010 </indexterm>
35011 The <command>dnslookup</command> router looks up the hosts that handle mail for the
35012 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
35013 unless <option>verify_only</option> is set.
35014 </para>
35015 <para>
35016 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
35017 SRV records. If none are found, or if SRV support is not configured,
35018 MX records are looked up. If no MX records exist, address records are sought.
35019 However, <option>mx_domains</option> can be set to disable the direct use of address
35020 records.
35021 </para>
35022 <para>
35023 MX records of equal priority are sorted by Exim into a random order. Exim then
35024 looks for address records for the host names obtained from MX or SRV records.
35025 When a host has more than one IP address, they are sorted into a random order,
35026 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
35027 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
35028 generic option, the router declines.
35029 </para>
35030 <para>
35031 Unless they have the highest priority (lowest MX value), MX records that point
35032 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
35033 are discarded, together with any other MX records of equal or lower priority.
35034 </para>
35035 <para>
35036 <indexterm role="concept">
35037 <primary>MX record</primary>
35038 <secondary>pointing to local host</secondary>
35039 </indexterm>
35040 <indexterm role="concept">
35041 <primary>local host</primary>
35042 <secondary>MX pointing to</secondary>
35043 </indexterm>
35044 <indexterm role="option">
35045 <primary><option>self</option></primary>
35046 <secondary>in <command>dnslookup</command> router</secondary>
35047 </indexterm>
35048 If the host pointed to by the highest priority MX record, or looked up as an
35049 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
35050 happens is controlled by the generic <option>self</option> option.
35051 </para>
35052 <section id="SECTprowitdnsloo">
35053 <title>Problems with DNS lookups</title>
35054 <para>
35055 There have been problems with DNS servers when SRV records are looked up.
35056 Some misbehaving servers return a DNS error or timeout when a non-existent
35057 SRV record is sought. Similar problems have in the past been reported for
35058 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
35059 problem, but it is heavy-handed because it is a global option.
35060 </para>
35061 <para>
35062 For this reason, there are two options, <option>srv_fail_domains</option> and
35063 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
35064 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
35065 an attempt to look up an SRV or MX record causes one of these results, and the
35066 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
35067 such record</quote>. In the case of an SRV lookup, this means that the router
35068 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
35069 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
35070 case routing fails.
35071 </para>
35072 </section>
35073 <section id="SECTdnslookupdecline">
35074 <title>Declining addresses by dnslookup</title>
35075 <para>
35076 <indexterm role="concept">
35077 <primary><command>dnslookup</command> router</primary>
35078 <secondary>declines</secondary>
35079 </indexterm>
35080 There are a few cases where a <command>dnslookup</command> router will decline to accept
35081 an address; if such a router is expected to handle "all remaining non-local
35082 domains", then it is important to set <option>no_more</option>.
35083 </para>
35084 <para>
35085 The router will defer rather than decline if the domain
35086 is found in the <option>fail_defer_domains</option> router option.
35087 </para>
35088 <para>
35089 Reasons for a <command>dnslookup</command> router to decline currently include:
35090 </para>
35091 <itemizedlist>
35092 <listitem>
35093 <para>
35094 The domain does not exist in DNS
35095 </para>
35096 </listitem>
35097 <listitem>
35098 <para>
35099 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
35100 convention (borrowed from SRV) used to indicate that there is no such service
35101 for this domain and to not fall back to trying A/AAAA records.
35102 </para>
35103 </listitem>
35104 <listitem>
35105 <para>
35106 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
35107 </para>
35108 </listitem>
35109 <listitem>
35110 <para>
35111 MX record points to a non-existent host.
35112 </para>
35113 </listitem>
35114 <listitem>
35115 <para>
35116 MX record points to an IP address and the main section option
35117 <option>allow_mx_to_ip</option> is not set.
35118 </para>
35119 </listitem>
35120 <listitem>
35121 <para>
35122 MX records exist and point to valid hosts, but all hosts resolve only to
35123 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
35124 </para>
35125 </listitem>
35126 <listitem>
35127 <para>
35128 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
35129 <option>dns_check_names_pattern</option> for handling one variant of this)
35130 </para>
35131 </listitem>
35132 <listitem>
35133 <para>
35134 <option>check_secondary_mx</option> is set on this router but the local host can
35135 not be found in the MX records (see below)
35136 </para>
35137 </listitem>
35138 </itemizedlist>
35139 </section>
35140 <section id="SECID118">
35141 <title>Private options for dnslookup</title>
35142 <para>
35143 <indexterm role="concept">
35144 <primary>options</primary>
35145 <secondary><command>dnslookup</command> router</secondary>
35146 </indexterm>
35147 The private options for the <command>dnslookup</command> router are as follows:
35148 </para>
35149 <para>
35150 <indexterm role="option">
35151 <primary><option>check_secondary_mx</option></primary>
35152 </indexterm>
35153 </para>
35154 <informaltable frame="all">
35155 <tgroup cols="4" colsep="0" rowsep="0">
35156 <colspec colwidth="8*" align="left"/>
35157 <colspec colwidth="6*" align="center"/>
35158 <colspec colwidth="6*" align="center"/>
35159 <colspec colwidth="6*" align="right"/>
35160 <tbody>
35161 <row>
35162 <entry><option>check_secondary_mx</option></entry>
35163 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35164 <entry>Type: <emphasis>boolean</emphasis></entry>
35165 <entry>Default: <emphasis>false</emphasis></entry>
35166 </row>
35167 </tbody>
35168 </tgroup>
35169 </informaltable>
35170 <para>
35171 <indexterm role="concept">
35172 <primary>MX record</primary>
35173 <secondary>checking for secondary</secondary>
35174 </indexterm>
35175 If this option is set, the router declines unless the local host is found in
35176 (and removed from) the list of hosts obtained by MX lookup. This can be used to
35177 process domains for which the local host is a secondary mail exchanger
35178 differently to other domains. The way in which Exim decides whether a host is
35179 the local host is described in section <xref linkend="SECTreclocipadd"/>.
35180 </para>
35181 <para>
35182 <indexterm role="option">
35183 <primary><option>check_srv</option></primary>
35184 </indexterm>
35185 </para>
35186 <informaltable frame="all">
35187 <tgroup cols="4" colsep="0" rowsep="0">
35188 <colspec colwidth="8*" align="left"/>
35189 <colspec colwidth="6*" align="center"/>
35190 <colspec colwidth="6*" align="center"/>
35191 <colspec colwidth="6*" align="right"/>
35192 <tbody>
35193 <row>
35194 <entry><option>check_srv</option></entry>
35195 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35196 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35197 <entry>Default: <emphasis>unset</emphasis></entry>
35198 </row>
35199 </tbody>
35200 </tgroup>
35201 </informaltable>
35202 <para>
35203 <indexterm role="concept">
35204 <primary>SRV record</primary>
35205 <secondary>enabling use of</secondary>
35206 </indexterm>
35207 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
35208 addition to MX and address records. The support is disabled by default. To
35209 enable SRV support, set the <option>check_srv</option> option to the name of the service
35210 required. For example,
35211 </para>
35212 <literallayout class="monospaced">
35213 check_srv = smtp
35214 </literallayout>
35215 <para>
35216 looks for SRV records that refer to the normal smtp service. The option is
35217 expanded, so the service name can vary from message to message or address
35218 to address. This might be helpful if SRV records are being used for a
35219 submission service. If the expansion is forced to fail, the <option>check_srv</option>
35220 option is ignored, and the router proceeds to look for MX records in the
35221 normal way.
35222 </para>
35223 <para>
35224 When the expansion succeeds, the router searches first for SRV records for
35225 the given service (it assumes TCP protocol). A single SRV record with a
35226 host name that consists of just a single dot indicates <quote>no such service for
35227 this domain</quote>; if this is encountered, the router declines. If other kinds of
35228 SRV record are found, they are used to construct a host list for delivery
35229 according to the rules of RFC 2782. MX records are not sought in this case.
35230 </para>
35231 <para>
35232 When no SRV records are found, MX records (and address records) are sought in
35233 the traditional way. In other words, SRV records take precedence over MX
35234 records, just as MX records take precedence over address records. Note that
35235 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
35236 defined it. It is apparently believed that MX records are sufficient for email
35237 and that SRV records should not be used for this purpose. However, SRV records
35238 have an additional <quote>weight</quote> feature which some people might find useful when
35239 trying to split an SMTP load between hosts of different power.
35240 </para>
35241 <para>
35242 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
35243 when there is a DNS lookup error.
35244 </para>
35245 <para>
35246 <indexterm role="option">
35247 <primary><option>fail_defer_domains</option></primary>
35248 </indexterm>
35249 </para>
35250 <informaltable frame="all">
35251 <tgroup cols="4" colsep="0" rowsep="0">
35252 <colspec colwidth="8*" align="left"/>
35253 <colspec colwidth="6*" align="center"/>
35254 <colspec colwidth="6*" align="center"/>
35255 <colspec colwidth="6*" align="right"/>
35256 <tbody>
35257 <row>
35258 <entry><option>fail_defer_domains</option></entry>
35259 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35260 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35261 <entry>Default: <emphasis>unset</emphasis></entry>
35262 </row>
35263 </tbody>
35264 </tgroup>
35265 </informaltable>
35266 <para>
35267 <indexterm role="concept">
35268 <primary>MX record</primary>
35269 <secondary>not found</secondary>
35270 </indexterm>
35271 DNS lookups for domains matching <option>fail_defer_domains</option>
35272 which find no matching record will cause the router to defer
35273 rather than the default behaviour of decline.
35274 This maybe be useful for queueing messages for a newly created
35275 domain while the DNS configuration is not ready.
35276 However, it will result in any message with mistyped domains
35277 also being queued.
35278 </para>
35279 <para>
35280 <indexterm role="option">
35281 <primary><option>mx_domains</option></primary>
35282 </indexterm>
35283 </para>
35284 <informaltable frame="all">
35285 <tgroup cols="4" colsep="0" rowsep="0">
35286 <colspec colwidth="8*" align="left"/>
35287 <colspec colwidth="6*" align="center"/>
35288 <colspec colwidth="6*" align="center"/>
35289 <colspec colwidth="6*" align="right"/>
35290 <tbody>
35291 <row>
35292 <entry><option>mx_domains</option></entry>
35293 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35294 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35295 <entry>Default: <emphasis>unset</emphasis></entry>
35296 </row>
35297 </tbody>
35298 </tgroup>
35299 </informaltable>
35300 <para>
35301 <indexterm role="concept">
35302 <primary>MX record</primary>
35303 <secondary>required to exist</secondary>
35304 </indexterm>
35305 <indexterm role="concept">
35306 <primary>SRV record</primary>
35307 <secondary>required to exist</secondary>
35308 </indexterm>
35309 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
35310 record in order to be recognized. (The name of this option could be improved.)
35311 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
35312 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
35313 setting:
35314 </para>
35315 <literallayout class="monospaced">
35316 mx_domains = ! *.discworld.fict.example : *.fict.example
35317 </literallayout>
35318 <para>
35319 This specifies that messages addressed to a domain that matches the list but
35320 has no MX record should be bounced immediately instead of being routed using
35321 the address record.
35322 </para>
35323 <para>
35324 <indexterm role="option">
35325 <primary><option>mx_fail_domains</option></primary>
35326 </indexterm>
35327 </para>
35328 <informaltable frame="all">
35329 <tgroup cols="4" colsep="0" rowsep="0">
35330 <colspec colwidth="8*" align="left"/>
35331 <colspec colwidth="6*" align="center"/>
35332 <colspec colwidth="6*" align="center"/>
35333 <colspec colwidth="6*" align="right"/>
35334 <tbody>
35335 <row>
35336 <entry><option>mx_fail_domains</option></entry>
35337 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35338 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35339 <entry>Default: <emphasis>unset</emphasis></entry>
35340 </row>
35341 </tbody>
35342 </tgroup>
35343 </informaltable>
35344 <para>
35345 If the DNS lookup for MX records for one of the domains in this list causes a
35346 DNS lookup error, Exim behaves as if no MX records were found. See section
35347 <xref linkend="SECTprowitdnsloo"/> for more discussion.
35348 </para>
35349 <para>
35350 <indexterm role="option">
35351 <primary><option>qualify_single</option></primary>
35352 </indexterm>
35353 </para>
35354 <informaltable frame="all">
35355 <tgroup cols="4" colsep="0" rowsep="0">
35356 <colspec colwidth="8*" align="left"/>
35357 <colspec colwidth="6*" align="center"/>
35358 <colspec colwidth="6*" align="center"/>
35359 <colspec colwidth="6*" align="right"/>
35360 <tbody>
35361 <row>
35362 <entry><option>qualify_single</option></entry>
35363 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35364 <entry>Type: <emphasis>boolean</emphasis></entry>
35365 <entry>Default: <emphasis>true</emphasis></entry>
35366 </row>
35367 </tbody>
35368 </tgroup>
35369 </informaltable>
35370 <para>
35371 <indexterm role="concept">
35372 <primary>DNS</primary>
35373 <secondary>resolver options</secondary>
35374 </indexterm>
35375 <indexterm role="concept">
35376 <primary>DNS</primary>
35377 <secondary>qualifying single-component names</secondary>
35378 </indexterm>
35379 When this option is true, the resolver option RES_DEFNAMES is set for DNS
35380 lookups. Typically, but not standardly, this causes the resolver to qualify
35381 single-component names with the default domain. For example, on a machine
35382 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
35383 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
35384 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
35385 <emphasis>resolv.conf</emphasis>.
35386 </para>
35387 <para>
35388 <indexterm role="option">
35389 <primary><option>rewrite_headers</option></primary>
35390 </indexterm>
35391 </para>
35392 <informaltable frame="all">
35393 <tgroup cols="4" colsep="0" rowsep="0">
35394 <colspec colwidth="8*" align="left"/>
35395 <colspec colwidth="6*" align="center"/>
35396 <colspec colwidth="6*" align="center"/>
35397 <colspec colwidth="6*" align="right"/>
35398 <tbody>
35399 <row>
35400 <entry><option>rewrite_headers</option></entry>
35401 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35402 <entry>Type: <emphasis>boolean</emphasis></entry>
35403 <entry>Default: <emphasis>true</emphasis></entry>
35404 </row>
35405 </tbody>
35406 </tgroup>
35407 </informaltable>
35408 <para>
35409 <indexterm role="concept">
35410 <primary>rewriting</primary>
35411 <secondary>header lines</secondary>
35412 </indexterm>
35413 <indexterm role="concept">
35414 <primary>header lines</primary>
35415 <secondary>rewriting</secondary>
35416 </indexterm>
35417 If the domain name in the address that is being processed is not fully
35418 qualified, it may be expanded to its full form by a DNS lookup. For example, if
35419 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
35420 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
35421 occur as a result of setting the <option>widen_domains</option> option. If
35422 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
35423 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
35424 header lines of the message are rewritten with the full domain name.
35425 </para>
35426 <para>
35427 This option should be turned off only when it is known that no message is
35428 ever going to be sent outside an environment where the abbreviation makes
35429 sense.
35430 </para>
35431 <para>
35432 When an MX record is looked up in the DNS and matches a wildcard record, name
35433 servers normally return a record containing the name that has been looked up,
35434 making it impossible to detect whether a wildcard was present or not. However,
35435 some name servers have recently been seen to return the wildcard entry. If the
35436 name returned by a DNS lookup begins with an asterisk, it is not used for
35437 header rewriting.
35438 </para>
35439 <para>
35440 <indexterm role="option">
35441 <primary><option>same_domain_copy_routing</option></primary>
35442 </indexterm>
35443 </para>
35444 <informaltable frame="all">
35445 <tgroup cols="4" colsep="0" rowsep="0">
35446 <colspec colwidth="8*" align="left"/>
35447 <colspec colwidth="6*" align="center"/>
35448 <colspec colwidth="6*" align="center"/>
35449 <colspec colwidth="6*" align="right"/>
35450 <tbody>
35451 <row>
35452 <entry><option>same_domain_copy_routing</option></entry>
35453 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35454 <entry>Type: <emphasis>boolean</emphasis></entry>
35455 <entry>Default: <emphasis>false</emphasis></entry>
35456 </row>
35457 </tbody>
35458 </tgroup>
35459 </informaltable>
35460 <para>
35461 <indexterm role="concept">
35462 <primary>address</primary>
35463 <secondary>copying routing</secondary>
35464 </indexterm>
35465 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
35466 to the same list of hosts. However, this cannot be presumed, because the router
35467 options and preconditions may refer to the local part of the address. By
35468 default, therefore, Exim routes each address in a message independently. DNS
35469 servers run caches, so repeated DNS lookups are not normally expensive, and in
35470 any case, personal messages rarely have more than a few recipients.
35471 </para>
35472 <para>
35473 If you are running mailing lists with large numbers of subscribers at the same
35474 domain, and you are using a <command>dnslookup</command> router which is independent of the
35475 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
35476 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
35477 routes an address to a remote transport, any other unrouted addresses in the
35478 message that have the same domain are automatically given the same routing
35479 without processing them independently,
35480 provided the following conditions are met:
35481 </para>
35482 <itemizedlist>
35483 <listitem>
35484 <para>
35485 No router that processed the address specified <option>headers_add</option> or
35486 <option>headers_remove</option>.
35487 </para>
35488 </listitem>
35489 <listitem>
35490 <para>
35491 The router did not change the address in any way, for example, by <quote>widening</quote>
35492 the domain.
35493 </para>
35494 </listitem>
35495 </itemizedlist>
35496 <para>
35497 <indexterm role="option">
35498 <primary><option>search_parents</option></primary>
35499 </indexterm>
35500 </para>
35501 <informaltable frame="all">
35502 <tgroup cols="4" colsep="0" rowsep="0">
35503 <colspec colwidth="8*" align="left"/>
35504 <colspec colwidth="6*" align="center"/>
35505 <colspec colwidth="6*" align="center"/>
35506 <colspec colwidth="6*" align="right"/>
35507 <tbody>
35508 <row>
35509 <entry><option>search_parents</option></entry>
35510 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35511 <entry>Type: <emphasis>boolean</emphasis></entry>
35512 <entry>Default: <emphasis>false</emphasis></entry>
35513 </row>
35514 </tbody>
35515 </tgroup>
35516 </informaltable>
35517 <para>
35518 <indexterm role="concept">
35519 <primary>DNS</primary>
35520 <secondary>resolver options</secondary>
35521 </indexterm>
35522 When this option is true, the resolver option RES_DNSRCH is set for DNS
35523 lookups. This is different from the <option>qualify_single</option> option in that it
35524 applies to domains containing dots. Typically, but not standardly, it causes
35525 the resolver to search for the name in the current domain and in parent
35526 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
35527 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
35528 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
35529 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
35530 </para>
35531 <para>
35532 Setting this option true can cause problems in domains that have a wildcard MX
35533 record, because any domain that does not have its own MX record matches the
35534 local wildcard.
35535 </para>
35536 <para>
35537 <indexterm role="option">
35538 <primary><option>srv_fail_domains</option></primary>
35539 </indexterm>
35540 </para>
35541 <informaltable frame="all">
35542 <tgroup cols="4" colsep="0" rowsep="0">
35543 <colspec colwidth="8*" align="left"/>
35544 <colspec colwidth="6*" align="center"/>
35545 <colspec colwidth="6*" align="center"/>
35546 <colspec colwidth="6*" align="right"/>
35547 <tbody>
35548 <row>
35549 <entry><option>srv_fail_domains</option></entry>
35550 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35551 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35552 <entry>Default: <emphasis>unset</emphasis></entry>
35553 </row>
35554 </tbody>
35555 </tgroup>
35556 </informaltable>
35557 <para>
35558 If the DNS lookup for SRV records for one of the domains in this list causes a
35559 DNS lookup error, Exim behaves as if no SRV records were found. See section
35560 <xref linkend="SECTprowitdnsloo"/> for more discussion.
35561 </para>
35562 <para>
35563 <indexterm role="option">
35564 <primary><option>widen_domains</option></primary>
35565 </indexterm>
35566 </para>
35567 <informaltable frame="all">
35568 <tgroup cols="4" colsep="0" rowsep="0">
35569 <colspec colwidth="8*" align="left"/>
35570 <colspec colwidth="6*" align="center"/>
35571 <colspec colwidth="6*" align="center"/>
35572 <colspec colwidth="6*" align="right"/>
35573 <tbody>
35574 <row>
35575 <entry><option>widen_domains</option></entry>
35576 <entry>Use: <emphasis>dnslookup</emphasis></entry>
35577 <entry>Type: <emphasis>string list</emphasis></entry>
35578 <entry>Default: <emphasis>unset</emphasis></entry>
35579 </row>
35580 </tbody>
35581 </tgroup>
35582 </informaltable>
35583 <para>
35584 <indexterm role="concept">
35585 <primary>domain</primary>
35586 <secondary>partial; widening</secondary>
35587 </indexterm>
35588 If a DNS lookup fails and this option is set, each of its strings in turn is
35589 added onto the end of the domain, and the lookup is tried again. For example,
35590 if
35591 </para>
35592 <literallayout class="monospaced">
35593 widen_domains = fict.example:ref.example
35594 </literallayout>
35595 <para>
35596 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
35597 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
35598 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
35599 and <option>search_parents</option> options can cause some widening to be undertaken inside
35600 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
35601 when verifying, unless <option>rewrite_headers</option> is false (not the default).
35602 </para>
35603 </section>
35604 <section id="SECID119">
35605 <title>Effect of qualify_single and search_parents</title>
35606 <para>
35607 When a domain from an envelope recipient is changed by the resolver as a result
35608 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
35609 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
35610 is set false. Exim then re-routes the address, using the full domain.
35611 </para>
35612 <para>
35613 These two options affect only the DNS lookup that takes place inside the router
35614 for the domain of the address that is being routed. They do not affect lookups
35615 such as that implied by
35616 </para>
35617 <literallayout class="monospaced">
35618 domains = @mx_any
35619 </literallayout>
35620 <para>
35621 that may happen while processing a router precondition before the router is
35622 entered. No widening ever takes place for these lookups.
35623 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
35624 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
35625 </para>
35626 </section>
35627 </chapter>
35628
35629 <chapter id="CHID5">
35630 <title>The ipliteral router</title>
35631 <para>
35632 <indexterm role="concept">
35633 <primary><command>ipliteral</command> router</primary>
35634 </indexterm>
35635 <indexterm role="concept">
35636 <primary>domain literal</primary>
35637 <secondary>routing</secondary>
35638 </indexterm>
35639 <indexterm role="concept">
35640 <primary>routers</primary>
35641 <secondary><command>ipliteral</command></secondary>
35642 </indexterm>
35643 This router has no private options. Unless it is being used purely for
35644 verification (see <option>verify_only</option>) a transport is required to be defined by the
35645 generic <option>transport</option> option. The router accepts the address if its domain part
35646 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
35647 router handles the address
35648 </para>
35649 <literallayout class="monospaced">
35650 root@[192.168.1.1]
35651 </literallayout>
35652 <para>
35653 by setting up delivery to the host with that IP address. IPv4 domain literals
35654 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
35655 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
35656 </para>
35657 <literallayout class="monospaced">
35658 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
35659 </literallayout>
35660 <para>
35661 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
35662 grounds that sooner or later somebody will try it.
35663 </para>
35664 <para>
35665 <indexterm role="option">
35666 <primary><option>self</option></primary>
35667 <secondary>in <command>ipliteral</command> router</secondary>
35668 </indexterm>
35669 If the IP address matches something in <option>ignore_target_hosts</option>, the router
35670 declines. If an IP literal turns out to refer to the local host, the generic
35671 <option>self</option> option determines what happens.
35672 </para>
35673 <para>
35674 The RFCs require support for domain literals; however, their use is
35675 controversial in today&#x2019;s Internet. If you want to use this router, you must
35676 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
35677 Exim will not recognize the domain literal syntax in addresses.
35678 </para>
35679 </chapter>
35680
35681 <chapter id="CHID6">
35682 <title>The iplookup router</title>
35683 <para>
35684 <indexterm role="concept">
35685 <primary><command>iplookup</command> router</primary>
35686 </indexterm>
35687 <indexterm role="concept">
35688 <primary>routers</primary>
35689 <secondary><command>iplookup</command></secondary>
35690 </indexterm>
35691 The <command>iplookup</command> router was written to fulfil a specific requirement in
35692 Cambridge University (which in fact no longer exists). For this reason, it is
35693 not included in the binary of Exim by default. If you want to include it, you
35694 must set
35695 </para>
35696 <literallayout class="monospaced">
35697 ROUTER_IPLOOKUP=yes
35698 </literallayout>
35699 <para>
35700 in your <filename>Local/Makefile</filename> configuration file.
35701 </para>
35702 <para>
35703 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
35704 connection to one or more specific hosts. The host can then return the same or
35705 a different address &ndash; in effect rewriting the recipient address in the
35706 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
35707 this process fails, the address can be passed on to other routers, or delivery
35708 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
35709 must not be specified for it.
35710 </para>
35711 <para>
35712 <indexterm role="concept">
35713 <primary>options</primary>
35714 <secondary><command>iplookup</command> router</secondary>
35715 </indexterm>
35716 <indexterm role="option">
35717 <primary><option>hosts</option></primary>
35718 </indexterm>
35719 </para>
35720 <informaltable frame="all">
35721 <tgroup cols="4" colsep="0" rowsep="0">
35722 <colspec colwidth="8*" align="left"/>
35723 <colspec colwidth="6*" align="center"/>
35724 <colspec colwidth="6*" align="center"/>
35725 <colspec colwidth="6*" align="right"/>
35726 <tbody>
35727 <row>
35728 <entry><option>hosts</option></entry>
35729 <entry>Use: <emphasis>iplookup</emphasis></entry>
35730 <entry>Type: <emphasis>string</emphasis></entry>
35731 <entry>Default: <emphasis>unset</emphasis></entry>
35732 </row>
35733 </tbody>
35734 </tgroup>
35735 </informaltable>
35736 <para>
35737 This option must be supplied. Its value is a colon-separated list of host
35738 names. The hosts are looked up using <function>gethostbyname()</function>
35739 (or <function>getipnodebyname()</function> when available)
35740 and are tried in order until one responds to the query. If none respond, what
35741 happens is controlled by <option>optional</option>.
35742 </para>
35743 <para>
35744 <indexterm role="option">
35745 <primary><option>optional</option></primary>
35746 </indexterm>
35747 </para>
35748 <informaltable frame="all">
35749 <tgroup cols="4" colsep="0" rowsep="0">
35750 <colspec colwidth="8*" align="left"/>
35751 <colspec colwidth="6*" align="center"/>
35752 <colspec colwidth="6*" align="center"/>
35753 <colspec colwidth="6*" align="right"/>
35754 <tbody>
35755 <row>
35756 <entry><option>optional</option></entry>
35757 <entry>Use: <emphasis>iplookup</emphasis></entry>
35758 <entry>Type: <emphasis>boolean</emphasis></entry>
35759 <entry>Default: <emphasis>false</emphasis></entry>
35760 </row>
35761 </tbody>
35762 </tgroup>
35763 </informaltable>
35764 <para>
35765 If <option>optional</option> is true, if no response is obtained from any host, the address
35766 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
35767 delivery to the address is deferred.
35768 </para>
35769 <para>
35770 <indexterm role="option">
35771 <primary><option>port</option></primary>
35772 </indexterm>
35773 </para>
35774 <informaltable frame="all">
35775 <tgroup cols="4" colsep="0" rowsep="0">
35776 <colspec colwidth="8*" align="left"/>
35777 <colspec colwidth="6*" align="center"/>
35778 <colspec colwidth="6*" align="center"/>
35779 <colspec colwidth="6*" align="right"/>
35780 <tbody>
35781 <row>
35782 <entry><option>port</option></entry>
35783 <entry>Use: <emphasis>iplookup</emphasis></entry>
35784 <entry>Type: <emphasis>integer</emphasis></entry>
35785 <entry>Default: <emphasis>0</emphasis></entry>
35786 </row>
35787 </tbody>
35788 </tgroup>
35789 </informaltable>
35790 <para>
35791 <indexterm role="concept">
35792 <primary>port</primary>
35793 <secondary><command>iplookup</command> router</secondary>
35794 </indexterm>
35795 This option must be supplied. It specifies the port number for the TCP or UDP
35796 call.
35797 </para>
35798 <para>
35799 <indexterm role="option">
35800 <primary><option>protocol</option></primary>
35801 </indexterm>
35802 </para>
35803 <informaltable frame="all">
35804 <tgroup cols="4" colsep="0" rowsep="0">
35805 <colspec colwidth="8*" align="left"/>
35806 <colspec colwidth="6*" align="center"/>
35807 <colspec colwidth="6*" align="center"/>
35808 <colspec colwidth="6*" align="right"/>
35809 <tbody>
35810 <row>
35811 <entry><option>protocol</option></entry>
35812 <entry>Use: <emphasis>iplookup</emphasis></entry>
35813 <entry>Type: <emphasis>string</emphasis></entry>
35814 <entry>Default: <emphasis>udp</emphasis></entry>
35815 </row>
35816 </tbody>
35817 </tgroup>
35818 </informaltable>
35819 <para>
35820 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
35821 protocols is to be used.
35822 </para>
35823 <para>
35824 <indexterm role="option">
35825 <primary><option>query</option></primary>
35826 </indexterm>
35827 </para>
35828 <informaltable frame="all">
35829 <tgroup cols="4" colsep="0" rowsep="0">
35830 <colspec colwidth="8*" align="left"/>
35831 <colspec colwidth="6*" align="center"/>
35832 <colspec colwidth="6*" align="center"/>
35833 <colspec colwidth="6*" align="right"/>
35834 <tbody>
35835 <row>
35836 <entry><option>query</option></entry>
35837 <entry>Use: <emphasis>iplookup</emphasis></entry>
35838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35839 <entry>Default: <emphasis>see below</emphasis></entry>
35840 </row>
35841 </tbody>
35842 </tgroup>
35843 </informaltable>
35844 <para>
35845 This defines the content of the query that is sent to the remote hosts. The
35846 default value is:
35847 </para>
35848 <literallayout class="monospaced">
35849 $local_part@$domain $local_part@$domain
35850 </literallayout>
35851 <para>
35852 The repetition serves as a way of checking that a response is to the correct
35853 query in the default case (see <option>response_pattern</option> below).
35854 </para>
35855 <para>
35856 <indexterm role="option">
35857 <primary><option>reroute</option></primary>
35858 </indexterm>
35859 </para>
35860 <informaltable frame="all">
35861 <tgroup cols="4" colsep="0" rowsep="0">
35862 <colspec colwidth="8*" align="left"/>
35863 <colspec colwidth="6*" align="center"/>
35864 <colspec colwidth="6*" align="center"/>
35865 <colspec colwidth="6*" align="right"/>
35866 <tbody>
35867 <row>
35868 <entry><option>reroute</option></entry>
35869 <entry>Use: <emphasis>iplookup</emphasis></entry>
35870 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35871 <entry>Default: <emphasis>unset</emphasis></entry>
35872 </row>
35873 </tbody>
35874 </tgroup>
35875 </informaltable>
35876 <para>
35877 If this option is not set, the rerouted address is precisely the byte string
35878 returned by the remote host, up to the first white space, if any. If set, the
35879 string is expanded to form the rerouted address. It can include parts matched
35880 in the response by <option>response_pattern</option> by means of numeric variables such as
35881 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
35882 whether or not a pattern is in use. In all cases, the rerouted address must end
35883 up in the form <emphasis>local_part@domain</emphasis>.
35884 </para>
35885 <para>
35886 <indexterm role="option">
35887 <primary><option>response_pattern</option></primary>
35888 </indexterm>
35889 </para>
35890 <informaltable frame="all">
35891 <tgroup cols="4" colsep="0" rowsep="0">
35892 <colspec colwidth="8*" align="left"/>
35893 <colspec colwidth="6*" align="center"/>
35894 <colspec colwidth="6*" align="center"/>
35895 <colspec colwidth="6*" align="right"/>
35896 <tbody>
35897 <row>
35898 <entry><option>response_pattern</option></entry>
35899 <entry>Use: <emphasis>iplookup</emphasis></entry>
35900 <entry>Type: <emphasis>string</emphasis></entry>
35901 <entry>Default: <emphasis>unset</emphasis></entry>
35902 </row>
35903 </tbody>
35904 </tgroup>
35905 </informaltable>
35906 <para>
35907 This option can be set to a regular expression that is applied to the string
35908 returned from the remote host. If the pattern does not match the response, the
35909 router declines. If <option>response_pattern</option> is not set, no checking of the
35910 response is done, unless the query was defaulted, in which case there is a
35911 check that the text returned after the first white space is the original
35912 address. This checks that the answer that has been received is in response to
35913 the correct question. For example, if the response is just a new domain, the
35914 following could be used:
35915 </para>
35916 <literallayout class="monospaced">
35917 response_pattern = ^([^@]+)$
35918 reroute = $local_part@$1
35919 </literallayout>
35920 <para>
35921 <indexterm role="option">
35922 <primary><option>timeout</option></primary>
35923 </indexterm>
35924 </para>
35925 <informaltable frame="all">
35926 <tgroup cols="4" colsep="0" rowsep="0">
35927 <colspec colwidth="8*" align="left"/>
35928 <colspec colwidth="6*" align="center"/>
35929 <colspec colwidth="6*" align="center"/>
35930 <colspec colwidth="6*" align="right"/>
35931 <tbody>
35932 <row>
35933 <entry><option>timeout</option></entry>
35934 <entry>Use: <emphasis>iplookup</emphasis></entry>
35935 <entry>Type: <emphasis>time</emphasis></entry>
35936 <entry>Default: <emphasis>5s</emphasis></entry>
35937 </row>
35938 </tbody>
35939 </tgroup>
35940 </informaltable>
35941 <para>
35942 This specifies the amount of time to wait for a response from the remote
35943 machine. The same timeout is used for the <function>connect()</function> function for a TCP
35944 call. It does not apply to UDP.
35945 </para>
35946 </chapter>
35947
35948 <chapter id="CHID7">
35949 <title>The manualroute router</title>
35950 <para>
35951 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
35952 <primary><command>manualroute</command> router</primary>
35953 </indexterm>
35954 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
35955 <primary>routers</primary>
35956 <secondary><command>manualroute</command></secondary>
35957 </indexterm>
35958 <indexterm role="concept">
35959 <primary>domain</primary>
35960 <secondary>manually routing</secondary>
35961 </indexterm>
35962 The <command>manualroute</command> router is so-called because it provides a way of manually
35963 routing an address according to its domain. It is mainly used when you want to
35964 route addresses to remote hosts according to your own rules, bypassing the
35965 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
35966 route to local transports, a facility that may be useful if you want to save
35967 messages for dial-in hosts in local files.
35968 </para>
35969 <para>
35970 The <command>manualroute</command> router compares a list of domain patterns with the domain
35971 it is trying to route. If there is no match, the router declines. Each pattern
35972 has associated with it a list of hosts and some other optional data, which may
35973 include a transport. The combination of a pattern and its data is called a
35974 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
35975 generic <option>transport</option> option must specify a transport, unless the router is
35976 being used purely for verification (see <option>verify_only</option>).
35977 </para>
35978 <para>
35979 <indexterm role="variable">
35980 <primary><varname>$host</varname></primary>
35981 </indexterm>
35982 In the case of verification, matching the domain pattern is sufficient for the
35983 router to accept the address. When actually routing an address for delivery,
35984 an address that matches a domain pattern is queued for the associated
35985 transport. If the transport is not a local one, a host list must be associated
35986 with the pattern; IP addresses are looked up for the hosts, and these are
35987 passed to the transport along with the mail address. For local transports, a
35988 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
35989 text string.
35990 </para>
35991 <para>
35992 The list of routing rules can be provided as an inline string in
35993 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
35994 or database by setting <option>route_data</option>. Only one of these settings may appear in
35995 any one instance of <command>manualroute</command>. The format of routing rules is described
35996 below, following the list of private options.
35997 </para>
35998 <section id="SECTprioptman">
35999 <title>Private options for manualroute</title>
36000 <para>
36001 <indexterm role="concept">
36002 <primary>options</primary>
36003 <secondary><command>manualroute</command> router</secondary>
36004 </indexterm>
36005 The private options for the <command>manualroute</command> router are as follows:
36006 </para>
36007 <para>
36008 <indexterm role="option">
36009 <primary><option>host_all_ignored</option></primary>
36010 </indexterm>
36011 </para>
36012 <informaltable frame="all">
36013 <tgroup cols="4" colsep="0" rowsep="0">
36014 <colspec colwidth="8*" align="left"/>
36015 <colspec colwidth="6*" align="center"/>
36016 <colspec colwidth="6*" align="center"/>
36017 <colspec colwidth="6*" align="right"/>
36018 <tbody>
36019 <row>
36020 <entry><option>host_all_ignored</option></entry>
36021 <entry>Use: <emphasis>manualroute</emphasis></entry>
36022 <entry>Type: <emphasis>string</emphasis></entry>
36023 <entry>Default: <emphasis>defer</emphasis></entry>
36024 </row>
36025 </tbody>
36026 </tgroup>
36027 </informaltable>
36028 <para>
36029 See <option>host_find_failed</option>.
36030 </para>
36031 <para>
36032 <indexterm role="option">
36033 <primary><option>host_find_failed</option></primary>
36034 </indexterm>
36035 </para>
36036 <informaltable frame="all">
36037 <tgroup cols="4" colsep="0" rowsep="0">
36038 <colspec colwidth="8*" align="left"/>
36039 <colspec colwidth="6*" align="center"/>
36040 <colspec colwidth="6*" align="center"/>
36041 <colspec colwidth="6*" align="right"/>
36042 <tbody>
36043 <row>
36044 <entry><option>host_find_failed</option></entry>
36045 <entry>Use: <emphasis>manualroute</emphasis></entry>
36046 <entry>Type: <emphasis>string</emphasis></entry>
36047 <entry>Default: <emphasis>freeze</emphasis></entry>
36048 </row>
36049 </tbody>
36050 </tgroup>
36051 </informaltable>
36052 <para>
36053 This option controls what happens when <command>manualroute</command> tries to find an IP
36054 address for a host, and the host does not exist. The option can be set to one
36055 of the following values:
36056 </para>
36057 <literallayout class="monospaced">
36058 decline
36059 defer
36060 fail
36061 freeze
36062 ignore
36063 pass
36064 </literallayout>
36065 <para>
36066 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
36067 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
36068 forces the address to be passed to the next router (or the router defined by
36069 <option>pass_router</option>),
36070 <indexterm role="option">
36071 <primary><option>more</option></primary>
36072 </indexterm>
36073 overriding <option>no_more</option>, whereas the latter passes the address to the next
36074 router only if <option>more</option> is true.
36075 </para>
36076 <para>
36077 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
36078 cannot be found. If all the hosts in the list are ignored, the behaviour is
36079 controlled by the <option>host_all_ignored</option> option. This takes the same values
36080 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
36081 </para>
36082 <para>
36083 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
36084 state; if a host lookup gets a temporary error, delivery is deferred unless the
36085 generic <option>pass_on_timeout</option> option is set.
36086 </para>
36087 <para>
36088 <indexterm role="option">
36089 <primary><option>hosts_randomize</option></primary>
36090 </indexterm>
36091 </para>
36092 <informaltable frame="all">
36093 <tgroup cols="4" colsep="0" rowsep="0">
36094 <colspec colwidth="8*" align="left"/>
36095 <colspec colwidth="6*" align="center"/>
36096 <colspec colwidth="6*" align="center"/>
36097 <colspec colwidth="6*" align="right"/>
36098 <tbody>
36099 <row>
36100 <entry><option>hosts_randomize</option></entry>
36101 <entry>Use: <emphasis>manualroute</emphasis></entry>
36102 <entry>Type: <emphasis>boolean</emphasis></entry>
36103 <entry>Default: <emphasis>false</emphasis></entry>
36104 </row>
36105 </tbody>
36106 </tgroup>
36107 </informaltable>
36108 <para>
36109 <indexterm role="concept">
36110 <primary>randomized host list</primary>
36111 </indexterm>
36112 <indexterm role="concept">
36113 <primary>host</primary>
36114 <secondary>list of; randomized</secondary>
36115 </indexterm>
36116 If this option is set, the order of the items in a host list in a routing rule
36117 is randomized each time the list is used, unless an option in the routing rule
36118 overrides (see below). Randomizing the order of a host list can be used to do
36119 crude load sharing. However, if more than one mail address is routed by the
36120 same router to the same host list, the host lists are considered to be the same
36121 (even though they may be randomized into different orders) for the purpose of
36122 deciding whether to batch the deliveries into a single SMTP transaction.
36123 </para>
36124 <para>
36125 When <option>hosts_randomize</option> is true, a host list may be split
36126 into groups whose order is separately randomized. This makes it possible to
36127 set up MX-like behaviour. The boundaries between groups are indicated by an
36128 item that is just <literal>+</literal> in the host list. For example:
36129 </para>
36130 <literallayout class="monospaced">
36131 route_list = * host1:host2:host3:+:host4:host5
36132 </literallayout>
36133 <para>
36134 The order of the first three hosts and the order of the last two hosts is
36135 randomized for each use, but the first three always end up before the last two.
36136 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
36137 randomized host list is passed to an <command>smtp</command> transport that also has
36138 <option>hosts_randomize set</option>, the list is not re-randomized.
36139 </para>
36140 <para>
36141 <indexterm role="option">
36142 <primary><option>route_data</option></primary>
36143 </indexterm>
36144 </para>
36145 <informaltable frame="all">
36146 <tgroup cols="4" colsep="0" rowsep="0">
36147 <colspec colwidth="8*" align="left"/>
36148 <colspec colwidth="6*" align="center"/>
36149 <colspec colwidth="6*" align="center"/>
36150 <colspec colwidth="6*" align="right"/>
36151 <tbody>
36152 <row>
36153 <entry><option>route_data</option></entry>
36154 <entry>Use: <emphasis>manualroute</emphasis></entry>
36155 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36156 <entry>Default: <emphasis>unset</emphasis></entry>
36157 </row>
36158 </tbody>
36159 </tgroup>
36160 </informaltable>
36161 <para>
36162 If this option is set, it must expand to yield the data part of a routing rule.
36163 Typically, the expansion string includes a lookup based on the domain. For
36164 example:
36165 </para>
36166 <literallayout class="monospaced">
36167 route_data = ${lookup{$domain}dbm{/etc/routes}}
36168 </literallayout>
36169 <para>
36170 If the expansion is forced to fail, or the result is an empty string, the
36171 router declines. Other kinds of expansion failure cause delivery to be
36172 deferred.
36173 </para>
36174 <para>
36175 <indexterm role="option">
36176 <primary><option>route_list</option></primary>
36177 </indexterm>
36178 </para>
36179 <informaltable frame="all">
36180 <tgroup cols="4" colsep="0" rowsep="0">
36181 <colspec colwidth="8*" align="left"/>
36182 <colspec colwidth="6*" align="center"/>
36183 <colspec colwidth="6*" align="center"/>
36184 <colspec colwidth="6*" align="right"/>
36185 <tbody>
36186 <row>
36187 <entry><option>route_list</option></entry>
36188 <entry>Use: <emphasis>manualroute</emphasis></entry>
36189 <entry>Type: <emphasis>string list</emphasis></entry>
36190 <entry>Default: <emphasis>unset</emphasis></entry>
36191 </row>
36192 </tbody>
36193 </tgroup>
36194 </informaltable>
36195 <para>
36196 This string is a list of routing rules, in the form defined below. Note that,
36197 unlike most string lists, the items are separated by semicolons. This is so
36198 that they may contain colon-separated host lists.
36199 </para>
36200 <para>
36201 <indexterm role="option">
36202 <primary><option>same_domain_copy_routing</option></primary>
36203 </indexterm>
36204 </para>
36205 <informaltable frame="all">
36206 <tgroup cols="4" colsep="0" rowsep="0">
36207 <colspec colwidth="8*" align="left"/>
36208 <colspec colwidth="6*" align="center"/>
36209 <colspec colwidth="6*" align="center"/>
36210 <colspec colwidth="6*" align="right"/>
36211 <tbody>
36212 <row>
36213 <entry><option>same_domain_copy_routing</option></entry>
36214 <entry>Use: <emphasis>manualroute</emphasis></entry>
36215 <entry>Type: <emphasis>boolean</emphasis></entry>
36216 <entry>Default: <emphasis>false</emphasis></entry>
36217 </row>
36218 </tbody>
36219 </tgroup>
36220 </informaltable>
36221 <para>
36222 <indexterm role="concept">
36223 <primary>address</primary>
36224 <secondary>copying routing</secondary>
36225 </indexterm>
36226 Addresses with the same domain are normally routed by the <command>manualroute</command>
36227 router to the same list of hosts. However, this cannot be presumed, because the
36228 router options and preconditions may refer to the local part of the address. By
36229 default, therefore, Exim routes each address in a message independently. DNS
36230 servers run caches, so repeated DNS lookups are not normally expensive, and in
36231 any case, personal messages rarely have more than a few recipients.
36232 </para>
36233 <para>
36234 If you are running mailing lists with large numbers of subscribers at the same
36235 domain, and you are using a <command>manualroute</command> router which is independent of the
36236 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
36237 lookups for identical domains in one message. In this case, when
36238 <command>manualroute</command> routes an address to a remote transport, any other unrouted
36239 addresses in the message that have the same domain are automatically given the
36240 same routing without processing them independently. However, this is only done
36241 if <option>headers_add</option> and <option>headers_remove</option> are unset.
36242 </para>
36243 </section>
36244 <section id="SECID120">
36245 <title>Routing rules in route_list</title>
36246 <para>
36247 The value of <option>route_list</option> is a string consisting of a sequence of routing
36248 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
36249 entered as two semicolons. Alternatively, the list separator can be changed as
36250 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
36251 Empty rules are ignored. The format of each rule is
36252 </para>
36253 <literallayout>
36254 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
36255 </literallayout>
36256 <para>
36257 The following example contains two rules, each with a simple domain pattern and
36258 no options:
36259 </para>
36260 <literallayout class="monospaced">
36261 route_list = \
36262   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
36263   thes.ref.example  mail-3.ref.example:mail-4.ref.example
36264 </literallayout>
36265 <para>
36266 The three parts of a rule are separated by white space. The pattern and the
36267 list of hosts can be enclosed in quotes if necessary, and if they are, the
36268 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
36269 single domain pattern, which is the only mandatory item in the rule. The
36270 pattern is in the same format as one item in a domain list (see section
36271 <xref linkend="SECTdomainlist"/>),
36272 except that it may not be the name of an interpolated file.
36273 That is, it may be wildcarded, or a regular expression, or a file or database
36274 lookup (with semicolons doubled, because of the use of semicolon as a separator
36275 in a <option>route_list</option>).
36276 </para>
36277 <para>
36278 The rules in <option>route_list</option> are searched in order until one of the patterns
36279 matches the domain that is being routed. The list of hosts and then options are
36280 then used as described below. If there is no match, the router declines. When
36281 <option>route_list</option> is set, <option>route_data</option> must not be set.
36282 </para>
36283 </section>
36284 <section id="SECID121">
36285 <title>Routing rules in route_data</title>
36286 <para>
36287 The use of <option>route_list</option> is convenient when there are only a small number of
36288 routing rules. For larger numbers, it is easier to use a file or database to
36289 hold the routing information, and use the <option>route_data</option> option instead.
36290 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
36291 Most commonly, <option>route_data</option> is set as a string that contains an
36292 expansion lookup. For example, suppose we place two routing rules in a file
36293 like this:
36294 </para>
36295 <literallayout class="monospaced">
36296 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
36297 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
36298 </literallayout>
36299 <para>
36300 This data can be accessed by setting
36301 </para>
36302 <literallayout class="monospaced">
36303 route_data = ${lookup{$domain}lsearch{/the/file/name}}
36304 </literallayout>
36305 <para>
36306 Failure of the lookup results in an empty string, causing the router to
36307 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
36308 requirement is that the result of expanding the string is a list of hosts,
36309 possibly followed by options, separated by white space. The list of hosts must
36310 be enclosed in quotes if it contains white space.
36311 </para>
36312 </section>
36313 <section id="SECID122">
36314 <title>Format of the list of hosts</title>
36315 <para>
36316 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
36317 always separately expanded before use. If the expansion fails, the router
36318 declines. The result of the expansion must be a colon-separated list of names
36319 and/or IP addresses, optionally also including ports. The format of each item
36320 in the list is described in the next section. The list separator can be changed
36321 as described in section <xref linkend="SECTlistconstruct"/>.
36322 </para>
36323 <para>
36324 If the list of hosts was obtained from a <option>route_list</option> item, the following
36325 variables are set during its expansion:
36326 </para>
36327 <itemizedlist>
36328 <listitem>
36329 <para>
36330 <indexterm role="concept">
36331 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
36332 <secondary>in <command>manualroute</command> router</secondary>
36333 </indexterm>
36334 If the domain was matched against a regular expression, the numeric variables
36335 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
36336 </para>
36337 <literallayout class="monospaced">
36338 route_list = ^domain(\d+)   host-$1.text.example
36339 </literallayout>
36340 </listitem>
36341 <listitem>
36342 <para>
36343 <varname>$0</varname> is always set to the entire domain.
36344 </para>
36345 </listitem>
36346 <listitem>
36347 <para>
36348 <varname>$1</varname> is also set when partial matching is done in a file lookup.
36349 </para>
36350 </listitem>
36351 <listitem>
36352 <para>
36353 <indexterm role="variable">
36354 <primary><varname>$value</varname></primary>
36355 </indexterm>
36356 If the pattern that matched the domain was a lookup item, the data that was
36357 looked up is available in the expansion variable <varname>$value</varname>. For example:
36358 </para>
36359 <literallayout class="monospaced">
36360 route_list = lsearch;;/some/file.routes  $value
36361 </literallayout>
36362 </listitem>
36363 </itemizedlist>
36364 <para>
36365 Note the doubling of the semicolon in the pattern that is necessary because
36366 semicolon is the default route list separator.
36367 </para>
36368 </section>
36369 <section id="SECTformatonehostitem">
36370 <title>Format of one host item</title>
36371 <para>
36372 Each item in the list of hosts is either a host name or an IP address,
36373 optionally with an attached port number. When no port is given, an IP address
36374 is not enclosed in brackets. When a port is specified, it overrides the port
36375 specification on the transport. The port is separated from the name or address
36376 by a colon. This leads to some complications:
36377 </para>
36378 <itemizedlist>
36379 <listitem>
36380 <para>
36381 Because colon is the default separator for the list of hosts, either
36382 the colon that specifies a port must be doubled, or the list separator must
36383 be changed. The following two examples have the same effect:
36384 </para>
36385 <literallayout class="monospaced">
36386 route_list = * "host1.tld::1225 : host2.tld::1226"
36387 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
36388 </literallayout>
36389 </listitem>
36390 <listitem>
36391 <para>
36392 When IPv6 addresses are involved, it gets worse, because they contain
36393 colons of their own. To make this case easier, it is permitted to
36394 enclose an IP address (either v4 or v6) in square brackets if a port
36395 number follows. For example:
36396 </para>
36397 <literallayout class="monospaced">
36398 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
36399 </literallayout>
36400 </listitem>
36401 </itemizedlist>
36402 </section>
36403 <section id="SECThostshowused">
36404 <title>How the list of hosts is used</title>
36405 <para>
36406 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
36407 the hosts is tried, in the order specified, when carrying out the SMTP
36408 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
36409 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
36410 transport.
36411 </para>
36412 <para>
36413 Hosts may be listed by name or by IP address. An unadorned name in the list of
36414 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
36415 interpreted as an indirection to a sublist of hosts obtained by looking up MX
36416 records in the DNS. For example:
36417 </para>
36418 <literallayout class="monospaced">
36419 route_list = *  x.y.z:p.q.r/MX:e.f.g
36420 </literallayout>
36421 <para>
36422 If this feature is used with a port specifier, the port must come last. For
36423 example:
36424 </para>
36425 <literallayout class="monospaced">
36426 route_list = *  dom1.tld/mx::1225
36427 </literallayout>
36428 <para>
36429 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
36430 randomized before any lookups are done. Exim then scans the list; for any name
36431 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
36432 be an interface on the local host and the item is not the first in the list,
36433 Exim discards it and any subsequent items. If it is the first item, what
36434 happens is controlled by the
36435 <indexterm role="option">
36436 <primary><option>self</option></primary>
36437 <secondary>in <command>manualroute</command> router</secondary>
36438 </indexterm>
36439 <option>self</option> option of the router.
36440 </para>
36441 <para>
36442 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
36443 hosts obtained by looking up MX records for the name. This is always a DNS
36444 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
36445 below) are not relevant here. The order of these hosts is determined by the
36446 preference values in the MX records, according to the usual rules. Because
36447 randomizing happens before the MX lookup, it does not affect the order that is
36448 defined by MX preferences.
36449 </para>
36450 <para>
36451 If the local host is present in the sublist obtained from MX records, but is
36452 not the most preferred host in that list, it and any equally or less
36453 preferred hosts are removed before the sublist is inserted into the main list.
36454 </para>
36455 <para>
36456 If the local host is the most preferred host in the MX list, what happens
36457 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
36458 is not the first item (that is, there are previous hosts in the main list),
36459 Exim discards this name and any subsequent items in the main list.
36460 </para>
36461 <para>
36462 If the MX item is first in the list of hosts, and the local host is the
36463 most preferred host, what happens is controlled by the <option>self</option> option of the
36464 router.
36465 </para>
36466 <para>
36467 DNS failures when lookup up the MX records are treated in the same way as DNS
36468 failures when looking up IP addresses: <option>pass_on_timeout</option> and
36469 <option>host_find_failed</option> are used when relevant.
36470 </para>
36471 <para>
36472 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
36473 whether obtained from an MX lookup or not.
36474 </para>
36475 </section>
36476 <section id="SECThowoptused">
36477 <title>How the options are used</title>
36478 <para>
36479 The options are a sequence of words; in practice no more than three are ever
36480 present. One of the words can be the name of a transport; this overrides the
36481 <option>transport</option> option on the router for this particular routing rule only. The
36482 other words (if present) control randomization of the list of hosts on a
36483 per-rule basis, and how the IP addresses of the hosts are to be found when
36484 routing to a remote transport. These options are as follows:
36485 </para>
36486 <itemizedlist>
36487 <listitem>
36488 <para>
36489 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
36490 setting of <option>hosts_randomize</option> for this routing rule only.
36491 </para>
36492 </listitem>
36493 <listitem>
36494 <para>
36495 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
36496 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
36497 </para>
36498 </listitem>
36499 <listitem>
36500 <para>
36501 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
36502 find IP addresses. This function may ultimately cause a DNS lookup, but it may
36503 also look in <filename>/etc/hosts</filename> or other sources of information.
36504 </para>
36505 </listitem>
36506 <listitem>
36507 <para>
36508 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
36509 no address records are found. If there is a temporary DNS error (such as a
36510 timeout), delivery is deferred.
36511 </para>
36512 </listitem>
36513 </itemizedlist>
36514 <para>
36515 For example:
36516 </para>
36517 <literallayout class="monospaced">
36518 route_list = domain1  host1:host2:host3  randomize bydns;\
36519              domain2  host4:host5
36520 </literallayout>
36521 <para>
36522 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
36523 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
36524 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
36525 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
36526 call.
36527 </para>
36528 <para>
36529 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
36530 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
36531 instead of TRY_AGAIN. That is why the default action is to try a DNS
36532 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
36533 function called.
36534 </para>
36535 <para>
36536 If no IP address for a host can be found, what happens is controlled by the
36537 <option>host_find_failed</option> option.
36538 </para>
36539 <para>
36540 <indexterm role="variable">
36541 <primary><varname>$host</varname></primary>
36542 </indexterm>
36543 When an address is routed to a local transport, IP addresses are not looked up.
36544 The host list is passed to the transport in the <varname>$host</varname> variable.
36545 </para>
36546 </section>
36547 <section id="SECID123">
36548 <title>Manualroute examples</title>
36549 <para>
36550 In some of the examples that follow, the presence of the <option>remote_smtp</option>
36551 transport, as defined in the default configuration file, is assumed:
36552 </para>
36553 <itemizedlist>
36554 <listitem>
36555 <para>
36556 <indexterm role="concept">
36557 <primary>smart host</primary>
36558 <secondary>example router</secondary>
36559 </indexterm>
36560 The <command>manualroute</command> router can be used to forward all external mail to a
36561 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
36562 named domain list that contains your local domains, for example:
36563 </para>
36564 <literallayout class="monospaced">
36565 domainlist local_domains = my.domain.example
36566 </literallayout>
36567 <para>
36568 You can arrange for all other domains to be routed to a smart host by making
36569 your first router something like this:
36570 </para>
36571 <literallayout class="monospaced">
36572 smart_route:
36573   driver = manualroute
36574   domains = !+local_domains
36575   transport = remote_smtp
36576   route_list = * smarthost.ref.example
36577 </literallayout>
36578 <para>
36579 This causes all non-local addresses to be sent to the single host
36580 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
36581 they are tried in order
36582 (but you can use <option>hosts_randomize</option> to vary the order each time).
36583 Another way of configuring the same thing is this:
36584 </para>
36585 <literallayout class="monospaced">
36586 smart_route:
36587   driver = manualroute
36588   transport = remote_smtp
36589   route_list = !+local_domains  smarthost.ref.example
36590 </literallayout>
36591 <para>
36592 There is no difference in behaviour between these two routers as they stand.
36593 However, they behave differently if <option>no_more</option> is added to them. In the first
36594 example, the router is skipped if the domain does not match the <option>domains</option>
36595 precondition; the following router is always tried. If the router runs, it
36596 always matches the domain and so can never decline. Therefore, <option>no_more</option>
36597 would have no effect. In the second case, the router is never skipped; it
36598 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
36599 <option>no_more</option> would prevent subsequent routers from running.
36600 </para>
36601 </listitem>
36602 <listitem>
36603 <para>
36604 <indexterm role="concept">
36605 <primary>mail hub example</primary>
36606 </indexterm>
36607 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
36608 records in the DNS and delivers it via its own private routing mechanism. Often
36609 the final destinations are behind a firewall, with the mail hub being the one
36610 machine that can connect to machines both inside and outside the firewall. The
36611 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
36612 to the correct hosts. For a small number of domains, the routing can be inline,
36613 using the <option>route_list</option> option, but for a larger number a file or database
36614 lookup is easier to manage.
36615 </para>
36616 <para>
36617 If the domain names are in fact the names of the machines to which the mail is
36618 to be sent by the mail hub, the configuration can be quite simple. For
36619 example:
36620 </para>
36621 <literallayout class="monospaced">
36622 hub_route:
36623   driver = manualroute
36624   transport = remote_smtp
36625   route_list = *.rhodes.tvs.example  $domain
36626 </literallayout>
36627 <para>
36628 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
36629 whose names are the same as the mail domains. A similar approach can be taken
36630 if the host name can be obtained from the domain name by a string manipulation
36631 that the expansion facilities can handle. Otherwise, a lookup based on the
36632 domain can be used to find the host:
36633 </para>
36634 <literallayout class="monospaced">
36635 through_firewall:
36636   driver = manualroute
36637   transport = remote_smtp
36638   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
36639 </literallayout>
36640 <para>
36641 The result of the lookup must be the name or IP address of the host (or
36642 hosts) to which the address is to be routed. If the lookup fails, the route
36643 data is empty, causing the router to decline. The address then passes to the
36644 next router.
36645 </para>
36646 </listitem>
36647 <listitem>
36648 <para>
36649 <indexterm role="concept">
36650 <primary>batched SMTP output example</primary>
36651 </indexterm>
36652 <indexterm role="concept">
36653 <primary>SMTP</primary>
36654 <secondary>batched outgoing; example</secondary>
36655 </indexterm>
36656 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
36657 SMTP format for onward transportation by some other means. This is one way of
36658 storing mail for a dial-up host when it is not connected. The route list entry
36659 can be as simple as a single domain name in a configuration like this:
36660 </para>
36661 <literallayout class="monospaced">
36662 save_in_file:
36663   driver = manualroute
36664   transport = batchsmtp_appendfile
36665   route_list = saved.domain.example
36666 </literallayout>
36667 <para>
36668 though often a pattern is used to pick up more than one domain. If there are
36669 several domains or groups of domains with different transport requirements,
36670 different transports can be listed in the routing information:
36671 </para>
36672 <literallayout class="monospaced">
36673 save_in_file:
36674   driver = manualroute
36675   route_list = \
36676     *.saved.domain1.example  $domain  batch_appendfile; \
36677     *.saved.domain2.example  \
36678       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
36679       batch_pipe
36680 </literallayout>
36681 <para>
36682 <indexterm role="variable">
36683 <primary><varname>$domain</varname></primary>
36684 </indexterm>
36685 <indexterm role="variable">
36686 <primary><varname>$host</varname></primary>
36687 </indexterm>
36688 The first of these just passes the domain in the <varname>$host</varname> variable, which
36689 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
36690 file lookup to find a value to pass, causing the router to decline to handle
36691 the address if the lookup fails.
36692 </para>
36693 </listitem>
36694 <listitem>
36695 <para>
36696 <indexterm role="concept">
36697 <primary>UUCP</primary>
36698 <secondary>example of router for</secondary>
36699 </indexterm>
36700 Routing mail directly to UUCP software is a specific case of the use of
36701 <command>manualroute</command> in a gateway to another mail environment. This is an example of
36702 one way it can be done:
36703 </para>
36704 <literallayout class="monospaced">
36705 # Transport
36706 uucp:
36707   driver = pipe
36708   user = nobody
36709   command = /usr/local/bin/uux -r - \
36710     ${substr_-5:$host}!rmail ${local_part}
36711   return_fail_output = true
36712
36713 # Router
36714 uucphost:
36715   transport = uucp
36716   driver = manualroute
36717   route_data = \
36718     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
36719 </literallayout>
36720 <para>
36721 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
36722 </para>
36723 <literallayout class="monospaced">
36724 darksite.ethereal.example:           darksite.UUCP
36725 </literallayout>
36726 <para>
36727 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
36728 makes clear the distinction between the domain name
36729 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
36730 </para>
36731 </listitem>
36732 </itemizedlist>
36733 <para>
36734 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
36735 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
36736 </para>
36737 </section>
36738 </chapter>
36739
36740 <chapter id="CHAPdriverlast">
36741 <title>The queryprogram router</title>
36742 <para>
36743 <indexterm role="concept" id="IIDquerou1" class="startofrange">
36744 <primary><command>queryprogram</command> router</primary>
36745 </indexterm>
36746 <indexterm role="concept" id="IIDquerou2" class="startofrange">
36747 <primary>routers</primary>
36748 <secondary><command>queryprogram</command></secondary>
36749 </indexterm>
36750 <indexterm role="concept">
36751 <primary>routing</primary>
36752 <secondary>by external program</secondary>
36753 </indexterm>
36754 The <command>queryprogram</command> router routes an address by running an external command
36755 and acting on its output. This is an expensive way to route, and is intended
36756 mainly for use in lightly-loaded systems, or for performing experiments.
36757 However, if it is possible to use the precondition options (<option>domains</option>,
36758 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
36759 be used in special cases, even on a busy host. There are the following private
36760 options:
36761 <indexterm role="concept">
36762 <primary>options</primary>
36763 <secondary><command>queryprogram</command> router</secondary>
36764 </indexterm>
36765 </para>
36766 <para>
36767 <indexterm role="option">
36768 <primary><option>command</option></primary>
36769 </indexterm>
36770 </para>
36771 <informaltable frame="all">
36772 <tgroup cols="4" colsep="0" rowsep="0">
36773 <colspec colwidth="8*" align="left"/>
36774 <colspec colwidth="6*" align="center"/>
36775 <colspec colwidth="6*" align="center"/>
36776 <colspec colwidth="6*" align="right"/>
36777 <tbody>
36778 <row>
36779 <entry><option>command</option></entry>
36780 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36781 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36782 <entry>Default: <emphasis>unset</emphasis></entry>
36783 </row>
36784 </tbody>
36785 </tgroup>
36786 </informaltable>
36787 <para>
36788 This option must be set. It specifies the command that is to be run. The
36789 command is split up into a command name and arguments, and then each is
36790 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
36791 <xref linkend="CHAPpipetransport"/>).
36792 </para>
36793 <para>
36794 <indexterm role="option">
36795 <primary><option>command_group</option></primary>
36796 </indexterm>
36797 </para>
36798 <informaltable frame="all">
36799 <tgroup cols="4" colsep="0" rowsep="0">
36800 <colspec colwidth="8*" align="left"/>
36801 <colspec colwidth="6*" align="center"/>
36802 <colspec colwidth="6*" align="center"/>
36803 <colspec colwidth="6*" align="right"/>
36804 <tbody>
36805 <row>
36806 <entry><option>command_group</option></entry>
36807 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36808 <entry>Type: <emphasis>string</emphasis></entry>
36809 <entry>Default: <emphasis>unset</emphasis></entry>
36810 </row>
36811 </tbody>
36812 </tgroup>
36813 </informaltable>
36814 <para>
36815 <indexterm role="concept">
36816 <primary>gid (group id)</primary>
36817 <secondary>in <command>queryprogram</command> router</secondary>
36818 </indexterm>
36819 This option specifies a gid to be set when running the command while routing an
36820 address for deliver. It must be set if <option>command_user</option> specifies a numerical
36821 uid. If it begins with a digit, it is interpreted as the numerical value of the
36822 gid. Otherwise it is looked up using <function>getgrnam()</function>.
36823 </para>
36824 <para>
36825 <indexterm role="option">
36826 <primary><option>command_user</option></primary>
36827 </indexterm>
36828 </para>
36829 <informaltable frame="all">
36830 <tgroup cols="4" colsep="0" rowsep="0">
36831 <colspec colwidth="8*" align="left"/>
36832 <colspec colwidth="6*" align="center"/>
36833 <colspec colwidth="6*" align="center"/>
36834 <colspec colwidth="6*" align="right"/>
36835 <tbody>
36836 <row>
36837 <entry><option>command_user</option></entry>
36838 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36839 <entry>Type: <emphasis>string</emphasis></entry>
36840 <entry>Default: <emphasis>unset</emphasis></entry>
36841 </row>
36842 </tbody>
36843 </tgroup>
36844 </informaltable>
36845 <para>
36846 <indexterm role="concept">
36847 <primary>uid (user id)</primary>
36848 <secondary>for <command>queryprogram</command></secondary>
36849 </indexterm>
36850 This option must be set. It specifies the uid which is set when running the
36851 command while routing an address for delivery. If the value begins with a digit,
36852 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
36853 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
36854 not set, a value for the gid also.
36855 </para>
36856 <para>
36857 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
36858 root, which it does during a normal delivery in a conventional configuration.
36859 However, when an address is being verified during message reception, Exim is
36860 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
36861 is called from a non-root process, Exim cannot change uid or gid before running
36862 the command. In this circumstance the command runs under the current uid and
36863 gid.
36864 </para>
36865 <para>
36866 <indexterm role="option">
36867 <primary><option>current_directory</option></primary>
36868 </indexterm>
36869 </para>
36870 <informaltable frame="all">
36871 <tgroup cols="4" colsep="0" rowsep="0">
36872 <colspec colwidth="8*" align="left"/>
36873 <colspec colwidth="6*" align="center"/>
36874 <colspec colwidth="6*" align="center"/>
36875 <colspec colwidth="6*" align="right"/>
36876 <tbody>
36877 <row>
36878 <entry><option>current_directory</option></entry>
36879 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36880 <entry>Type: <emphasis>string</emphasis></entry>
36881 <entry>Default: <emphasis>/</emphasis></entry>
36882 </row>
36883 </tbody>
36884 </tgroup>
36885 </informaltable>
36886 <para>
36887 This option specifies an absolute path which is made the current directory
36888 before running the command.
36889 </para>
36890 <para>
36891 <indexterm role="option">
36892 <primary><option>timeout</option></primary>
36893 </indexterm>
36894 </para>
36895 <informaltable frame="all">
36896 <tgroup cols="4" colsep="0" rowsep="0">
36897 <colspec colwidth="8*" align="left"/>
36898 <colspec colwidth="6*" align="center"/>
36899 <colspec colwidth="6*" align="center"/>
36900 <colspec colwidth="6*" align="right"/>
36901 <tbody>
36902 <row>
36903 <entry><option>timeout</option></entry>
36904 <entry>Use: <emphasis>queryprogram</emphasis></entry>
36905 <entry>Type: <emphasis>time</emphasis></entry>
36906 <entry>Default: <emphasis>1h</emphasis></entry>
36907 </row>
36908 </tbody>
36909 </tgroup>
36910 </informaltable>
36911 <para>
36912 If the command does not complete within the timeout period, its process group
36913 is killed and the message is frozen. A value of zero time specifies no
36914 timeout.
36915 </para>
36916 <para>
36917 The standard output of the command is connected to a pipe, which is read when
36918 the command terminates. It should consist of a single line of output,
36919 containing up to five fields, separated by white space. The maximum length of
36920 the line is 1023 characters. Longer lines are silently truncated. The first
36921 field is one of the following words (case-insensitive):
36922 </para>
36923 <itemizedlist>
36924 <listitem>
36925 <para>
36926 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
36927 below).
36928 </para>
36929 </listitem>
36930 <listitem>
36931 <para>
36932 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
36933 <option>no_more</option> is set.
36934 </para>
36935 </listitem>
36936 <listitem>
36937 <para>
36938 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
36939 subsequent text on the line is an error message. If the router is run as part
36940 of address verification during an incoming SMTP message, the message is
36941 included in the SMTP response.
36942 </para>
36943 </listitem>
36944 <listitem>
36945 <para>
36946 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
36947 subsequent text on the line is an error message which is logged. It is not
36948 included in any SMTP response.
36949 </para>
36950 </listitem>
36951 <listitem>
36952 <para>
36953 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
36954 </para>
36955 </listitem>
36956 <listitem>
36957 <para>
36958 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
36959 <option>pass_router</option>), overriding <option>no_more</option>.
36960 </para>
36961 </listitem>
36962 <listitem>
36963 <para>
36964 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
36965 new addresses, which are routed independently, starting with the first router,
36966 or the router specified by <option>redirect_router</option>, if set.
36967 </para>
36968 </listitem>
36969 </itemizedlist>
36970 <para>
36971 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
36972 number of keyed data values, as follows (split into two lines here, to fit on
36973 the page):
36974 </para>
36975 <literallayout class="monospaced">
36976 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
36977 LOOKUP=byname|bydns DATA=&lt;text&gt;
36978 </literallayout>
36979 <para>
36980 The data items can be given in any order, and all are optional. If no transport
36981 is included, the transport specified by the generic <option>transport</option> option is
36982 used. The list of hosts and the lookup type are needed only if the transport is
36983 an <command>smtp</command> transport that does not itself supply a list of hosts.
36984 </para>
36985 <para>
36986 The format of the list of hosts is the same as for the <command>manualroute</command> router.
36987 As well as host names and IP addresses with optional port numbers, as described
36988 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
36989 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
36990 (see section <xref linkend="SECThostshowused"/>).
36991 </para>
36992 <para>
36993 If the lookup type is not specified, Exim behaves as follows when trying to
36994 find an IP address for each host: First, a DNS lookup is done. If this yields
36995 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
36996 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
36997 result of the lookup is the result of that call.
36998 </para>
36999 <para>
37000 <indexterm role="variable">
37001 <primary><varname>$address_data</varname></primary>
37002 </indexterm>
37003 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
37004 variable. For example, this return line
37005 </para>
37006 <literallayout class="monospaced">
37007 accept hosts=x1.y.example:x2.y.example data="rule1"
37008 </literallayout>
37009 <para>
37010 routes the address to the default transport, passing a list of two hosts. When
37011 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
37012 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
37013 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
37014 </para>
37015 </chapter>
37016
37017 <chapter id="CHAPredirect">
37018 <title>The redirect router</title>
37019 <para>
37020 <indexterm role="concept" id="IIDredrou1" class="startofrange">
37021 <primary><command>redirect</command> router</primary>
37022 </indexterm>
37023 <indexterm role="concept" id="IIDredrou2" class="startofrange">
37024 <primary>routers</primary>
37025 <secondary><command>redirect</command></secondary>
37026 </indexterm>
37027 <indexterm role="concept">
37028 <primary>alias file</primary>
37029 <secondary>in a <command>redirect</command> router</secondary>
37030 </indexterm>
37031 <indexterm role="concept">
37032 <primary>address redirection</primary>
37033 <secondary><command>redirect</command> router</secondary>
37034 </indexterm>
37035 The <command>redirect</command> router handles several kinds of address redirection. Its most
37036 common uses are for resolving local part aliases from a central alias file
37037 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
37038 files, but it has many other potential uses. The incoming address can be
37039 redirected in several different ways:
37040 </para>
37041 <itemizedlist>
37042 <listitem>
37043 <para>
37044 It can be replaced by one or more new addresses which are themselves routed
37045 independently.
37046 </para>
37047 </listitem>
37048 <listitem>
37049 <para>
37050 It can be routed to be delivered to a given file or directory.
37051 </para>
37052 </listitem>
37053 <listitem>
37054 <para>
37055 It can be routed to be delivered to a specified pipe command.
37056 </para>
37057 </listitem>
37058 <listitem>
37059 <para>
37060 It can cause an automatic reply to be generated.
37061 </para>
37062 </listitem>
37063 <listitem>
37064 <para>
37065 It can be forced to fail, optionally with a custom error message.
37066 </para>
37067 </listitem>
37068 <listitem>
37069 <para>
37070 It can be temporarily deferred, optionally with a custom message.
37071 </para>
37072 </listitem>
37073 <listitem>
37074 <para>
37075 It can be discarded.
37076 </para>
37077 </listitem>
37078 </itemizedlist>
37079 <para>
37080 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
37081 However, there are some private options which define transports for delivery to
37082 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
37083 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
37084 </para>
37085 <para>
37086 If success DSNs have been requested
37087 <indexterm role="concept">
37088 <primary>DSN</primary>
37089 <secondary>success</secondary>
37090 </indexterm>
37091 <indexterm role="concept">
37092 <primary>Delivery Status Notification</primary>
37093 <secondary>success</secondary>
37094 </indexterm>
37095 redirection triggers one and the DSN options are not passed any further.
37096 </para>
37097 <section id="SECID124">
37098 <title>Redirection data</title>
37099 <para>
37100 The router operates by interpreting a text string which it obtains either by
37101 expanding the contents of the <option>data</option> option, or by reading the entire
37102 contents of a file whose name is given in the <option>file</option> option. These two
37103 options are mutually exclusive. The first is commonly used for handling system
37104 aliases, in a configuration like this:
37105 </para>
37106 <literallayout class="monospaced">
37107 system_aliases:
37108   driver = redirect
37109   data = ${lookup{$local_part}lsearch{/etc/aliases}}
37110 </literallayout>
37111 <para>
37112 If the lookup fails, the expanded string in this example is empty. When the
37113 expansion of <option>data</option> results in an empty string, the router declines. A forced
37114 expansion failure also causes the router to decline; other expansion failures
37115 cause delivery to be deferred.
37116 </para>
37117 <para>
37118 A configuration using <option>file</option> is commonly used for handling users&#x2019;
37119 <filename>.forward</filename> files, like this:
37120 </para>
37121 <literallayout class="monospaced">
37122 userforward:
37123   driver = redirect
37124   check_local_user
37125   file = $home/.forward
37126   no_verify
37127 </literallayout>
37128 <para>
37129 If the file does not exist, or causes no action to be taken (for example, it is
37130 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
37131 is not the case when the file contains syntactically valid items that happen to
37132 yield empty addresses, for example, items containing only RFC 2822 address
37133 comments.
37134 </para>
37135 </section>
37136 <section id="SECID125">
37137 <title>Forward files and address verification</title>
37138 <para>
37139 <indexterm role="concept">
37140 <primary>address redirection</primary>
37141 <secondary>while verifying</secondary>
37142 </indexterm>
37143 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
37144 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
37145 </para>
37146 <itemizedlist>
37147 <listitem>
37148 <para>
37149 When Exim is receiving an incoming SMTP message from a remote host, it is
37150 running under the Exim uid, not as root. Exim is unable to change uid to read
37151 the file as the user, and it may not be able to read it as the Exim user. So in
37152 practice the router may not be able to operate.
37153 </para>
37154 </listitem>
37155 <listitem>
37156 <para>
37157 However, even when the router can operate, the existence of a <filename>.forward</filename> file
37158 is unimportant when verifying an address. What should be checked is whether the
37159 local part is a valid user name or not. Cutting out the redirection processing
37160 saves some resources.
37161 </para>
37162 </listitem>
37163 </itemizedlist>
37164 </section>
37165 <section id="SECID126">
37166 <title>Interpreting redirection data</title>
37167 <para>
37168 <indexterm role="concept">
37169 <primary>Sieve filter</primary>
37170 <secondary>specifying in redirection data</secondary>
37171 </indexterm>
37172 <indexterm role="concept">
37173 <primary>filter</primary>
37174 <secondary>specifying in redirection data</secondary>
37175 </indexterm>
37176 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
37177 can be interpreted in two different ways:
37178 </para>
37179 <itemizedlist>
37180 <listitem>
37181 <para>
37182 If the <option>allow_filter</option> option is set true, and the data begins with the text
37183 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
37184 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
37185 respectively. Details of the syntax and semantics of filter files are described
37186 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
37187 document is intended for use by end users.
37188 </para>
37189 </listitem>
37190 <listitem>
37191 <para>
37192 Otherwise, the data must be a comma-separated list of redirection items, as
37193 described in the next section.
37194 </para>
37195 </listitem>
37196 </itemizedlist>
37197 <para>
37198 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
37199 in a non-filter redirection list must always be an absolute path. A filter may
37200 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
37201 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
37202 for the <command>appendfile</command> transport.
37203 </para>
37204 </section>
37205 <section id="SECTitenonfilred">
37206 <title>Items in a non-filter redirection list</title>
37207 <para>
37208 <indexterm role="concept">
37209 <primary>address redirection</primary>
37210 <secondary>non-filter list items</secondary>
37211 </indexterm>
37212 When the redirection data is not an Exim or Sieve filter, for example, if it
37213 comes from a conventional alias or forward file, it consists of a list of
37214 addresses, file names, pipe commands, or certain special items (see section
37215 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
37216 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
37217 depending on their default values. The items in the list are separated by
37218 commas or newlines.
37219 If a comma is required in an item, the entire item must be enclosed in double
37220 quotes.
37221 </para>
37222 <para>
37223 Lines starting with a # character are comments, and are ignored, and # may
37224 also appear following a comma, in which case everything between the # and the
37225 next newline character is ignored.
37226 </para>
37227 <para>
37228 If an item is entirely enclosed in double quotes, these are removed. Otherwise
37229 double quotes are retained because some forms of mail address require their use
37230 (but never to enclose the entire address). In the following description,
37231 <quote>item</quote> refers to what remains after any surrounding double quotes have been
37232 removed.
37233 </para>
37234 <para>
37235 <indexterm role="variable">
37236 <primary><varname>$local_part</varname></primary>
37237 </indexterm>
37238 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
37239 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
37240 of the <option>quote_local_part</option> expansion operator, in case the local part contains
37241 special characters. For example, to redirect all mail for the domain
37242 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
37243 setting:
37244 </para>
37245 <literallayout class="monospaced">
37246 data = ${quote_local_part:$local_part}@newdomain.example
37247 </literallayout>
37248 </section>
37249 <section id="SECTredlocmai">
37250 <title>Redirecting to a local mailbox</title>
37251 <para>
37252 <indexterm role="concept">
37253 <primary>routing</primary>
37254 <secondary>loops in</secondary>
37255 </indexterm>
37256 <indexterm role="concept">
37257 <primary>loop</primary>
37258 <secondary>while routing, avoidance of</secondary>
37259 </indexterm>
37260 <indexterm role="concept">
37261 <primary>address redirection</primary>
37262 <secondary>to local mailbox</secondary>
37263 </indexterm>
37264 A redirection item may safely be the same as the address currently under
37265 consideration. This does not cause a routing loop, because a router is
37266 automatically skipped if any ancestor of the address that is being processed
37267 is the same as the current address and was processed by the current router.
37268 Such an address is therefore passed to the following routers, so it is handled
37269 as if there were no redirection. When making this loop-avoidance test, the
37270 complete local part, including any prefix or suffix, is used.
37271 </para>
37272 <para>
37273 <indexterm role="concept">
37274 <primary>address redirection</primary>
37275 <secondary>local part without domain</secondary>
37276 </indexterm>
37277 Specifying the same local part without a domain is a common usage in personal
37278 filter files when the user wants to have messages delivered to the local
37279 mailbox and also forwarded elsewhere. For example, the user whose login is
37280 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
37281 </para>
37282 <literallayout class="monospaced">
37283 cleo, cleopatra@egypt.example
37284 </literallayout>
37285 <para>
37286 <indexterm role="concept">
37287 <primary>backslash in alias file</primary>
37288 </indexterm>
37289 <indexterm role="concept">
37290 <primary>alias file</primary>
37291 <secondary>backslash in</secondary>
37292 </indexterm>
37293 For compatibility with other MTAs, such unqualified local parts may be
37294 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
37295 it does make a difference if more than one domain is being handled
37296 synonymously.
37297 </para>
37298 <para>
37299 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
37300 2822 address that does not include a domain, the item is qualified using the
37301 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
37302 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
37303 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
37304 </para>
37305 <para>
37306 Care must be taken if there are alias names for local users.
37307 Consider an MTA handling a single local domain where the system alias file
37308 contains:
37309 </para>
37310 <literallayout class="monospaced">
37311 Sam.Reman: spqr
37312 </literallayout>
37313 <para>
37314 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
37315 messages in the local mailbox, and also forward copies elsewhere. He creates
37316 this forward file:
37317 </para>
37318 <literallayout class="monospaced">
37319 Sam.Reman, spqr@reme.elsewhere.example
37320 </literallayout>
37321 <para>
37322 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
37323 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
37324 second time round, because it has previously routed it,
37325 and the following routers presumably cannot handle the alias. The forward file
37326 should really contain
37327 </para>
37328 <literallayout class="monospaced">
37329 spqr, spqr@reme.elsewhere.example
37330 </literallayout>
37331 <para>
37332 but because this is such a common error, the <option>check_ancestor</option> option (see
37333 below) exists to provide a way to get round it. This is normally set on a
37334 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
37335 </para>
37336 </section>
37337 <section id="SECTspecitredli">
37338 <title>Special items in redirection lists</title>
37339 <para>
37340 In addition to addresses, the following types of item may appear in redirection
37341 lists (that is, in non-filter redirection data):
37342 </para>
37343 <itemizedlist>
37344 <listitem>
37345 <para>
37346 <indexterm role="concept">
37347 <primary>pipe</primary>
37348 <secondary>in redirection list</secondary>
37349 </indexterm>
37350 <indexterm role="concept">
37351 <primary>address redirection</primary>
37352 <secondary>to pipe</secondary>
37353 </indexterm>
37354 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
37355 as a valid RFC 2822 address that includes a domain. A transport for running the
37356 command must be specified by the <option>pipe_transport</option> option.
37357 Normally, either the router or the transport specifies a user and a group under
37358 which to run the delivery. The default is to use the Exim user and group.
37359 </para>
37360 <para>
37361 Single or double quotes can be used for enclosing the individual arguments of
37362 the pipe command; no interpretation of escapes is done for single quotes. If
37363 the command contains a comma character, it is necessary to put the whole item
37364 in double quotes, for example:
37365 </para>
37366 <literallayout class="monospaced">
37367 "|/some/command ready,steady,go"
37368 </literallayout>
37369 <para>
37370 since items in redirection lists are terminated by commas. Do not, however,
37371 quote just the command. An item such as
37372 </para>
37373 <literallayout class="monospaced">
37374 |"/some/command ready,steady,go"
37375 </literallayout>
37376 <para>
37377 is interpreted as a pipe with a rather strange command name, and no arguments.
37378 </para>
37379 <para>
37380 Note that the above example assumes that the text comes from a lookup source
37381 of some sort, so that the quotes are part of the data.  If composing a
37382 redirect router with a <option>data</option> option directly specifying this command, the
37383 quotes will be used by the configuration parser to define the extent of one
37384 string, but will not be passed down into the redirect router itself.  There
37385 are two main approaches to get around this: escape quotes to be part of the
37386 data itself, or avoid using this mechanism and instead create a custom
37387 transport with the <option>command</option> option set and reference that transport from
37388 an <option>accept</option> router.
37389 </para>
37390 </listitem>
37391 <listitem>
37392 <para>
37393 <indexterm role="concept">
37394 <primary>file</primary>
37395 <secondary>in redirection list</secondary>
37396 </indexterm>
37397 <indexterm role="concept">
37398 <primary>address redirection</primary>
37399 <secondary>to file</secondary>
37400 </indexterm>
37401 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
37402 parse as a valid RFC 2822 address that includes a domain. For example,
37403 </para>
37404 <literallayout class="monospaced">
37405 /home/world/minbari
37406 </literallayout>
37407 <para>
37408 is treated as a file name, but
37409 </para>
37410 <literallayout class="monospaced">
37411 /s=molari/o=babylon/@x400gate.way
37412 </literallayout>
37413 <para>
37414 is treated as an address. For a file name, a transport must be specified using
37415 the <option>file_transport</option> option. However, if the generated path name ends with a
37416 forward slash character, it is interpreted as a directory name rather than a
37417 file name, and <option>directory_transport</option> is used instead.
37418 </para>
37419 <para>
37420 Normally, either the router or the transport specifies a user and a group under
37421 which to run the delivery. The default is to use the Exim user and group.
37422 </para>
37423 <para>
37424 <indexterm role="concept">
37425 <primary><filename>/dev/null</filename></primary>
37426 </indexterm>
37427 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
37428 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
37429 instead of a transport name. In this case the user and group are not used.
37430 </para>
37431 </listitem>
37432 <listitem>
37433 <para>
37434 <indexterm role="concept">
37435 <primary>included address list</primary>
37436 </indexterm>
37437 <indexterm role="concept">
37438 <primary>address redirection</primary>
37439 <secondary>included external list</secondary>
37440 </indexterm>
37441 If an item is of the form
37442 </para>
37443 <literallayout class="monospaced">
37444 :include:&lt;path name&gt;
37445 </literallayout>
37446 <para>
37447 a list of further items is taken from the given file and included at that
37448 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
37449 out-of-line addition to the list. The items in the included list are separated
37450 by commas or newlines and are not subject to expansion. If this is the first
37451 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
37452 the alias name. This example is incorrect:
37453 </para>
37454 <literallayout class="monospaced">
37455 list1    :include:/opt/lists/list1
37456 </literallayout>
37457 <para>
37458 It must be given as
37459 </para>
37460 <literallayout class="monospaced">
37461 list1:   :include:/opt/lists/list1
37462 </literallayout>
37463 </listitem>
37464 <listitem>
37465 <para>
37466 <indexterm role="concept">
37467 <primary>address redirection</primary>
37468 <secondary>to black hole</secondary>
37469 </indexterm>
37470 <indexterm role="concept">
37471 <primary>delivery</primary>
37472 <secondary>discard</secondary>
37473 </indexterm>
37474 <indexterm role="concept">
37475 <primary>delivery</primary>
37476 <secondary>blackhole</secondary>
37477 </indexterm>
37478 <indexterm role="concept">
37479 <primary>black hole</primary>
37480 </indexterm>
37481 <indexterm role="concept">
37482 <primary>abandoning mail</primary>
37483 </indexterm>
37484 Sometimes you want to throw away mail to a particular local part.  Making the
37485 <option>data</option> option expand to an empty string does not work, because that causes
37486 the router to decline. Instead, the alias item
37487 </para>
37488 <literallayout class="monospaced">
37489 :blackhole:
37490 </literallayout>
37491 <para>
37492 can be used. It does what its name implies. No delivery is
37493 done, and no error message is generated. This has the same effect as specifying
37494 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
37495 </para>
37496 <para>
37497 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
37498 delivery is done for the original local part, even if other redirection items
37499 are present. If you are generating a multi-item list (for example, by reading a
37500 database) and need the ability to provide a no-op item, you must use
37501 <filename>/dev/null</filename>.
37502 </para>
37503 </listitem>
37504 <listitem>
37505 <para>
37506 <indexterm role="concept">
37507 <primary>delivery</primary>
37508 <secondary>forcing failure</secondary>
37509 </indexterm>
37510 <indexterm role="concept">
37511 <primary>delivery</primary>
37512 <secondary>forcing deferral</secondary>
37513 </indexterm>
37514 <indexterm role="concept">
37515 <primary>failing delivery</primary>
37516 <secondary>forcing</secondary>
37517 </indexterm>
37518 <indexterm role="concept">
37519 <primary>deferred delivery, forcing</primary>
37520 </indexterm>
37521 <indexterm role="concept">
37522 <primary>customizing</primary>
37523 <secondary>failure message</secondary>
37524 </indexterm>
37525 An attempt to deliver a particular address can be deferred or forced to fail by
37526 redirection items of the form
37527 </para>
37528 <literallayout class="monospaced">
37529 :defer:
37530 :fail:
37531 </literallayout>
37532 <para>
37533 respectively. When a redirection list contains such an item, it applies
37534 to the entire redirection; any other items in the list are ignored. Any
37535 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
37536 associated with the failure. For example, an alias file might contain:
37537 </para>
37538 <literallayout class="monospaced">
37539 X.Employee:  :fail: Gone away, no forwarding address
37540 </literallayout>
37541 <para>
37542 In the case of an address that is being verified from an ACL or as the subject
37543 of a
37544 <indexterm role="concept">
37545 <primary>VRFY</primary>
37546 <secondary>error text, display of</secondary>
37547 </indexterm>
37548 VRFY command, the text is included in the SMTP error response by
37549 default.
37550 <indexterm role="concept">
37551 <primary>EXPN</primary>
37552 <secondary>error text, display of</secondary>
37553 </indexterm>
37554 The text is not included in the response to an EXPN command. In non-SMTP cases
37555 the text is included in the error message that Exim generates.
37556 </para>
37557 <para>
37558 <indexterm role="concept">
37559 <primary>SMTP</primary>
37560 <secondary>error codes</secondary>
37561 </indexterm>
37562 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
37563 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
37564 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
37565 followed by a space, and the very first digit is the same as the default error
37566 code, the code from the message is used instead. If the very first digit is
37567 incorrect, a panic error is logged, and the default code is used. You can
37568 suppress the use of the supplied code in a redirect router by setting the
37569 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
37570 ignored.
37571 </para>
37572 <para>
37573 <indexterm role="variable">
37574 <primary><varname>$acl_verify_message</varname></primary>
37575 </indexterm>
37576 In an ACL, an explicitly provided message overrides the default, but the
37577 default message is available in the variable <varname>$acl_verify_message</varname> and can
37578 therefore be included in a custom message if this is desired.
37579 </para>
37580 <para>
37581 Normally the error text is the rest of the redirection list &ndash; a comma does
37582 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
37583 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
37584 as part of the continuation process, but they may exist in other kinds of
37585 lookup and in <emphasis>:include:</emphasis> files.
37586 </para>
37587 <para>
37588 During routing for message delivery (as opposed to verification), a redirection
37589 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
37590 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
37591 subsequent delivery attempt can happen at a later time. If an address is
37592 deferred for too long, it will ultimately fail, because the normal retry
37593 rules still apply.
37594 </para>
37595 </listitem>
37596 <listitem>
37597 <para>
37598 <indexterm role="concept">
37599 <primary>alias file</primary>
37600 <secondary>exception to default</secondary>
37601 </indexterm>
37602 Sometimes it is useful to use a single-key search type with a default (see
37603 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
37604 for exceptions to the default. These can be handled by aliasing them to
37605 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
37606 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
37607 results in an empty redirection list has the same effect.
37608 </para>
37609 </listitem>
37610 </itemizedlist>
37611 </section>
37612 <section id="SECTdupaddr">
37613 <title>Duplicate addresses</title>
37614 <para>
37615 <indexterm role="concept">
37616 <primary>duplicate addresses</primary>
37617 </indexterm>
37618 <indexterm role="concept">
37619 <primary>address duplicate, discarding</primary>
37620 </indexterm>
37621 <indexterm role="concept">
37622 <primary>pipe</primary>
37623 <secondary>duplicated</secondary>
37624 </indexterm>
37625 Exim removes duplicate addresses from the list to which it is delivering, so as
37626 to deliver just one copy to each address. This does not apply to deliveries
37627 routed to pipes by different immediate parent addresses, but an indirect
37628 aliasing scheme of the type
37629 </para>
37630 <literallayout class="monospaced">
37631 pipe:       |/some/command $local_part
37632 localpart1: pipe
37633 localpart2: pipe
37634 </literallayout>
37635 <para>
37636 does not work with a message that is addressed to both local parts, because
37637 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
37638 discarded as being the same as a previously handled address. However, a scheme
37639 such as
37640 </para>
37641 <literallayout class="monospaced">
37642 localpart1: |/some/command $local_part
37643 localpart2: |/some/command $local_part
37644 </literallayout>
37645 <para>
37646 does result in two different pipe deliveries, because the immediate parents of
37647 the pipes are distinct.
37648 </para>
37649 </section>
37650 <section id="SECID128">
37651 <title>Repeated redirection expansion</title>
37652 <para>
37653 <indexterm role="concept">
37654 <primary>repeated redirection expansion</primary>
37655 </indexterm>
37656 <indexterm role="concept">
37657 <primary>address redirection</primary>
37658 <secondary>repeated for each delivery attempt</secondary>
37659 </indexterm>
37660 When a message cannot be delivered to all of its recipients immediately,
37661 leading to two or more delivery attempts, redirection expansion is carried out
37662 afresh each time for those addresses whose children were not all previously
37663 delivered. If redirection is being used as a mailing list, this can lead to new
37664 members of the list receiving copies of old messages. The <option>one_time</option> option
37665 can be used to avoid this.
37666 </para>
37667 </section>
37668 <section id="SECID129">
37669 <title>Errors in redirection lists</title>
37670 <para>
37671 <indexterm role="concept">
37672 <primary>address redirection</primary>
37673 <secondary>errors</secondary>
37674 </indexterm>
37675 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
37676 error is skipped, and an entry is written to the main log. This may be useful
37677 for mailing lists that are automatically managed. Otherwise, if an error is
37678 detected while generating the list of new addresses, the original address is
37679 deferred. See also <option>syntax_errors_to</option>.
37680 </para>
37681 </section>
37682 <section id="SECID130">
37683 <title>Private options for the redirect router</title>
37684 <para>
37685 <indexterm role="concept">
37686 <primary>options</primary>
37687 <secondary><command>redirect</command> router</secondary>
37688 </indexterm>
37689 The private options for the <command>redirect</command> router are as follows:
37690 </para>
37691 <para>
37692 <indexterm role="option">
37693 <primary><option>allow_defer</option></primary>
37694 </indexterm>
37695 </para>
37696 <informaltable frame="all">
37697 <tgroup cols="4" colsep="0" rowsep="0">
37698 <colspec colwidth="8*" align="left"/>
37699 <colspec colwidth="6*" align="center"/>
37700 <colspec colwidth="6*" align="center"/>
37701 <colspec colwidth="6*" align="right"/>
37702 <tbody>
37703 <row>
37704 <entry><option>allow_defer</option></entry>
37705 <entry>Use: <emphasis>redirect</emphasis></entry>
37706 <entry>Type: <emphasis>boolean</emphasis></entry>
37707 <entry>Default: <emphasis>false</emphasis></entry>
37708 </row>
37709 </tbody>
37710 </tgroup>
37711 </informaltable>
37712 <para>
37713 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
37714 data, or the <option>defer</option> command in an Exim filter file.
37715 </para>
37716 <para>
37717 <indexterm role="option">
37718 <primary><option>allow_fail</option></primary>
37719 </indexterm>
37720 </para>
37721 <informaltable frame="all">
37722 <tgroup cols="4" colsep="0" rowsep="0">
37723 <colspec colwidth="8*" align="left"/>
37724 <colspec colwidth="6*" align="center"/>
37725 <colspec colwidth="6*" align="center"/>
37726 <colspec colwidth="6*" align="right"/>
37727 <tbody>
37728 <row>
37729 <entry><option>allow_fail</option></entry>
37730 <entry>Use: <emphasis>redirect</emphasis></entry>
37731 <entry>Type: <emphasis>boolean</emphasis></entry>
37732 <entry>Default: <emphasis>false</emphasis></entry>
37733 </row>
37734 </tbody>
37735 </tgroup>
37736 </informaltable>
37737 <para>
37738 <indexterm role="concept">
37739 <primary>failing delivery</primary>
37740 <secondary>from filter</secondary>
37741 </indexterm>
37742 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
37743 and the <option>fail</option> command may be used in an Exim filter file.
37744 </para>
37745 <para>
37746 <indexterm role="option">
37747 <primary><option>allow_filter</option></primary>
37748 </indexterm>
37749 </para>
37750 <informaltable frame="all">
37751 <tgroup cols="4" colsep="0" rowsep="0">
37752 <colspec colwidth="8*" align="left"/>
37753 <colspec colwidth="6*" align="center"/>
37754 <colspec colwidth="6*" align="center"/>
37755 <colspec colwidth="6*" align="right"/>
37756 <tbody>
37757 <row>
37758 <entry><option>allow_filter</option></entry>
37759 <entry>Use: <emphasis>redirect</emphasis></entry>
37760 <entry>Type: <emphasis>boolean</emphasis></entry>
37761 <entry>Default: <emphasis>false</emphasis></entry>
37762 </row>
37763 </tbody>
37764 </tgroup>
37765 </informaltable>
37766 <para>
37767 <indexterm role="concept">
37768 <primary>filter</primary>
37769 <secondary>enabling use of</secondary>
37770 </indexterm>
37771 <indexterm role="concept">
37772 <primary>Sieve filter</primary>
37773 <secondary>enabling use of</secondary>
37774 </indexterm>
37775 Setting this option allows Exim to interpret redirection data that starts with
37776 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
37777 are some features of Exim filter files that some administrators may wish to
37778 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
37779 </para>
37780 <para>
37781 It is also possible to lock out Exim filters or Sieve filters while allowing
37782 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
37783 </para>
37784 <para>
37785 The filter is run using the uid and gid set by the generic <option>user</option> and
37786 <option>group</option> options. These take their defaults from the password data if
37787 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
37788 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
37789 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
37790 </para>
37791 <para>
37792 <indexterm role="option">
37793 <primary><option>allow_freeze</option></primary>
37794 </indexterm>
37795 </para>
37796 <informaltable frame="all">
37797 <tgroup cols="4" colsep="0" rowsep="0">
37798 <colspec colwidth="8*" align="left"/>
37799 <colspec colwidth="6*" align="center"/>
37800 <colspec colwidth="6*" align="center"/>
37801 <colspec colwidth="6*" align="right"/>
37802 <tbody>
37803 <row>
37804 <entry><option>allow_freeze</option></entry>
37805 <entry>Use: <emphasis>redirect</emphasis></entry>
37806 <entry>Type: <emphasis>boolean</emphasis></entry>
37807 <entry>Default: <emphasis>false</emphasis></entry>
37808 </row>
37809 </tbody>
37810 </tgroup>
37811 </informaltable>
37812 <para>
37813 <indexterm role="concept">
37814 <primary>freezing messages</primary>
37815 <secondary>allowing in filter</secondary>
37816 </indexterm>
37817 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
37818 This command is more normally encountered in system filters, and is disabled by
37819 default for redirection filters because it isn&#x2019;t something you usually want to
37820 let ordinary users do.
37821 </para>
37822 <para>
37823 <indexterm role="option">
37824 <primary><option>check_ancestor</option></primary>
37825 </indexterm>
37826 </para>
37827 <informaltable frame="all">
37828 <tgroup cols="4" colsep="0" rowsep="0">
37829 <colspec colwidth="8*" align="left"/>
37830 <colspec colwidth="6*" align="center"/>
37831 <colspec colwidth="6*" align="center"/>
37832 <colspec colwidth="6*" align="right"/>
37833 <tbody>
37834 <row>
37835 <entry><option>check_ancestor</option></entry>
37836 <entry>Use: <emphasis>redirect</emphasis></entry>
37837 <entry>Type: <emphasis>boolean</emphasis></entry>
37838 <entry>Default: <emphasis>false</emphasis></entry>
37839 </row>
37840 </tbody>
37841 </tgroup>
37842 </informaltable>
37843 <para>
37844 This option is concerned with handling generated addresses that are the same
37845 as some address in the list of redirection ancestors of the current address.
37846 Although it is turned off by default in the code, it is set in the default
37847 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
37848 for this use of the <command>redirect</command> router.
37849 </para>
37850 <para>
37851 When <option>check_ancestor</option> is set, if a generated address (including the domain)
37852 is the same as any ancestor of the current address, it is replaced by a copy of
37853 the current address. This helps in the case where local part A is aliased to B,
37854 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
37855 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
37856 <filename>&nbsp;jb/.forward</filename> contains:
37857 </para>
37858 <literallayout class="monospaced">
37859 \Joe.Bloggs, &lt;other item(s)&gt;
37860 </literallayout>
37861 <para>
37862 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
37863 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
37864 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
37865 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
37866 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
37867 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
37868 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
37869 original address. See also the <option>repeat_use</option> option below.
37870 </para>
37871 <para>
37872 <indexterm role="option">
37873 <primary><option>check_group</option></primary>
37874 </indexterm>
37875 </para>
37876 <informaltable frame="all">
37877 <tgroup cols="4" colsep="0" rowsep="0">
37878 <colspec colwidth="8*" align="left"/>
37879 <colspec colwidth="6*" align="center"/>
37880 <colspec colwidth="6*" align="center"/>
37881 <colspec colwidth="6*" align="right"/>
37882 <tbody>
37883 <row>
37884 <entry><option>check_group</option></entry>
37885 <entry>Use: <emphasis>redirect</emphasis></entry>
37886 <entry>Type: <emphasis>boolean</emphasis></entry>
37887 <entry>Default: <emphasis>see below</emphasis></entry>
37888 </row>
37889 </tbody>
37890 </tgroup>
37891 </informaltable>
37892 <para>
37893 When the <option>file</option> option is used, the group owner of the file is checked only
37894 when this option is set. The permitted groups are those listed in the
37895 <option>owngroups</option> option, together with the user&#x2019;s default group if
37896 <option>check_local_user</option> is set. If the file has the wrong group, routing is
37897 deferred. The default setting for this option is true if <option>check_local_user</option>
37898 is set and the <option>modemask</option> option permits the group write bit, or if the
37899 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
37900 </para>
37901 <para>
37902 <indexterm role="option">
37903 <primary><option>check_owner</option></primary>
37904 </indexterm>
37905 </para>
37906 <informaltable frame="all">
37907 <tgroup cols="4" colsep="0" rowsep="0">
37908 <colspec colwidth="8*" align="left"/>
37909 <colspec colwidth="6*" align="center"/>
37910 <colspec colwidth="6*" align="center"/>
37911 <colspec colwidth="6*" align="right"/>
37912 <tbody>
37913 <row>
37914 <entry><option>check_owner</option></entry>
37915 <entry>Use: <emphasis>redirect</emphasis></entry>
37916 <entry>Type: <emphasis>boolean</emphasis></entry>
37917 <entry>Default: <emphasis>see below</emphasis></entry>
37918 </row>
37919 </tbody>
37920 </tgroup>
37921 </informaltable>
37922 <para>
37923 When the <option>file</option> option is used, the owner of the file is checked only when
37924 this option is set. If <option>check_local_user</option> is set, the local user is
37925 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
37926 option. The default value for this option is true if <option>check_local_user</option> or
37927 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
37928 </para>
37929 <para>
37930 <indexterm role="option">
37931 <primary><option>data</option></primary>
37932 </indexterm>
37933 </para>
37934 <informaltable frame="all">
37935 <tgroup cols="4" colsep="0" rowsep="0">
37936 <colspec colwidth="8*" align="left"/>
37937 <colspec colwidth="6*" align="center"/>
37938 <colspec colwidth="6*" align="center"/>
37939 <colspec colwidth="6*" align="right"/>
37940 <tbody>
37941 <row>
37942 <entry><option>data</option></entry>
37943 <entry>Use: <emphasis>redirect</emphasis></entry>
37944 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37945 <entry>Default: <emphasis>unset</emphasis></entry>
37946 </row>
37947 </tbody>
37948 </tgroup>
37949 </informaltable>
37950 <para>
37951 This option is mutually exclusive with <option>file</option>. One or other of them must be
37952 set, but not both. The contents of <option>data</option> are expanded, and then used as the
37953 list of forwarding items, or as a set of filtering instructions. If the
37954 expansion is forced to fail, or the result is an empty string or a string that
37955 has no effect (consists entirely of comments), the router declines.
37956 </para>
37957 <para>
37958 When filtering instructions are used, the string must begin with <quote>#Exim
37959 filter</quote>, and all comments in the string, including this initial one, must be
37960 terminated with newline characters. For example:
37961 </para>
37962 <literallayout class="monospaced">
37963 data = #Exim filter\n\
37964        if $h_to: contains Exim then save $home/mail/exim endif
37965 </literallayout>
37966 <para>
37967 If you are reading the data from a database where newlines cannot be included,
37968 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
37969 choice into a newline.
37970 </para>
37971 <para>
37972 <indexterm role="option">
37973 <primary><option>directory_transport</option></primary>
37974 </indexterm>
37975 </para>
37976 <informaltable frame="all">
37977 <tgroup cols="4" colsep="0" rowsep="0">
37978 <colspec colwidth="8*" align="left"/>
37979 <colspec colwidth="6*" align="center"/>
37980 <colspec colwidth="6*" align="center"/>
37981 <colspec colwidth="6*" align="right"/>
37982 <tbody>
37983 <row>
37984 <entry><option>directory_transport</option></entry>
37985 <entry>Use: <emphasis>redirect</emphasis></entry>
37986 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37987 <entry>Default: <emphasis>unset</emphasis></entry>
37988 </row>
37989 </tbody>
37990 </tgroup>
37991 </informaltable>
37992 <para>
37993 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
37994 ending with a slash is specified as a new <quote>address</quote>. The transport used is
37995 specified by this option, which, after expansion, must be the name of a
37996 configured transport. This should normally be an <command>appendfile</command> transport.
37997 </para>
37998 <para>
37999 <indexterm role="option">
38000 <primary><option>file</option></primary>
38001 </indexterm>
38002 </para>
38003 <informaltable frame="all">
38004 <tgroup cols="4" colsep="0" rowsep="0">
38005 <colspec colwidth="8*" align="left"/>
38006 <colspec colwidth="6*" align="center"/>
38007 <colspec colwidth="6*" align="center"/>
38008 <colspec colwidth="6*" align="right"/>
38009 <tbody>
38010 <row>
38011 <entry><option>file</option></entry>
38012 <entry>Use: <emphasis>redirect</emphasis></entry>
38013 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38014 <entry>Default: <emphasis>unset</emphasis></entry>
38015 </row>
38016 </tbody>
38017 </tgroup>
38018 </informaltable>
38019 <para>
38020 This option specifies the name of a file that contains the redirection data. It
38021 is mutually exclusive with the <option>data</option> option. The string is expanded before
38022 use; if the expansion is forced to fail, the router declines. Other expansion
38023 failures cause delivery to be deferred. The result of a successful expansion
38024 must be an absolute path. The entire file is read and used as the redirection
38025 data. If the data is an empty string or a string that has no effect (consists
38026 entirely of comments), the router declines.
38027 </para>
38028 <para>
38029 <indexterm role="concept">
38030 <primary>NFS</primary>
38031 <secondary>checking for file existence</secondary>
38032 </indexterm>
38033 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
38034 runs a check on the containing directory,
38035 unless <option>ignore_enotdir</option> is true (see below).
38036 If the directory does not appear to exist, delivery is deferred. This can
38037 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
38038 is a mount problem. If the containing directory does exist, but the file does
38039 not, the router declines.
38040 </para>
38041 <para>
38042 <indexterm role="option">
38043 <primary><option>file_transport</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>file_transport</option></entry>
38055 <entry>Use: <emphasis>redirect</emphasis></entry>
38056 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38057 <entry>Default: <emphasis>unset</emphasis></entry>
38058 </row>
38059 </tbody>
38060 </tgroup>
38061 </informaltable>
38062 <para>
38063 <indexterm role="variable">
38064 <primary><varname>$address_file</varname></primary>
38065 </indexterm>
38066 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
38067 ending in a slash is specified as a new <quote>address</quote>. The transport used is
38068 specified by this option, which, after expansion, must be the name of a
38069 configured transport. This should normally be an <command>appendfile</command> transport. When
38070 it is running, the file name is in <varname>$address_file</varname>.
38071 </para>
38072 <para>
38073 <indexterm role="option">
38074 <primary><option>filter_prepend_home</option></primary>
38075 </indexterm>
38076 </para>
38077 <informaltable frame="all">
38078 <tgroup cols="4" colsep="0" rowsep="0">
38079 <colspec colwidth="8*" align="left"/>
38080 <colspec colwidth="6*" align="center"/>
38081 <colspec colwidth="6*" align="center"/>
38082 <colspec colwidth="6*" align="right"/>
38083 <tbody>
38084 <row>
38085 <entry><option>filter_prepend_home</option></entry>
38086 <entry>Use: <emphasis>redirect</emphasis></entry>
38087 <entry>Type: <emphasis>boolean</emphasis></entry>
38088 <entry>Default: <emphasis>true</emphasis></entry>
38089 </row>
38090 </tbody>
38091 </tgroup>
38092 </informaltable>
38093 <para>
38094 When this option is true, if a <command>save</command> command in an Exim filter specifies a
38095 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
38096 relative path. If this option is set false, this action does not happen. The
38097 relative path is then passed to the transport unmodified.
38098 </para>
38099 <para>
38100 <indexterm role="option">
38101 <primary><option>forbid_blackhole</option></primary>
38102 </indexterm>
38103 </para>
38104 <informaltable frame="all">
38105 <tgroup cols="4" colsep="0" rowsep="0">
38106 <colspec colwidth="8*" align="left"/>
38107 <colspec colwidth="6*" align="center"/>
38108 <colspec colwidth="6*" align="center"/>
38109 <colspec colwidth="6*" align="right"/>
38110 <tbody>
38111 <row>
38112 <entry><option>forbid_blackhole</option></entry>
38113 <entry>Use: <emphasis>redirect</emphasis></entry>
38114 <entry>Type: <emphasis>boolean</emphasis></entry>
38115 <entry>Default: <emphasis>false</emphasis></entry>
38116 </row>
38117 </tbody>
38118 </tgroup>
38119 </informaltable>
38120 <para>
38121 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
38122 redirection list.
38123 </para>
38124 <para>
38125 <indexterm role="option">
38126 <primary><option>forbid_exim_filter</option></primary>
38127 </indexterm>
38128 </para>
38129 <informaltable frame="all">
38130 <tgroup cols="4" colsep="0" rowsep="0">
38131 <colspec colwidth="8*" align="left"/>
38132 <colspec colwidth="6*" align="center"/>
38133 <colspec colwidth="6*" align="center"/>
38134 <colspec colwidth="6*" align="right"/>
38135 <tbody>
38136 <row>
38137 <entry><option>forbid_exim_filter</option></entry>
38138 <entry>Use: <emphasis>redirect</emphasis></entry>
38139 <entry>Type: <emphasis>boolean</emphasis></entry>
38140 <entry>Default: <emphasis>false</emphasis></entry>
38141 </row>
38142 </tbody>
38143 </tgroup>
38144 </informaltable>
38145 <para>
38146 If this option is set true, only Sieve filters are permitted when
38147 <option>allow_filter</option> is true.
38148 </para>
38149 <para>
38150 <indexterm role="option">
38151 <primary><option>forbid_file</option></primary>
38152 </indexterm>
38153 </para>
38154 <informaltable frame="all">
38155 <tgroup cols="4" colsep="0" rowsep="0">
38156 <colspec colwidth="8*" align="left"/>
38157 <colspec colwidth="6*" align="center"/>
38158 <colspec colwidth="6*" align="center"/>
38159 <colspec colwidth="6*" align="right"/>
38160 <tbody>
38161 <row>
38162 <entry><option>forbid_file</option></entry>
38163 <entry>Use: <emphasis>redirect</emphasis></entry>
38164 <entry>Type: <emphasis>boolean</emphasis></entry>
38165 <entry>Default: <emphasis>false</emphasis></entry>
38166 </row>
38167 </tbody>
38168 </tgroup>
38169 </informaltable>
38170 <para>
38171 <indexterm role="concept">
38172 <primary>delivery</primary>
38173 <secondary>to file; forbidding</secondary>
38174 </indexterm>
38175 <indexterm role="concept">
38176 <primary>Sieve filter</primary>
38177 <secondary>forbidding delivery to a file</secondary>
38178 </indexterm>
38179 <indexterm role="concept">
38180 <primary>Sieve filter</primary>
38181 <secondary><quote>keep</quote> facility; disabling</secondary>
38182 </indexterm>
38183 If this option is true, this router may not generate a new address that
38184 specifies delivery to a local file or directory, either from a filter or from a
38185 conventional forward file. This option is forced to be true if <option>one_time</option> is
38186 set. It applies to Sieve filters as well as to Exim filters, but if true, it
38187 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
38188 </para>
38189 <para>
38190 <indexterm role="option">
38191 <primary><option>forbid_filter_dlfunc</option></primary>
38192 </indexterm>
38193 </para>
38194 <informaltable frame="all">
38195 <tgroup cols="4" colsep="0" rowsep="0">
38196 <colspec colwidth="8*" align="left"/>
38197 <colspec colwidth="6*" align="center"/>
38198 <colspec colwidth="6*" align="center"/>
38199 <colspec colwidth="6*" align="right"/>
38200 <tbody>
38201 <row>
38202 <entry><option>forbid_filter_dlfunc</option></entry>
38203 <entry>Use: <emphasis>redirect</emphasis></entry>
38204 <entry>Type: <emphasis>boolean</emphasis></entry>
38205 <entry>Default: <emphasis>false</emphasis></entry>
38206 </row>
38207 </tbody>
38208 </tgroup>
38209 </informaltable>
38210 <para>
38211 <indexterm role="concept">
38212 <primary>filter</primary>
38213 <secondary>locking out certain features</secondary>
38214 </indexterm>
38215 If this option is true, string expansions in Exim filters are not allowed to
38216 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
38217 functions.
38218 </para>
38219 <para>
38220 <indexterm role="option">
38221 <primary><option>forbid_filter_existstest</option></primary>
38222 </indexterm>
38223 </para>
38224 <informaltable frame="all">
38225 <tgroup cols="4" colsep="0" rowsep="0">
38226 <colspec colwidth="8*" align="left"/>
38227 <colspec colwidth="6*" align="center"/>
38228 <colspec colwidth="6*" align="center"/>
38229 <colspec colwidth="6*" align="right"/>
38230 <tbody>
38231 <row>
38232 <entry><option>forbid_filter_existstest</option></entry>
38233 <entry>Use: <emphasis>redirect</emphasis></entry>
38234 <entry>Type: <emphasis>boolean</emphasis></entry>
38235 <entry>Default: <emphasis>false</emphasis></entry>
38236 </row>
38237 </tbody>
38238 </tgroup>
38239 </informaltable>
38240 <para>
38241 <indexterm role="concept">
38242 <primary>expansion</primary>
38243 <secondary>statting a file</secondary>
38244 </indexterm>
38245 If this option is true, string expansions in Exim filters are not allowed to
38246 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
38247 </para>
38248 <para>
38249 <indexterm role="option">
38250 <primary><option>forbid_filter_logwrite</option></primary>
38251 </indexterm>
38252 </para>
38253 <informaltable frame="all">
38254 <tgroup cols="4" colsep="0" rowsep="0">
38255 <colspec colwidth="8*" align="left"/>
38256 <colspec colwidth="6*" align="center"/>
38257 <colspec colwidth="6*" align="center"/>
38258 <colspec colwidth="6*" align="right"/>
38259 <tbody>
38260 <row>
38261 <entry><option>forbid_filter_logwrite</option></entry>
38262 <entry>Use: <emphasis>redirect</emphasis></entry>
38263 <entry>Type: <emphasis>boolean</emphasis></entry>
38264 <entry>Default: <emphasis>false</emphasis></entry>
38265 </row>
38266 </tbody>
38267 </tgroup>
38268 </informaltable>
38269 <para>
38270 If this option is true, use of the logging facility in Exim filters is not
38271 permitted. Logging is in any case available only if the filter is being run
38272 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
38273 <filename>.forward</filename> files).
38274 </para>
38275 <para>
38276 <indexterm role="option">
38277 <primary><option>forbid_filter_lookup</option></primary>
38278 </indexterm>
38279 </para>
38280 <informaltable frame="all">
38281 <tgroup cols="4" colsep="0" rowsep="0">
38282 <colspec colwidth="8*" align="left"/>
38283 <colspec colwidth="6*" align="center"/>
38284 <colspec colwidth="6*" align="center"/>
38285 <colspec colwidth="6*" align="right"/>
38286 <tbody>
38287 <row>
38288 <entry><option>forbid_filter_lookup</option></entry>
38289 <entry>Use: <emphasis>redirect</emphasis></entry>
38290 <entry>Type: <emphasis>boolean</emphasis></entry>
38291 <entry>Default: <emphasis>false</emphasis></entry>
38292 </row>
38293 </tbody>
38294 </tgroup>
38295 </informaltable>
38296 <para>
38297 If this option is true, string expansions in Exim filter files are not allowed
38298 to make use of <option>lookup</option> items.
38299 </para>
38300 <para>
38301 <indexterm role="option">
38302 <primary><option>forbid_filter_perl</option></primary>
38303 </indexterm>
38304 </para>
38305 <informaltable frame="all">
38306 <tgroup cols="4" colsep="0" rowsep="0">
38307 <colspec colwidth="8*" align="left"/>
38308 <colspec colwidth="6*" align="center"/>
38309 <colspec colwidth="6*" align="center"/>
38310 <colspec colwidth="6*" align="right"/>
38311 <tbody>
38312 <row>
38313 <entry><option>forbid_filter_perl</option></entry>
38314 <entry>Use: <emphasis>redirect</emphasis></entry>
38315 <entry>Type: <emphasis>boolean</emphasis></entry>
38316 <entry>Default: <emphasis>false</emphasis></entry>
38317 </row>
38318 </tbody>
38319 </tgroup>
38320 </informaltable>
38321 <para>
38322 This option has an effect only if Exim is built with embedded Perl support. If
38323 it is true, string expansions in Exim filter files are not allowed to make use
38324 of the embedded Perl support.
38325 </para>
38326 <para>
38327 <indexterm role="option">
38328 <primary><option>forbid_filter_readfile</option></primary>
38329 </indexterm>
38330 </para>
38331 <informaltable frame="all">
38332 <tgroup cols="4" colsep="0" rowsep="0">
38333 <colspec colwidth="8*" align="left"/>
38334 <colspec colwidth="6*" align="center"/>
38335 <colspec colwidth="6*" align="center"/>
38336 <colspec colwidth="6*" align="right"/>
38337 <tbody>
38338 <row>
38339 <entry><option>forbid_filter_readfile</option></entry>
38340 <entry>Use: <emphasis>redirect</emphasis></entry>
38341 <entry>Type: <emphasis>boolean</emphasis></entry>
38342 <entry>Default: <emphasis>false</emphasis></entry>
38343 </row>
38344 </tbody>
38345 </tgroup>
38346 </informaltable>
38347 <para>
38348 If this option is true, string expansions in Exim filter files are not allowed
38349 to make use of <option>readfile</option> items.
38350 </para>
38351 <para>
38352 <indexterm role="option">
38353 <primary><option>forbid_filter_readsocket</option></primary>
38354 </indexterm>
38355 </para>
38356 <informaltable frame="all">
38357 <tgroup cols="4" colsep="0" rowsep="0">
38358 <colspec colwidth="8*" align="left"/>
38359 <colspec colwidth="6*" align="center"/>
38360 <colspec colwidth="6*" align="center"/>
38361 <colspec colwidth="6*" align="right"/>
38362 <tbody>
38363 <row>
38364 <entry><option>forbid_filter_readsocket</option></entry>
38365 <entry>Use: <emphasis>redirect</emphasis></entry>
38366 <entry>Type: <emphasis>boolean</emphasis></entry>
38367 <entry>Default: <emphasis>false</emphasis></entry>
38368 </row>
38369 </tbody>
38370 </tgroup>
38371 </informaltable>
38372 <para>
38373 If this option is true, string expansions in Exim filter files are not allowed
38374 to make use of <option>readsocket</option> items.
38375 </para>
38376 <para>
38377 <indexterm role="option">
38378 <primary><option>forbid_filter_reply</option></primary>
38379 </indexterm>
38380 </para>
38381 <informaltable frame="all">
38382 <tgroup cols="4" colsep="0" rowsep="0">
38383 <colspec colwidth="8*" align="left"/>
38384 <colspec colwidth="6*" align="center"/>
38385 <colspec colwidth="6*" align="center"/>
38386 <colspec colwidth="6*" align="right"/>
38387 <tbody>
38388 <row>
38389 <entry><option>forbid_filter_reply</option></entry>
38390 <entry>Use: <emphasis>redirect</emphasis></entry>
38391 <entry>Type: <emphasis>boolean</emphasis></entry>
38392 <entry>Default: <emphasis>false</emphasis></entry>
38393 </row>
38394 </tbody>
38395 </tgroup>
38396 </informaltable>
38397 <para>
38398 If this option is true, this router may not generate an automatic reply
38399 message. Automatic replies can be generated only from Exim or Sieve filter
38400 files, not from traditional forward files. This option is forced to be true if
38401 <option>one_time</option> is set.
38402 </para>
38403 <para>
38404 <indexterm role="option">
38405 <primary><option>forbid_filter_run</option></primary>
38406 </indexterm>
38407 </para>
38408 <informaltable frame="all">
38409 <tgroup cols="4" colsep="0" rowsep="0">
38410 <colspec colwidth="8*" align="left"/>
38411 <colspec colwidth="6*" align="center"/>
38412 <colspec colwidth="6*" align="center"/>
38413 <colspec colwidth="6*" align="right"/>
38414 <tbody>
38415 <row>
38416 <entry><option>forbid_filter_run</option></entry>
38417 <entry>Use: <emphasis>redirect</emphasis></entry>
38418 <entry>Type: <emphasis>boolean</emphasis></entry>
38419 <entry>Default: <emphasis>false</emphasis></entry>
38420 </row>
38421 </tbody>
38422 </tgroup>
38423 </informaltable>
38424 <para>
38425 If this option is true, string expansions in Exim filter files are not allowed
38426 to make use of <option>run</option> items.
38427 </para>
38428 <para>
38429 <indexterm role="option">
38430 <primary><option>forbid_include</option></primary>
38431 </indexterm>
38432 </para>
38433 <informaltable frame="all">
38434 <tgroup cols="4" colsep="0" rowsep="0">
38435 <colspec colwidth="8*" align="left"/>
38436 <colspec colwidth="6*" align="center"/>
38437 <colspec colwidth="6*" align="center"/>
38438 <colspec colwidth="6*" align="right"/>
38439 <tbody>
38440 <row>
38441 <entry><option>forbid_include</option></entry>
38442 <entry>Use: <emphasis>redirect</emphasis></entry>
38443 <entry>Type: <emphasis>boolean</emphasis></entry>
38444 <entry>Default: <emphasis>false</emphasis></entry>
38445 </row>
38446 </tbody>
38447 </tgroup>
38448 </informaltable>
38449 <para>
38450 If this option is true, items of the form
38451 </para>
38452 <literallayout class="monospaced">
38453 :include:&lt;path name&gt;
38454 </literallayout>
38455 <para>
38456 are not permitted in non-filter redirection lists.
38457 </para>
38458 <para>
38459 <indexterm role="option">
38460 <primary><option>forbid_pipe</option></primary>
38461 </indexterm>
38462 </para>
38463 <informaltable frame="all">
38464 <tgroup cols="4" colsep="0" rowsep="0">
38465 <colspec colwidth="8*" align="left"/>
38466 <colspec colwidth="6*" align="center"/>
38467 <colspec colwidth="6*" align="center"/>
38468 <colspec colwidth="6*" align="right"/>
38469 <tbody>
38470 <row>
38471 <entry><option>forbid_pipe</option></entry>
38472 <entry>Use: <emphasis>redirect</emphasis></entry>
38473 <entry>Type: <emphasis>boolean</emphasis></entry>
38474 <entry>Default: <emphasis>false</emphasis></entry>
38475 </row>
38476 </tbody>
38477 </tgroup>
38478 </informaltable>
38479 <para>
38480 <indexterm role="concept">
38481 <primary>delivery</primary>
38482 <secondary>to pipe; forbidding</secondary>
38483 </indexterm>
38484 If this option is true, this router may not generate a new address which
38485 specifies delivery to a pipe, either from an Exim filter or from a conventional
38486 forward file. This option is forced to be true if <option>one_time</option> is set.
38487 </para>
38488 <para>
38489 <indexterm role="option">
38490 <primary><option>forbid_sieve_filter</option></primary>
38491 </indexterm>
38492 </para>
38493 <informaltable frame="all">
38494 <tgroup cols="4" colsep="0" rowsep="0">
38495 <colspec colwidth="8*" align="left"/>
38496 <colspec colwidth="6*" align="center"/>
38497 <colspec colwidth="6*" align="center"/>
38498 <colspec colwidth="6*" align="right"/>
38499 <tbody>
38500 <row>
38501 <entry><option>forbid_sieve_filter</option></entry>
38502 <entry>Use: <emphasis>redirect</emphasis></entry>
38503 <entry>Type: <emphasis>boolean</emphasis></entry>
38504 <entry>Default: <emphasis>false</emphasis></entry>
38505 </row>
38506 </tbody>
38507 </tgroup>
38508 </informaltable>
38509 <para>
38510 If this option is set true, only Exim filters are permitted when
38511 <option>allow_filter</option> is true.
38512 </para>
38513 <para>
38514 <indexterm role="concept">
38515 <primary>SMTP</primary>
38516 <secondary>error codes</secondary>
38517 </indexterm>
38518 <indexterm role="option">
38519 <primary><option>forbid_smtp_code</option></primary>
38520 </indexterm>
38521 </para>
38522 <informaltable frame="all">
38523 <tgroup cols="4" colsep="0" rowsep="0">
38524 <colspec colwidth="8*" align="left"/>
38525 <colspec colwidth="6*" align="center"/>
38526 <colspec colwidth="6*" align="center"/>
38527 <colspec colwidth="6*" align="right"/>
38528 <tbody>
38529 <row>
38530 <entry><option>forbid_smtp_code</option></entry>
38531 <entry>Use: <emphasis>redirect</emphasis></entry>
38532 <entry>Type: <emphasis>boolean</emphasis></entry>
38533 <entry>Default: <emphasis>false</emphasis></entry>
38534 </row>
38535 </tbody>
38536 </tgroup>
38537 </informaltable>
38538 <para>
38539 If this option is set true, any SMTP error codes that are present at the start
38540 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
38541 the default codes (451 and 550, respectively) are always used.
38542 </para>
38543 <para>
38544 <indexterm role="option">
38545 <primary><option>hide_child_in_errmsg</option></primary>
38546 </indexterm>
38547 </para>
38548 <informaltable frame="all">
38549 <tgroup cols="4" colsep="0" rowsep="0">
38550 <colspec colwidth="8*" align="left"/>
38551 <colspec colwidth="6*" align="center"/>
38552 <colspec colwidth="6*" align="center"/>
38553 <colspec colwidth="6*" align="right"/>
38554 <tbody>
38555 <row>
38556 <entry><option>hide_child_in_errmsg</option></entry>
38557 <entry>Use: <emphasis>redirect</emphasis></entry>
38558 <entry>Type: <emphasis>boolean</emphasis></entry>
38559 <entry>Default: <emphasis>false</emphasis></entry>
38560 </row>
38561 </tbody>
38562 </tgroup>
38563 </informaltable>
38564 <para>
38565 <indexterm role="concept">
38566 <primary>bounce message</primary>
38567 <secondary>redirection details; suppressing</secondary>
38568 </indexterm>
38569 If this option is true, it prevents Exim from quoting a child address if it
38570 generates a bounce or delay message for it. Instead it says <quote>an address
38571 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
38572 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
38573 bounce may well quote the generated address.
38574 </para>
38575 <para>
38576 <indexterm role="option">
38577 <primary><option>ignore_eacces</option></primary>
38578 </indexterm>
38579 </para>
38580 <informaltable frame="all">
38581 <tgroup cols="4" colsep="0" rowsep="0">
38582 <colspec colwidth="8*" align="left"/>
38583 <colspec colwidth="6*" align="center"/>
38584 <colspec colwidth="6*" align="center"/>
38585 <colspec colwidth="6*" align="right"/>
38586 <tbody>
38587 <row>
38588 <entry><option>ignore_eacces</option></entry>
38589 <entry>Use: <emphasis>redirect</emphasis></entry>
38590 <entry>Type: <emphasis>boolean</emphasis></entry>
38591 <entry>Default: <emphasis>false</emphasis></entry>
38592 </row>
38593 </tbody>
38594 </tgroup>
38595 </informaltable>
38596 <para>
38597 <indexterm role="concept">
38598 <primary>EACCES</primary>
38599 </indexterm>
38600 If this option is set and an attempt to open a redirection file yields the
38601 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
38602 file did not exist.
38603 </para>
38604 <para>
38605 <indexterm role="option">
38606 <primary><option>ignore_enotdir</option></primary>
38607 </indexterm>
38608 </para>
38609 <informaltable frame="all">
38610 <tgroup cols="4" colsep="0" rowsep="0">
38611 <colspec colwidth="8*" align="left"/>
38612 <colspec colwidth="6*" align="center"/>
38613 <colspec colwidth="6*" align="center"/>
38614 <colspec colwidth="6*" align="right"/>
38615 <tbody>
38616 <row>
38617 <entry><option>ignore_enotdir</option></entry>
38618 <entry>Use: <emphasis>redirect</emphasis></entry>
38619 <entry>Type: <emphasis>boolean</emphasis></entry>
38620 <entry>Default: <emphasis>false</emphasis></entry>
38621 </row>
38622 </tbody>
38623 </tgroup>
38624 </informaltable>
38625 <para>
38626 <indexterm role="concept">
38627 <primary>ENOTDIR</primary>
38628 </indexterm>
38629 If this option is set and an attempt to open a redirection file yields the
38630 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
38631 router behaves as if the file did not exist.
38632 </para>
38633 <para>
38634 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
38635 router that has the <option>file</option> option set discovers that the file does not exist
38636 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
38637 against unmounted NFS directories. If the parent can not be statted, delivery
38638 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
38639 is set, because that option tells Exim to ignore <quote>something on the path is not
38640 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
38641 that some operating systems give ENOENT where others give ENOTDIR.
38642 </para>
38643 <para>
38644 <indexterm role="option">
38645 <primary><option>include_directory</option></primary>
38646 </indexterm>
38647 </para>
38648 <informaltable frame="all">
38649 <tgroup cols="4" colsep="0" rowsep="0">
38650 <colspec colwidth="8*" align="left"/>
38651 <colspec colwidth="6*" align="center"/>
38652 <colspec colwidth="6*" align="center"/>
38653 <colspec colwidth="6*" align="right"/>
38654 <tbody>
38655 <row>
38656 <entry><option>include_directory</option></entry>
38657 <entry>Use: <emphasis>redirect</emphasis></entry>
38658 <entry>Type: <emphasis>string</emphasis></entry>
38659 <entry>Default: <emphasis>unset</emphasis></entry>
38660 </row>
38661 </tbody>
38662 </tgroup>
38663 </informaltable>
38664 <para>
38665 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
38666 redirection list must start with this directory.
38667 </para>
38668 <para>
38669 <indexterm role="option">
38670 <primary><option>modemask</option></primary>
38671 </indexterm>
38672 </para>
38673 <informaltable frame="all">
38674 <tgroup cols="4" colsep="0" rowsep="0">
38675 <colspec colwidth="8*" align="left"/>
38676 <colspec colwidth="6*" align="center"/>
38677 <colspec colwidth="6*" align="center"/>
38678 <colspec colwidth="6*" align="right"/>
38679 <tbody>
38680 <row>
38681 <entry><option>modemask</option></entry>
38682 <entry>Use: <emphasis>redirect</emphasis></entry>
38683 <entry>Type: <emphasis>octal integer</emphasis></entry>
38684 <entry>Default: <emphasis>022</emphasis></entry>
38685 </row>
38686 </tbody>
38687 </tgroup>
38688 </informaltable>
38689 <para>
38690 This specifies mode bits which must not be set for a file specified by the
38691 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
38692 </para>
38693 <para>
38694 <indexterm role="option">
38695 <primary><option>one_time</option></primary>
38696 </indexterm>
38697 </para>
38698 <informaltable frame="all">
38699 <tgroup cols="4" colsep="0" rowsep="0">
38700 <colspec colwidth="8*" align="left"/>
38701 <colspec colwidth="6*" align="center"/>
38702 <colspec colwidth="6*" align="center"/>
38703 <colspec colwidth="6*" align="right"/>
38704 <tbody>
38705 <row>
38706 <entry><option>one_time</option></entry>
38707 <entry>Use: <emphasis>redirect</emphasis></entry>
38708 <entry>Type: <emphasis>boolean</emphasis></entry>
38709 <entry>Default: <emphasis>false</emphasis></entry>
38710 </row>
38711 </tbody>
38712 </tgroup>
38713 </informaltable>
38714 <para>
38715 <indexterm role="concept">
38716 <primary>one-time aliasing/forwarding expansion</primary>
38717 </indexterm>
38718 <indexterm role="concept">
38719 <primary>alias file</primary>
38720 <secondary>one-time expansion</secondary>
38721 </indexterm>
38722 <indexterm role="concept">
38723 <primary>forward file</primary>
38724 <secondary>one-time expansion</secondary>
38725 </indexterm>
38726 <indexterm role="concept">
38727 <primary>mailing lists</primary>
38728 <secondary>one-time expansion</secondary>
38729 </indexterm>
38730 <indexterm role="concept">
38731 <primary>address redirection</primary>
38732 <secondary>one-time expansion</secondary>
38733 </indexterm>
38734 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
38735 files each time it tries to deliver a message causes a problem when one or more
38736 of the generated addresses fails be delivered at the first attempt. The problem
38737 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
38738 but of what happens when the redirection list changes during the time that the
38739 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
38740 lists, where new subscribers might receive copies of messages that were posted
38741 before they subscribed.
38742 </para>
38743 <para>
38744 If <option>one_time</option> is set and any addresses generated by the router fail to
38745 deliver at the first attempt, the failing addresses are added to the message as
38746 <quote>top level</quote> addresses, and the parent address that generated them is marked
38747 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
38748 attempt.
38749 </para>
38750 <para>
38751 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
38752 router would be lost if delivery did not succeed at the first attempt. For this
38753 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
38754 permitted when <option>one_time</option> is set.
38755 </para>
38756 <para>
38757 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
38758 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
38759 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
38760 </para>
38761 <para>
38762 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
38763 <option>one_time</option>.
38764 </para>
38765 <para>
38766 The original top-level address is remembered with each of the generated
38767 addresses, and is output in any log messages. However, any intermediate parent
38768 addresses are not recorded. This makes a difference to the log only if
38769 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
38770 typically be used for mailing lists, where there is normally just one level of
38771 expansion.
38772 </para>
38773 <para>
38774 <indexterm role="option">
38775 <primary><option>owners</option></primary>
38776 </indexterm>
38777 </para>
38778 <informaltable frame="all">
38779 <tgroup cols="4" colsep="0" rowsep="0">
38780 <colspec colwidth="8*" align="left"/>
38781 <colspec colwidth="6*" align="center"/>
38782 <colspec colwidth="6*" align="center"/>
38783 <colspec colwidth="6*" align="right"/>
38784 <tbody>
38785 <row>
38786 <entry><option>owners</option></entry>
38787 <entry>Use: <emphasis>redirect</emphasis></entry>
38788 <entry>Type: <emphasis>string list</emphasis></entry>
38789 <entry>Default: <emphasis>unset</emphasis></entry>
38790 </row>
38791 </tbody>
38792 </tgroup>
38793 </informaltable>
38794 <para>
38795 <indexterm role="concept">
38796 <primary>ownership</primary>
38797 <secondary>alias file</secondary>
38798 </indexterm>
38799 <indexterm role="concept">
38800 <primary>ownership</primary>
38801 <secondary>forward file</secondary>
38802 </indexterm>
38803 <indexterm role="concept">
38804 <primary>alias file</primary>
38805 <secondary>ownership</secondary>
38806 </indexterm>
38807 <indexterm role="concept">
38808 <primary>forward file</primary>
38809 <secondary>ownership</secondary>
38810 </indexterm>
38811 This specifies a list of permitted owners for the file specified by <option>file</option>.
38812 This list is in addition to the local user when <option>check_local_user</option> is set.
38813 See <option>check_owner</option> above.
38814 </para>
38815 <para>
38816 <indexterm role="option">
38817 <primary><option>owngroups</option></primary>
38818 </indexterm>
38819 </para>
38820 <informaltable frame="all">
38821 <tgroup cols="4" colsep="0" rowsep="0">
38822 <colspec colwidth="8*" align="left"/>
38823 <colspec colwidth="6*" align="center"/>
38824 <colspec colwidth="6*" align="center"/>
38825 <colspec colwidth="6*" align="right"/>
38826 <tbody>
38827 <row>
38828 <entry><option>owngroups</option></entry>
38829 <entry>Use: <emphasis>redirect</emphasis></entry>
38830 <entry>Type: <emphasis>string list</emphasis></entry>
38831 <entry>Default: <emphasis>unset</emphasis></entry>
38832 </row>
38833 </tbody>
38834 </tgroup>
38835 </informaltable>
38836 <para>
38837 This specifies a list of permitted groups for the file specified by <option>file</option>.
38838 The list is in addition to the local user&#x2019;s primary group when
38839 <option>check_local_user</option> is set. See <option>check_group</option> above.
38840 </para>
38841 <para>
38842 <indexterm role="option">
38843 <primary><option>pipe_transport</option></primary>
38844 </indexterm>
38845 </para>
38846 <informaltable frame="all">
38847 <tgroup cols="4" colsep="0" rowsep="0">
38848 <colspec colwidth="8*" align="left"/>
38849 <colspec colwidth="6*" align="center"/>
38850 <colspec colwidth="6*" align="center"/>
38851 <colspec colwidth="6*" align="right"/>
38852 <tbody>
38853 <row>
38854 <entry><option>pipe_transport</option></entry>
38855 <entry>Use: <emphasis>redirect</emphasis></entry>
38856 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38857 <entry>Default: <emphasis>unset</emphasis></entry>
38858 </row>
38859 </tbody>
38860 </tgroup>
38861 </informaltable>
38862 <para>
38863 <indexterm role="variable">
38864 <primary><varname>$address_pipe</varname></primary>
38865 </indexterm>
38866 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
38867 starting with a vertical bar character is specified as a new <quote>address</quote>. The
38868 transport used is specified by this option, which, after expansion, must be the
38869 name of a configured transport. This should normally be a <command>pipe</command> transport.
38870 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
38871 </para>
38872 <para>
38873 <indexterm role="option">
38874 <primary><option>qualify_domain</option></primary>
38875 </indexterm>
38876 </para>
38877 <informaltable frame="all">
38878 <tgroup cols="4" colsep="0" rowsep="0">
38879 <colspec colwidth="8*" align="left"/>
38880 <colspec colwidth="6*" align="center"/>
38881 <colspec colwidth="6*" align="center"/>
38882 <colspec colwidth="6*" align="right"/>
38883 <tbody>
38884 <row>
38885 <entry><option>qualify_domain</option></entry>
38886 <entry>Use: <emphasis>redirect</emphasis></entry>
38887 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38888 <entry>Default: <emphasis>unset</emphasis></entry>
38889 </row>
38890 </tbody>
38891 </tgroup>
38892 </informaltable>
38893 <para>
38894 <indexterm role="variable">
38895 <primary><varname>$qualify_recipient</varname></primary>
38896 </indexterm>
38897 If this option is set, and an unqualified address (one without a domain) is
38898 generated, and that address would normally be qualified by the global setting
38899 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
38900 expanding this string. If the expansion fails, the router declines. If you want
38901 to revert to the default, you can have the expansion generate
38902 <varname>$qualify_recipient</varname>.
38903 </para>
38904 <para>
38905 This option applies to all unqualified addresses generated by Exim filters,
38906 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
38907 not preceded by a backslash. Sieve filters cannot generate unqualified
38908 addresses.
38909 </para>
38910 <para>
38911 <indexterm role="option">
38912 <primary><option>qualify_preserve_domain</option></primary>
38913 </indexterm>
38914 </para>
38915 <informaltable frame="all">
38916 <tgroup cols="4" colsep="0" rowsep="0">
38917 <colspec colwidth="8*" align="left"/>
38918 <colspec colwidth="6*" align="center"/>
38919 <colspec colwidth="6*" align="center"/>
38920 <colspec colwidth="6*" align="right"/>
38921 <tbody>
38922 <row>
38923 <entry><option>qualify_preserve_domain</option></entry>
38924 <entry>Use: <emphasis>redirect</emphasis></entry>
38925 <entry>Type: <emphasis>boolean</emphasis></entry>
38926 <entry>Default: <emphasis>false</emphasis></entry>
38927 </row>
38928 </tbody>
38929 </tgroup>
38930 </informaltable>
38931 <para>
38932 <indexterm role="concept">
38933 <primary>domain</primary>
38934 <secondary>in redirection; preserving</secondary>
38935 </indexterm>
38936 <indexterm role="concept">
38937 <primary>preserving domain in redirection</primary>
38938 </indexterm>
38939 <indexterm role="concept">
38940 <primary>address redirection</primary>
38941 <secondary>domain; preserving</secondary>
38942 </indexterm>
38943 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
38944 set (a configuration error occurs if it is). If an unqualified address (one
38945 without a domain) is generated, it is qualified with the domain of the parent
38946 address (the immediately preceding ancestor) instead of the global
38947 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
38948 this applies whether or not the address is preceded by a backslash.
38949 </para>
38950 <para>
38951 <indexterm role="option">
38952 <primary><option>repeat_use</option></primary>
38953 </indexterm>
38954 </para>
38955 <informaltable frame="all">
38956 <tgroup cols="4" colsep="0" rowsep="0">
38957 <colspec colwidth="8*" align="left"/>
38958 <colspec colwidth="6*" align="center"/>
38959 <colspec colwidth="6*" align="center"/>
38960 <colspec colwidth="6*" align="right"/>
38961 <tbody>
38962 <row>
38963 <entry><option>repeat_use</option></entry>
38964 <entry>Use: <emphasis>redirect</emphasis></entry>
38965 <entry>Type: <emphasis>boolean</emphasis></entry>
38966 <entry>Default: <emphasis>true</emphasis></entry>
38967 </row>
38968 </tbody>
38969 </tgroup>
38970 </informaltable>
38971 <para>
38972 If this option is set false, the router is skipped for a child address that has
38973 any ancestor that was routed by this router. This test happens before any of
38974 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
38975 only when the ancestor is the same as the current address. See also
38976 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
38977 </para>
38978 <para>
38979 <indexterm role="option">
38980 <primary><option>reply_transport</option></primary>
38981 </indexterm>
38982 </para>
38983 <informaltable frame="all">
38984 <tgroup cols="4" colsep="0" rowsep="0">
38985 <colspec colwidth="8*" align="left"/>
38986 <colspec colwidth="6*" align="center"/>
38987 <colspec colwidth="6*" align="center"/>
38988 <colspec colwidth="6*" align="right"/>
38989 <tbody>
38990 <row>
38991 <entry><option>reply_transport</option></entry>
38992 <entry>Use: <emphasis>redirect</emphasis></entry>
38993 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38994 <entry>Default: <emphasis>unset</emphasis></entry>
38995 </row>
38996 </tbody>
38997 </tgroup>
38998 </informaltable>
38999 <para>
39000 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
39001 <option>vacation</option> command is used in a filter file. The transport used is specified
39002 by this option, which, after expansion, must be the name of a configured
39003 transport. This should normally be an <command>autoreply</command> transport. Other transports
39004 are unlikely to do anything sensible or useful.
39005 </para>
39006 <para>
39007 <indexterm role="option">
39008 <primary><option>rewrite</option></primary>
39009 </indexterm>
39010 </para>
39011 <informaltable frame="all">
39012 <tgroup cols="4" colsep="0" rowsep="0">
39013 <colspec colwidth="8*" align="left"/>
39014 <colspec colwidth="6*" align="center"/>
39015 <colspec colwidth="6*" align="center"/>
39016 <colspec colwidth="6*" align="right"/>
39017 <tbody>
39018 <row>
39019 <entry><option>rewrite</option></entry>
39020 <entry>Use: <emphasis>redirect</emphasis></entry>
39021 <entry>Type: <emphasis>boolean</emphasis></entry>
39022 <entry>Default: <emphasis>true</emphasis></entry>
39023 </row>
39024 </tbody>
39025 </tgroup>
39026 </informaltable>
39027 <para>
39028 <indexterm role="concept">
39029 <primary>address redirection</primary>
39030 <secondary>disabling rewriting</secondary>
39031 </indexterm>
39032 If this option is set false, addresses generated by the router are not
39033 subject to address rewriting. Otherwise, they are treated like new addresses
39034 and are rewritten according to the global rewriting rules.
39035 </para>
39036 <para>
39037 <indexterm role="option">
39038 <primary><option>sieve_subaddress</option></primary>
39039 </indexterm>
39040 </para>
39041 <informaltable frame="all">
39042 <tgroup cols="4" colsep="0" rowsep="0">
39043 <colspec colwidth="8*" align="left"/>
39044 <colspec colwidth="6*" align="center"/>
39045 <colspec colwidth="6*" align="center"/>
39046 <colspec colwidth="6*" align="right"/>
39047 <tbody>
39048 <row>
39049 <entry><option>sieve_subaddress</option></entry>
39050 <entry>Use: <emphasis>redirect</emphasis></entry>
39051 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39052 <entry>Default: <emphasis>unset</emphasis></entry>
39053 </row>
39054 </tbody>
39055 </tgroup>
39056 </informaltable>
39057 <para>
39058 The value of this option is passed to a Sieve filter to specify the
39059 :subaddress part of an address.
39060 </para>
39061 <para>
39062 <indexterm role="option">
39063 <primary><option>sieve_useraddress</option></primary>
39064 </indexterm>
39065 </para>
39066 <informaltable frame="all">
39067 <tgroup cols="4" colsep="0" rowsep="0">
39068 <colspec colwidth="8*" align="left"/>
39069 <colspec colwidth="6*" align="center"/>
39070 <colspec colwidth="6*" align="center"/>
39071 <colspec colwidth="6*" align="right"/>
39072 <tbody>
39073 <row>
39074 <entry><option>sieve_useraddress</option></entry>
39075 <entry>Use: <emphasis>redirect</emphasis></entry>
39076 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39077 <entry>Default: <emphasis>unset</emphasis></entry>
39078 </row>
39079 </tbody>
39080 </tgroup>
39081 </informaltable>
39082 <para>
39083 The value of this option is passed to a Sieve filter to specify the :user part
39084 of an address. However, if it is unset, the entire original local part
39085 (including any prefix or suffix) is used for :user.
39086 </para>
39087 <para>
39088 <indexterm role="option">
39089 <primary><option>sieve_vacation_directory</option></primary>
39090 </indexterm>
39091 </para>
39092 <informaltable frame="all">
39093 <tgroup cols="4" colsep="0" rowsep="0">
39094 <colspec colwidth="8*" align="left"/>
39095 <colspec colwidth="6*" align="center"/>
39096 <colspec colwidth="6*" align="center"/>
39097 <colspec colwidth="6*" align="right"/>
39098 <tbody>
39099 <row>
39100 <entry><option>sieve_vacation_directory</option></entry>
39101 <entry>Use: <emphasis>redirect</emphasis></entry>
39102 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39103 <entry>Default: <emphasis>unset</emphasis></entry>
39104 </row>
39105 </tbody>
39106 </tgroup>
39107 </informaltable>
39108 <para>
39109 <indexterm role="concept">
39110 <primary>Sieve filter</primary>
39111 <secondary>vacation directory</secondary>
39112 </indexterm>
39113 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
39114 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
39115 (do not put anything else in that directory), and ensure that the
39116 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
39117 needs their own directory; Exim will create it if necessary.
39118 </para>
39119 <para>
39120 <indexterm role="option">
39121 <primary><option>skip_syntax_errors</option></primary>
39122 </indexterm>
39123 </para>
39124 <informaltable frame="all">
39125 <tgroup cols="4" colsep="0" rowsep="0">
39126 <colspec colwidth="8*" align="left"/>
39127 <colspec colwidth="6*" align="center"/>
39128 <colspec colwidth="6*" align="center"/>
39129 <colspec colwidth="6*" align="right"/>
39130 <tbody>
39131 <row>
39132 <entry><option>skip_syntax_errors</option></entry>
39133 <entry>Use: <emphasis>redirect</emphasis></entry>
39134 <entry>Type: <emphasis>boolean</emphasis></entry>
39135 <entry>Default: <emphasis>false</emphasis></entry>
39136 </row>
39137 </tbody>
39138 </tgroup>
39139 </informaltable>
39140 <para>
39141 <indexterm role="concept">
39142 <primary>forward file</primary>
39143 <secondary>broken</secondary>
39144 </indexterm>
39145 <indexterm role="concept">
39146 <primary>address redirection</primary>
39147 <secondary>broken files</secondary>
39148 </indexterm>
39149 <indexterm role="concept">
39150 <primary>alias file</primary>
39151 <secondary>broken</secondary>
39152 </indexterm>
39153 <indexterm role="concept">
39154 <primary>broken alias or forward files</primary>
39155 </indexterm>
39156 <indexterm role="concept">
39157 <primary>ignoring faulty addresses</primary>
39158 </indexterm>
39159 <indexterm role="concept">
39160 <primary>skipping faulty addresses</primary>
39161 </indexterm>
39162 <indexterm role="concept">
39163 <primary>error</primary>
39164 <secondary>skipping bad syntax</secondary>
39165 </indexterm>
39166 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
39167 non-filter redirection data are skipped, and each failing address is logged. If
39168 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
39169 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
39170 are expanded and placed at the head of the error message generated by
39171 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
39172 be the same address as the generic <option>errors_to</option> option. The
39173 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
39174 </para>
39175 <para>
39176 If all the addresses in a redirection list are skipped because of syntax
39177 errors, the router declines to handle the original address, and it is passed to
39178 the following routers.
39179 </para>
39180 <para>
39181 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
39182 error in the filter causes filtering to be abandoned without any action being
39183 taken. The incident is logged, and the router declines to handle the address,
39184 so it is passed to the following routers.
39185 </para>
39186 <para>
39187 <indexterm role="concept">
39188 <primary>Sieve filter</primary>
39189 <secondary>syntax errors in</secondary>
39190 </indexterm>
39191 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
39192 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
39193 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
39194 </para>
39195 <para>
39196 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
39197 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
39198 option, used with an address that does not get redirected, can be used to
39199 notify users of these errors, by means of a router like this:
39200 </para>
39201 <literallayout class="monospaced">
39202 userforward:
39203   driver = redirect
39204   allow_filter
39205   check_local_user
39206   file = $home/.forward
39207   file_transport = address_file
39208   pipe_transport = address_pipe
39209   reply_transport = address_reply
39210   no_verify
39211   skip_syntax_errors
39212   syntax_errors_to = real-$local_part@$domain
39213   syntax_errors_text = \
39214    This is an automatically generated message. An error has\n\
39215    been found in your .forward file. Details of the error are\n\
39216    reported below. While this error persists, you will receive\n\
39217    a copy of this message for every message that is addressed\n\
39218    to you. If your .forward file is a filter file, or if it is\n\
39219    a non-filter file containing no valid forwarding addresses,\n\
39220    a copy of each incoming message will be put in your normal\n\
39221    mailbox. If a non-filter file contains at least one valid\n\
39222    forwarding address, forwarding to the valid addresses will\n\
39223    happen, and those will be the only deliveries that occur.
39224 </literallayout>
39225 <para>
39226 You also need a router to ensure that local addresses that are prefixed by
39227 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
39228 put this immediately before the <command>userforward</command> router:
39229 </para>
39230 <literallayout class="monospaced">
39231 real_localuser:
39232   driver = accept
39233   check_local_user
39234   local_part_prefix = real-
39235   transport = local_delivery
39236 </literallayout>
39237 <para>
39238 For security, it would probably be a good idea to restrict the use of this
39239 router to locally-generated messages, using a condition such as this:
39240 </para>
39241 <literallayout class="monospaced">
39242   condition = ${if match {$sender_host_address}\
39243                          {\N^(|127\.0\.0\.1)$\N}}
39244 </literallayout>
39245 <para>
39246 <indexterm role="option">
39247 <primary><option>syntax_errors_text</option></primary>
39248 </indexterm>
39249 </para>
39250 <informaltable frame="all">
39251 <tgroup cols="4" colsep="0" rowsep="0">
39252 <colspec colwidth="8*" align="left"/>
39253 <colspec colwidth="6*" align="center"/>
39254 <colspec colwidth="6*" align="center"/>
39255 <colspec colwidth="6*" align="right"/>
39256 <tbody>
39257 <row>
39258 <entry><option>syntax_errors_text</option></entry>
39259 <entry>Use: <emphasis>redirect</emphasis></entry>
39260 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39261 <entry>Default: <emphasis>unset</emphasis></entry>
39262 </row>
39263 </tbody>
39264 </tgroup>
39265 </informaltable>
39266 <para>
39267 See <option>skip_syntax_errors</option> above.
39268 </para>
39269 <para>
39270 <indexterm role="option">
39271 <primary><option>syntax_errors_to</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>syntax_errors_to</option></entry>
39283 <entry>Use: <emphasis>redirect</emphasis></entry>
39284 <entry>Type: <emphasis>string</emphasis></entry>
39285 <entry>Default: <emphasis>unset</emphasis></entry>
39286 </row>
39287 </tbody>
39288 </tgroup>
39289 </informaltable>
39290 <para>
39291 See <option>skip_syntax_errors</option> above.
39292 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
39293 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
39294 </para>
39295 </section>
39296 </chapter>
39297
39298 <chapter id="CHAPenvironment">
39299 <title>Environment for running local transports</title>
39300 <titleabbrev>Environment for local transports</titleabbrev>
39301 <para>
39302 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
39303 <primary>local transports</primary>
39304 <secondary>environment for</secondary>
39305 </indexterm>
39306 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
39307 <primary>environment</primary>
39308 <secondary>local transports</secondary>
39309 </indexterm>
39310 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
39311 <primary>transport</primary>
39312 <secondary>local; environment for</secondary>
39313 </indexterm>
39314 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
39315 transport can be thought of as similar to a pipe.) Exim always runs transports
39316 in subprocesses, under specified uids and gids. Typical deliveries to local
39317 mailboxes run under the uid and gid of the local user.
39318 </para>
39319 <para>
39320 Exim also sets a specific current directory while running the transport; for
39321 some transports a home directory setting is also relevant. The <command>pipe</command>
39322 transport is the only one that sets up environment variables; see section
39323 <xref linkend="SECTpipeenv"/> for details.
39324 </para>
39325 <para>
39326 The values used for the uid, gid, and the directories may come from several
39327 different places. In many cases, the router that handles the address associates
39328 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
39329 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
39330 configuration, and these override anything that comes from the router.
39331 </para>
39332 <section id="SECID131">
39333 <title>Concurrent deliveries</title>
39334 <para>
39335 <indexterm role="concept">
39336 <primary>concurrent deliveries</primary>
39337 </indexterm>
39338 <indexterm role="concept">
39339 <primary>simultaneous deliveries</primary>
39340 </indexterm>
39341 If two different messages for the same local recipient arrive more or less
39342 simultaneously, the two delivery processes are likely to run concurrently. When
39343 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
39344 rules to stop concurrent processes from writing to the same file at the same
39345 time.
39346 </para>
39347 <para>
39348 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
39349 locking that is needed. Here is a silly example:
39350 </para>
39351 <literallayout class="monospaced">
39352 my_transport:
39353   driver = pipe
39354   command = /bin/sh -c 'cat &gt;&gt;/some/file'
39355 </literallayout>
39356 <para>
39357 This is supposed to write the message at the end of the file. However, if two
39358 messages arrive at the same time, the file will be scrambled. You can use the
39359 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
39360 file using the same algorithm that Exim itself uses.
39361 </para>
39362 </section>
39363 <section id="SECTenvuidgid">
39364 <title>Uids and gids</title>
39365 <para>
39366 <indexterm role="concept">
39367 <primary>local transports</primary>
39368 <secondary>uid and gid</secondary>
39369 </indexterm>
39370 <indexterm role="concept">
39371 <primary>transport</primary>
39372 <secondary>local; uid and gid</secondary>
39373 </indexterm>
39374 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
39375 overrides any group that the router set in the address, even if <option>user</option> is not
39376 set for the transport. This makes it possible, for example, to run local mail
39377 delivery under the uid of the recipient (set by the router), but in a special
39378 group (set by the transport). For example:
39379 </para>
39380 <literallayout class="monospaced">
39381 # Routers ...
39382 # User/group are set by check_local_user in this router
39383 local_users:
39384   driver = accept
39385   check_local_user
39386   transport = group_delivery
39387
39388 # Transports ...
39389 # This transport overrides the group
39390 group_delivery:
39391   driver = appendfile
39392   file = /var/spool/mail/$local_part
39393   group = mail
39394 </literallayout>
39395 <para>
39396 If <option>user</option> is set for a transport, its value overrides what is set in the
39397 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
39398 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
39399 set.
39400 </para>
39401 <para>
39402 <indexterm role="option">
39403 <primary><option>initgroups</option></primary>
39404 </indexterm>
39405 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
39406 function is called for the groups associated with that uid if the
39407 <option>initgroups</option> option is set for the transport. When the uid is not specified
39408 by the transport, but is associated with the address by a router, the option
39409 for calling <function>initgroups()</function> is taken from the router configuration.
39410 </para>
39411 <para>
39412 <indexterm role="concept">
39413 <primary><command>pipe</command> transport</primary>
39414 <secondary>uid for</secondary>
39415 </indexterm>
39416 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
39417 is set and <option>user</option> is not set, the uid of the process that called Exim to
39418 receive the message is used, and if <option>group</option> is not set, the corresponding
39419 original gid is also used.
39420 </para>
39421 <para>
39422 This is the detailed preference order for obtaining a gid; the first of the
39423 following that is set is used:
39424 </para>
39425 <itemizedlist>
39426 <listitem>
39427 <para>
39428 A <option>group</option> setting of the transport;
39429 </para>
39430 </listitem>
39431 <listitem>
39432 <para>
39433 A <option>group</option> setting of the router;
39434 </para>
39435 </listitem>
39436 <listitem>
39437 <para>
39438 A gid associated with a user setting of the router, either as a result of
39439 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
39440 </para>
39441 </listitem>
39442 <listitem>
39443 <para>
39444 The group associated with a non-numeric <option>user</option> setting of the transport;
39445 </para>
39446 </listitem>
39447 <listitem>
39448 <para>
39449 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
39450 the uid is the creator&#x2019;s uid;
39451 </para>
39452 </listitem>
39453 <listitem>
39454 <para>
39455 The Exim gid if the Exim uid is being used as a default.
39456 </para>
39457 </listitem>
39458 </itemizedlist>
39459 <para>
39460 If, for example, the user is specified numerically on the router and there are
39461 no group settings, no gid is available. In this situation, an error occurs.
39462 This is different for the uid, for which there always is an ultimate default.
39463 The first of the following that is set is used:
39464 </para>
39465 <itemizedlist>
39466 <listitem>
39467 <para>
39468 A <option>user</option> setting of the transport;
39469 </para>
39470 </listitem>
39471 <listitem>
39472 <para>
39473 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
39474 </para>
39475 </listitem>
39476 <listitem>
39477 <para>
39478 A <option>user</option> setting of the router;
39479 </para>
39480 </listitem>
39481 <listitem>
39482 <para>
39483 A <option>check_local_user</option> setting of the router;
39484 </para>
39485 </listitem>
39486 <listitem>
39487 <para>
39488 The Exim uid.
39489 </para>
39490 </listitem>
39491 </itemizedlist>
39492 <para>
39493 Of course, an error will still occur if the uid that is chosen is on the
39494 <option>never_users</option> list.
39495 </para>
39496 </section>
39497 <section id="SECID132">
39498 <title>Current and home directories</title>
39499 <para>
39500 <indexterm role="concept">
39501 <primary>current directory for local transport</primary>
39502 </indexterm>
39503 <indexterm role="concept">
39504 <primary>home directory</primary>
39505 <secondary>for local transport</secondary>
39506 </indexterm>
39507 <indexterm role="concept">
39508 <primary>transport</primary>
39509 <secondary>local; home directory for</secondary>
39510 </indexterm>
39511 <indexterm role="concept">
39512 <primary>transport</primary>
39513 <secondary>local; current directory for</secondary>
39514 </indexterm>
39515 Routers may set current and home directories for local transports by means of
39516 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
39517 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
39518 are set, they override the router&#x2019;s values. In detail, the home directory
39519 for a local transport is taken from the first of these values that is set:
39520 </para>
39521 <itemizedlist>
39522 <listitem>
39523 <para>
39524 The <option>home_directory</option> option on the transport;
39525 </para>
39526 </listitem>
39527 <listitem>
39528 <para>
39529 The <option>transport_home_directory</option> option on the router;
39530 </para>
39531 </listitem>
39532 <listitem>
39533 <para>
39534 The password data if <option>check_local_user</option> is set on the router;
39535 </para>
39536 </listitem>
39537 <listitem>
39538 <para>
39539 The <option>router_home_directory</option> option on the router.
39540 </para>
39541 </listitem>
39542 </itemizedlist>
39543 <para>
39544 The current directory is taken from the first of these values that is set:
39545 </para>
39546 <itemizedlist>
39547 <listitem>
39548 <para>
39549 The <option>current_directory</option> option on the transport;
39550 </para>
39551 </listitem>
39552 <listitem>
39553 <para>
39554 The <option>transport_current_directory</option> option on the router.
39555 </para>
39556 </listitem>
39557 </itemizedlist>
39558 <para>
39559 If neither the router nor the transport sets a current directory, Exim uses the
39560 value of the home directory, if it is set. Otherwise it sets the current
39561 directory to <filename>/</filename> before running a local transport.
39562 </para>
39563 </section>
39564 <section id="SECID133">
39565 <title>Expansion variables derived from the address</title>
39566 <para>
39567 <indexterm role="variable">
39568 <primary><varname>$domain</varname></primary>
39569 </indexterm>
39570 <indexterm role="variable">
39571 <primary><varname>$local_part</varname></primary>
39572 </indexterm>
39573 <indexterm role="variable">
39574 <primary><varname>$original_domain</varname></primary>
39575 </indexterm>
39576 Normally a local delivery is handling a single address, and in that case the
39577 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
39578 deliveries. However, in some circumstances more than one address may be handled
39579 at once (for example, while writing batch SMTP for onward transmission by some
39580 other means). In this case, the variables associated with the local part are
39581 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
39582 and <varname>$original_domain</varname> is never set.
39583 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
39584 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
39585 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
39586 </para>
39587 </section>
39588 </chapter>
39589
39590 <chapter id="CHAPtransportgeneric">
39591 <title>Generic options for transports</title>
39592 <para>
39593 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
39594 <primary>generic options</primary>
39595 <secondary>transport</secondary>
39596 </indexterm>
39597 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
39598 <primary>options</primary>
39599 <secondary>generic; for transports</secondary>
39600 </indexterm>
39601 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
39602 <primary>transport</primary>
39603 <secondary>generic options for</secondary>
39604 </indexterm>
39605 The following generic options apply to all transports:
39606 </para>
39607 <para>
39608 <indexterm role="option">
39609 <primary><option>body_only</option></primary>
39610 </indexterm>
39611 </para>
39612 <informaltable frame="all">
39613 <tgroup cols="4" colsep="0" rowsep="0">
39614 <colspec colwidth="8*" align="left"/>
39615 <colspec colwidth="6*" align="center"/>
39616 <colspec colwidth="6*" align="center"/>
39617 <colspec colwidth="6*" align="right"/>
39618 <tbody>
39619 <row>
39620 <entry><option>body_only</option></entry>
39621 <entry>Use: <emphasis>transports</emphasis></entry>
39622 <entry>Type: <emphasis>boolean</emphasis></entry>
39623 <entry>Default: <emphasis>false</emphasis></entry>
39624 </row>
39625 </tbody>
39626 </tgroup>
39627 </informaltable>
39628 <para>
39629 <indexterm role="concept">
39630 <primary>transport</primary>
39631 <secondary>body only</secondary>
39632 </indexterm>
39633 <indexterm role="concept">
39634 <primary>message</primary>
39635 <secondary>transporting body only</secondary>
39636 </indexterm>
39637 <indexterm role="concept">
39638 <primary>body of message</primary>
39639 <secondary>transporting</secondary>
39640 </indexterm>
39641 If this option is set, the message&#x2019;s headers are not transported. It is
39642 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
39643 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
39644 <option>message_suffix</option> should be checked, because this option does not
39645 automatically suppress them.
39646 </para>
39647 <para>
39648 <indexterm role="option">
39649 <primary><option>current_directory</option></primary>
39650 </indexterm>
39651 </para>
39652 <informaltable frame="all">
39653 <tgroup cols="4" colsep="0" rowsep="0">
39654 <colspec colwidth="8*" align="left"/>
39655 <colspec colwidth="6*" align="center"/>
39656 <colspec colwidth="6*" align="center"/>
39657 <colspec colwidth="6*" align="right"/>
39658 <tbody>
39659 <row>
39660 <entry><option>current_directory</option></entry>
39661 <entry>Use: <emphasis>transports</emphasis></entry>
39662 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39663 <entry>Default: <emphasis>unset</emphasis></entry>
39664 </row>
39665 </tbody>
39666 </tgroup>
39667 </informaltable>
39668 <para>
39669 <indexterm role="concept">
39670 <primary>transport</primary>
39671 <secondary>current directory for</secondary>
39672 </indexterm>
39673 This specifies the current directory that is to be set while running the
39674 transport, overriding any value that may have been set by the router.
39675 If the expansion fails for any reason, including forced failure, an error is
39676 logged, and delivery is deferred.
39677 </para>
39678 <para>
39679 <indexterm role="option">
39680 <primary><option>disable_logging</option></primary>
39681 </indexterm>
39682 </para>
39683 <informaltable frame="all">
39684 <tgroup cols="4" colsep="0" rowsep="0">
39685 <colspec colwidth="8*" align="left"/>
39686 <colspec colwidth="6*" align="center"/>
39687 <colspec colwidth="6*" align="center"/>
39688 <colspec colwidth="6*" align="right"/>
39689 <tbody>
39690 <row>
39691 <entry><option>disable_logging</option></entry>
39692 <entry>Use: <emphasis>transports</emphasis></entry>
39693 <entry>Type: <emphasis>boolean</emphasis></entry>
39694 <entry>Default: <emphasis>false</emphasis></entry>
39695 </row>
39696 </tbody>
39697 </tgroup>
39698 </informaltable>
39699 <para>
39700 If this option is set true, nothing is logged for any
39701 deliveries by the transport or for any
39702 transport errors. You should not set this option unless you really, really know
39703 what you are doing.
39704 </para>
39705 <para>
39706 <indexterm role="option">
39707 <primary><option>debug_print</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>debug_print</option></entry>
39719 <entry>Use: <emphasis>transports</emphasis></entry>
39720 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39721 <entry>Default: <emphasis>unset</emphasis></entry>
39722 </row>
39723 </tbody>
39724 </tgroup>
39725 </informaltable>
39726 <para>
39727 <indexterm role="concept">
39728 <primary>testing</primary>
39729 <secondary>variables in drivers</secondary>
39730 </indexterm>
39731 If this option is set and debugging is enabled (see the <option>-d</option> command line
39732 option), the string is expanded and included in the debugging output when the
39733 transport is run.
39734 If expansion of the string fails, the error message is written to the debugging
39735 output, and Exim carries on processing.
39736 This facility is provided to help with checking out the values of variables and
39737 so on when debugging driver configurations. For example, if a <option>headers_add</option>
39738 option is not working properly, <option>debug_print</option> could be used to output the
39739 variables it references. A newline is added to the text if it does not end with
39740 one.
39741 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
39742 transport and the router that called it.
39743 </para>
39744 <para>
39745 <indexterm role="option">
39746 <primary><option>delivery_date_add</option></primary>
39747 </indexterm>
39748 </para>
39749 <informaltable frame="all">
39750 <tgroup cols="4" colsep="0" rowsep="0">
39751 <colspec colwidth="8*" align="left"/>
39752 <colspec colwidth="6*" align="center"/>
39753 <colspec colwidth="6*" align="center"/>
39754 <colspec colwidth="6*" align="right"/>
39755 <tbody>
39756 <row>
39757 <entry><option>delivery_date_add</option></entry>
39758 <entry>Use: <emphasis>transports</emphasis></entry>
39759 <entry>Type: <emphasis>boolean</emphasis></entry>
39760 <entry>Default: <emphasis>false</emphasis></entry>
39761 </row>
39762 </tbody>
39763 </tgroup>
39764 </informaltable>
39765 <para>
39766 <indexterm role="concept">
39767 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
39768 </indexterm>
39769 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
39770 This gives the actual time the delivery was made. As this is not a standard
39771 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
39772 requests its removal from incoming messages, so that delivered messages can
39773 safely be resent to other recipients.
39774 </para>
39775 <para>
39776 <indexterm role="option">
39777 <primary><option>driver</option></primary>
39778 </indexterm>
39779 </para>
39780 <informaltable frame="all">
39781 <tgroup cols="4" colsep="0" rowsep="0">
39782 <colspec colwidth="8*" align="left"/>
39783 <colspec colwidth="6*" align="center"/>
39784 <colspec colwidth="6*" align="center"/>
39785 <colspec colwidth="6*" align="right"/>
39786 <tbody>
39787 <row>
39788 <entry><option>driver</option></entry>
39789 <entry>Use: <emphasis>transports</emphasis></entry>
39790 <entry>Type: <emphasis>string</emphasis></entry>
39791 <entry>Default: <emphasis>unset</emphasis></entry>
39792 </row>
39793 </tbody>
39794 </tgroup>
39795 </informaltable>
39796 <para>
39797 This specifies which of the available transport drivers is to be used.
39798 There is no default, and this option must be set for every transport.
39799 </para>
39800 <para>
39801 <indexterm role="option">
39802 <primary><option>envelope_to_add</option></primary>
39803 </indexterm>
39804 </para>
39805 <informaltable frame="all">
39806 <tgroup cols="4" colsep="0" rowsep="0">
39807 <colspec colwidth="8*" align="left"/>
39808 <colspec colwidth="6*" align="center"/>
39809 <colspec colwidth="6*" align="center"/>
39810 <colspec colwidth="6*" align="right"/>
39811 <tbody>
39812 <row>
39813 <entry><option>envelope_to_add</option></entry>
39814 <entry>Use: <emphasis>transports</emphasis></entry>
39815 <entry>Type: <emphasis>boolean</emphasis></entry>
39816 <entry>Default: <emphasis>false</emphasis></entry>
39817 </row>
39818 </tbody>
39819 </tgroup>
39820 </informaltable>
39821 <para>
39822 <indexterm role="concept">
39823 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
39824 </indexterm>
39825 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
39826 This gives the original address(es) in the incoming envelope that caused this
39827 delivery to happen. More than one address may be present if the transport is
39828 configured to handle several addresses at once, or if more than one original
39829 address was redirected to the same final address. As this is not a standard
39830 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
39831 its removal from incoming messages, so that delivered messages can safely be
39832 resent to other recipients.
39833 </para>
39834 <para>
39835 <indexterm role="option">
39836 <primary><option>event_action</option></primary>
39837 </indexterm>
39838 </para>
39839 <informaltable frame="all">
39840 <tgroup cols="4" colsep="0" rowsep="0">
39841 <colspec colwidth="8*" align="left"/>
39842 <colspec colwidth="6*" align="center"/>
39843 <colspec colwidth="6*" align="center"/>
39844 <colspec colwidth="6*" align="right"/>
39845 <tbody>
39846 <row>
39847 <entry><option>event_action</option></entry>
39848 <entry>Use: <emphasis>transports</emphasis></entry>
39849 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39850 <entry>Default: <emphasis>unset</emphasis></entry>
39851 </row>
39852 </tbody>
39853 </tgroup>
39854 </informaltable>
39855 <para>
39856 <indexterm role="concept">
39857 <primary>events</primary>
39858 </indexterm>
39859 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
39860 For details see chapter <xref linkend="CHAPevents"/>.
39861 </para>
39862 <para>
39863 <indexterm role="option">
39864 <primary><option>group</option></primary>
39865 </indexterm>
39866 </para>
39867 <informaltable frame="all">
39868 <tgroup cols="4" colsep="0" rowsep="0">
39869 <colspec colwidth="8*" align="left"/>
39870 <colspec colwidth="6*" align="center"/>
39871 <colspec colwidth="6*" align="center"/>
39872 <colspec colwidth="6*" align="right"/>
39873 <tbody>
39874 <row>
39875 <entry><option>group</option></entry>
39876 <entry>Use: <emphasis>transports</emphasis></entry>
39877 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39878 <entry>Default: <emphasis>Exim group</emphasis></entry>
39879 </row>
39880 </tbody>
39881 </tgroup>
39882 </informaltable>
39883 <para>
39884 <indexterm role="concept">
39885 <primary>transport</primary>
39886 <secondary>group; specifying</secondary>
39887 </indexterm>
39888 This option specifies a gid for running the transport process, overriding any
39889 value that the router supplies, and also overriding any value associated with
39890 <option>user</option> (see below).
39891 </para>
39892 <para>
39893 <indexterm role="option">
39894 <primary><option>headers_add</option></primary>
39895 </indexterm>
39896 </para>
39897 <informaltable frame="all">
39898 <tgroup cols="4" colsep="0" rowsep="0">
39899 <colspec colwidth="8*" align="left"/>
39900 <colspec colwidth="6*" align="center"/>
39901 <colspec colwidth="6*" align="center"/>
39902 <colspec colwidth="6*" align="right"/>
39903 <tbody>
39904 <row>
39905 <entry><option>headers_add</option></entry>
39906 <entry>Use: <emphasis>transports</emphasis></entry>
39907 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
39908 <entry>Default: <emphasis>unset</emphasis></entry>
39909 </row>
39910 </tbody>
39911 </tgroup>
39912 </informaltable>
39913 <para>
39914 <indexterm role="concept">
39915 <primary>header lines</primary>
39916 <secondary>adding in transport</secondary>
39917 </indexterm>
39918 <indexterm role="concept">
39919 <primary>transport</primary>
39920 <secondary>header lines; adding</secondary>
39921 </indexterm>
39922 This option specifies a list of text headers,
39923 newline-separated (by default, changeable in the usual way),
39924 which are (separately) expanded and added to the header
39925 portion of a message as it is transported, as described in section
39926 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
39927 routers. If the result of the expansion is an empty string, or if the expansion
39928 is forced to fail, no action is taken. Other expansion failures are treated as
39929 errors and cause the delivery to be deferred.
39930 </para>
39931 <para>
39932 Unlike most options, <option>headers_add</option> can be specified multiple times
39933 for a transport; all listed headers are added.
39934 </para>
39935 <para>
39936 <indexterm role="option">
39937 <primary><option>headers_only</option></primary>
39938 </indexterm>
39939 </para>
39940 <informaltable frame="all">
39941 <tgroup cols="4" colsep="0" rowsep="0">
39942 <colspec colwidth="8*" align="left"/>
39943 <colspec colwidth="6*" align="center"/>
39944 <colspec colwidth="6*" align="center"/>
39945 <colspec colwidth="6*" align="right"/>
39946 <tbody>
39947 <row>
39948 <entry><option>headers_only</option></entry>
39949 <entry>Use: <emphasis>transports</emphasis></entry>
39950 <entry>Type: <emphasis>boolean</emphasis></entry>
39951 <entry>Default: <emphasis>false</emphasis></entry>
39952 </row>
39953 </tbody>
39954 </tgroup>
39955 </informaltable>
39956 <para>
39957 <indexterm role="concept">
39958 <primary>transport</primary>
39959 <secondary>header lines only</secondary>
39960 </indexterm>
39961 <indexterm role="concept">
39962 <primary>message</primary>
39963 <secondary>transporting headers only</secondary>
39964 </indexterm>
39965 <indexterm role="concept">
39966 <primary>header lines</primary>
39967 <secondary>transporting</secondary>
39968 </indexterm>
39969 If this option is set, the message&#x2019;s body is not transported. It is mutually
39970 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
39971 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
39972 checked, since this option does not automatically suppress them.
39973 </para>
39974 <para>
39975 <indexterm role="option">
39976 <primary><option>headers_remove</option></primary>
39977 </indexterm>
39978 </para>
39979 <informaltable frame="all">
39980 <tgroup cols="4" colsep="0" rowsep="0">
39981 <colspec colwidth="8*" align="left"/>
39982 <colspec colwidth="6*" align="center"/>
39983 <colspec colwidth="6*" align="center"/>
39984 <colspec colwidth="6*" align="right"/>
39985 <tbody>
39986 <row>
39987 <entry><option>headers_remove</option></entry>
39988 <entry>Use: <emphasis>transports</emphasis></entry>
39989 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
39990 <entry>Default: <emphasis>unset</emphasis></entry>
39991 </row>
39992 </tbody>
39993 </tgroup>
39994 </informaltable>
39995 <para>
39996 <indexterm role="concept">
39997 <primary>header lines</primary>
39998 <secondary>removing</secondary>
39999 </indexterm>
40000 <indexterm role="concept">
40001 <primary>transport</primary>
40002 <secondary>header lines; removing</secondary>
40003 </indexterm>
40004 This option specifies a list of header names,
40005 colon-separated (by default, changeable in the usual way);
40006 these headers are omitted from the message as it is transported, as described
40007 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
40008 routers.
40009 Each list item is separately expanded.
40010 If the result of the expansion is an empty string, or if the expansion
40011 is forced to fail, no action is taken. Other expansion failures are treated as
40012 errors and cause the delivery to be deferred.
40013 </para>
40014 <para>
40015 Unlike most options, <option>headers_remove</option> can be specified multiple times
40016 for a transport; all listed headers are removed.
40017 </para>
40018 <para>
40019 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
40020 items that contain a list separator must have it doubled.
40021 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
40022 </para>
40023 <para>
40024 <indexterm role="option">
40025 <primary><option>headers_rewrite</option></primary>
40026 </indexterm>
40027 </para>
40028 <informaltable frame="all">
40029 <tgroup cols="4" colsep="0" rowsep="0">
40030 <colspec colwidth="8*" align="left"/>
40031 <colspec colwidth="6*" align="center"/>
40032 <colspec colwidth="6*" align="center"/>
40033 <colspec colwidth="6*" align="right"/>
40034 <tbody>
40035 <row>
40036 <entry><option>headers_rewrite</option></entry>
40037 <entry>Use: <emphasis>transports</emphasis></entry>
40038 <entry>Type: <emphasis>string</emphasis></entry>
40039 <entry>Default: <emphasis>unset</emphasis></entry>
40040 </row>
40041 </tbody>
40042 </tgroup>
40043 </informaltable>
40044 <para>
40045 <indexterm role="concept">
40046 <primary>transport</primary>
40047 <secondary>header lines; rewriting</secondary>
40048 </indexterm>
40049 <indexterm role="concept">
40050 <primary>rewriting</primary>
40051 <secondary>at transport time</secondary>
40052 </indexterm>
40053 This option allows addresses in header lines to be rewritten at transport time,
40054 that is, as the message is being copied to its destination. The contents of the
40055 option are a colon-separated list of rewriting rules. Each rule is in exactly
40056 the same form as one of the general rewriting rules that are applied when a
40057 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
40058 example,
40059 </para>
40060 <literallayout class="monospaced">
40061 headers_rewrite = a@b c@d f : \
40062                   x@y w@z
40063 </literallayout>
40064 <para>
40065 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
40066 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
40067 header lines just before they are written out at transport time, so they affect
40068 only those copies of the message that pass through the transport. However, only
40069 the message&#x2019;s original header lines, and any that were added by a system
40070 filter, are rewritten. If a router or transport adds header lines, they are not
40071 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
40072 envelope. You can change the return path using <option>return_path</option>, but you cannot
40073 change envelope recipients at this time.
40074 </para>
40075 <para>
40076 <indexterm role="option">
40077 <primary><option>home_directory</option></primary>
40078 </indexterm>
40079 </para>
40080 <informaltable frame="all">
40081 <tgroup cols="4" colsep="0" rowsep="0">
40082 <colspec colwidth="8*" align="left"/>
40083 <colspec colwidth="6*" align="center"/>
40084 <colspec colwidth="6*" align="center"/>
40085 <colspec colwidth="6*" align="right"/>
40086 <tbody>
40087 <row>
40088 <entry><option>home_directory</option></entry>
40089 <entry>Use: <emphasis>transports</emphasis></entry>
40090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40091 <entry>Default: <emphasis>unset</emphasis></entry>
40092 </row>
40093 </tbody>
40094 </tgroup>
40095 </informaltable>
40096 <para>
40097 <indexterm role="concept">
40098 <primary>transport</primary>
40099 <secondary>home directory for</secondary>
40100 </indexterm>
40101 <indexterm role="variable">
40102 <primary><varname>$home</varname></primary>
40103 </indexterm>
40104 This option specifies a home directory setting for a local transport,
40105 overriding any value that may be set by the router. The home directory is
40106 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
40107 used as the current directory if no current directory is set by the
40108 <option>current_directory</option> option on the transport or the
40109 <option>transport_current_directory</option> option on the router. If the expansion fails
40110 for any reason, including forced failure, an error is logged, and delivery is
40111 deferred.
40112 </para>
40113 <para>
40114 <indexterm role="option">
40115 <primary><option>initgroups</option></primary>
40116 </indexterm>
40117 </para>
40118 <informaltable frame="all">
40119 <tgroup cols="4" colsep="0" rowsep="0">
40120 <colspec colwidth="8*" align="left"/>
40121 <colspec colwidth="6*" align="center"/>
40122 <colspec colwidth="6*" align="center"/>
40123 <colspec colwidth="6*" align="right"/>
40124 <tbody>
40125 <row>
40126 <entry><option>initgroups</option></entry>
40127 <entry>Use: <emphasis>transports</emphasis></entry>
40128 <entry>Type: <emphasis>boolean</emphasis></entry>
40129 <entry>Default: <emphasis>false</emphasis></entry>
40130 </row>
40131 </tbody>
40132 </tgroup>
40133 </informaltable>
40134 <para>
40135 <indexterm role="concept">
40136 <primary>additional groups</primary>
40137 </indexterm>
40138 <indexterm role="concept">
40139 <primary>groups</primary>
40140 <secondary>additional</secondary>
40141 </indexterm>
40142 <indexterm role="concept">
40143 <primary>transport</primary>
40144 <secondary>group; additional</secondary>
40145 </indexterm>
40146 If this option is true and the uid for the delivery process is provided by the
40147 transport, the <function>initgroups()</function> function is called when running the transport
40148 to ensure that any additional groups associated with the uid are set up.
40149 </para>
40150 <para>
40151 <indexterm role="option">
40152 <primary><option>max_parallel</option></primary>
40153 </indexterm>
40154 </para>
40155 <informaltable frame="all">
40156 <tgroup cols="4" colsep="0" rowsep="0">
40157 <colspec colwidth="8*" align="left"/>
40158 <colspec colwidth="6*" align="center"/>
40159 <colspec colwidth="6*" align="center"/>
40160 <colspec colwidth="6*" align="right"/>
40161 <tbody>
40162 <row>
40163 <entry><option>max_parallel</option></entry>
40164 <entry>Use: <emphasis>transports</emphasis></entry>
40165 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
40166 <entry>Default: <emphasis>unset</emphasis></entry>
40167 </row>
40168 </tbody>
40169 </tgroup>
40170 </informaltable>
40171 <para>
40172 <indexterm role="concept">
40173 <primary>limit</primary>
40174 <secondary>transport parallelism</secondary>
40175 </indexterm>
40176 <indexterm role="concept">
40177 <primary>transport</primary>
40178 <secondary>parallel processes</secondary>
40179 </indexterm>
40180 <indexterm role="concept">
40181 <primary>transport</primary>
40182 <secondary>concurrency limit</secondary>
40183 </indexterm>
40184 <indexterm role="concept">
40185 <primary>delivery</primary>
40186 <secondary>parallelism for transport</secondary>
40187 </indexterm>
40188 If this option is set and expands to an integer greater than zero
40189 it limits the number of concurrent runs of the transport.
40190 The control does not apply to shadow transports.
40191 </para>
40192 <para>
40193 <indexterm role="concept">
40194 <primary>hints database</primary>
40195 <secondary>transport concurrency control</secondary>
40196 </indexterm>
40197 Exim implements this control by means of a hints database in which a record is
40198 incremented whenever a transport process is being created. The record
40199 is decremented and possibly removed when the process terminates.
40200 Obviously there is scope for
40201 records to get left lying around if there is a system or program crash. To
40202 guard against this, Exim ignores any records that are more than six hours old.
40203 </para>
40204 <para>
40205 If you use this option, you should also arrange to delete the
40206 relevant hints database whenever your system reboots. The names of the files
40207 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
40208 may be one or two files, depending on the type of DBM in use. The same files
40209 are used for ETRN and smtp transport serialization.
40210 </para>
40211 <para>
40212 <indexterm role="option">
40213 <primary><option>message_size_limit</option></primary>
40214 </indexterm>
40215 </para>
40216 <informaltable frame="all">
40217 <tgroup cols="4" colsep="0" rowsep="0">
40218 <colspec colwidth="8*" align="left"/>
40219 <colspec colwidth="6*" align="center"/>
40220 <colspec colwidth="6*" align="center"/>
40221 <colspec colwidth="6*" align="right"/>
40222 <tbody>
40223 <row>
40224 <entry><option>message_size_limit</option></entry>
40225 <entry>Use: <emphasis>transports</emphasis></entry>
40226 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40227 <entry>Default: <emphasis>0</emphasis></entry>
40228 </row>
40229 </tbody>
40230 </tgroup>
40231 </informaltable>
40232 <para>
40233 <indexterm role="concept">
40234 <primary>limit</primary>
40235 <secondary>message size per transport</secondary>
40236 </indexterm>
40237 <indexterm role="concept">
40238 <primary>size</primary>
40239 <secondary>of message, limit</secondary>
40240 </indexterm>
40241 <indexterm role="concept">
40242 <primary>transport</primary>
40243 <secondary>message size; limiting</secondary>
40244 </indexterm>
40245 This option controls the size of messages passed through the transport. It is
40246 expanded before use; the result of the expansion must be a sequence of decimal
40247 digits, optionally followed by K or M. If the expansion fails for any reason,
40248 including forced failure, or if the result is not of the required form,
40249 delivery is deferred. If the value is greater than zero and the size of a
40250 message exceeds this limit, the address is failed. If there is any chance that
40251 the resulting bounce message could be routed to the same transport, you should
40252 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
40253 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
40254 delivered.
40255 </para>
40256 <para>
40257 <indexterm role="option">
40258 <primary><option>rcpt_include_affixes</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>rcpt_include_affixes</option></entry>
40270 <entry>Use: <emphasis>transports</emphasis></entry>
40271 <entry>Type: <emphasis>boolean</emphasis></entry>
40272 <entry>Default: <emphasis>false</emphasis></entry>
40273 </row>
40274 </tbody>
40275 </tgroup>
40276 </informaltable>
40277 <para>
40278 <indexterm role="concept">
40279 <primary>prefix</primary>
40280 <secondary>for local part, including in envelope</secondary>
40281 </indexterm>
40282 <indexterm role="concept">
40283 <primary>suffix for local part</primary>
40284 <secondary>including in envelope</secondary>
40285 </indexterm>
40286 <indexterm role="concept">
40287 <primary>local part</primary>
40288 <secondary>prefix</secondary>
40289 </indexterm>
40290 <indexterm role="concept">
40291 <primary>local part</primary>
40292 <secondary>suffix</secondary>
40293 </indexterm>
40294 When this option is false (the default), and an address that has had any
40295 affixes (prefixes or suffixes) removed from the local part is delivered by any
40296 form of SMTP or LMTP, the affixes are not included. For example, if a router
40297 that contains
40298 </para>
40299 <literallayout class="monospaced">
40300 local_part_prefix = *-
40301 </literallayout>
40302 <para>
40303 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
40304 is delivered with
40305 </para>
40306 <literallayout class="monospaced">
40307 RCPT TO:&lt;xyz@some.domain&gt;
40308 </literallayout>
40309 <para>
40310 This is also the case when an ACL-time callout is being used to verify a
40311 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
40312 whole local part is included in the RCPT command. This option applies to BSMTP
40313 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
40314 <command>lmtp</command> and <command>smtp</command> transports.
40315 </para>
40316 <para>
40317 <indexterm role="option">
40318 <primary><option>retry_use_local_part</option></primary>
40319 </indexterm>
40320 </para>
40321 <informaltable frame="all">
40322 <tgroup cols="4" colsep="0" rowsep="0">
40323 <colspec colwidth="8*" align="left"/>
40324 <colspec colwidth="6*" align="center"/>
40325 <colspec colwidth="6*" align="center"/>
40326 <colspec colwidth="6*" align="right"/>
40327 <tbody>
40328 <row>
40329 <entry><option>retry_use_local_part</option></entry>
40330 <entry>Use: <emphasis>transports</emphasis></entry>
40331 <entry>Type: <emphasis>boolean</emphasis></entry>
40332 <entry>Default: <emphasis>see below</emphasis></entry>
40333 </row>
40334 </tbody>
40335 </tgroup>
40336 </informaltable>
40337 <para>
40338 <indexterm role="concept">
40339 <primary>hints database</primary>
40340 <secondary>retry keys</secondary>
40341 </indexterm>
40342 When a delivery suffers a temporary failure, a retry record is created
40343 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
40344 is based on the name and/or IP address of the failing remote host. For local
40345 deliveries, the key is normally the entire address, including both the local
40346 part and the domain. This is suitable for most common cases of local delivery
40347 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
40348 deliveries to that mailbox, not to the whole domain.
40349 </para>
40350 <para>
40351 However, in some special cases you may want to treat a temporary local delivery
40352 as a failure associated with the domain, and not with a particular local part.
40353 (For example, if you are storing all mail for some domain in files.) You can do
40354 this by setting <option>retry_use_local_part</option> false.
40355 </para>
40356 <para>
40357 For all the local transports, its default value is true. For remote transports,
40358 the default value is false for tidiness, but changing the value has no effect
40359 on a remote transport in the current implementation.
40360 </para>
40361 <para>
40362 <indexterm role="option">
40363 <primary><option>return_path</option></primary>
40364 </indexterm>
40365 </para>
40366 <informaltable frame="all">
40367 <tgroup cols="4" colsep="0" rowsep="0">
40368 <colspec colwidth="8*" align="left"/>
40369 <colspec colwidth="6*" align="center"/>
40370 <colspec colwidth="6*" align="center"/>
40371 <colspec colwidth="6*" align="right"/>
40372 <tbody>
40373 <row>
40374 <entry><option>return_path</option></entry>
40375 <entry>Use: <emphasis>transports</emphasis></entry>
40376 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40377 <entry>Default: <emphasis>unset</emphasis></entry>
40378 </row>
40379 </tbody>
40380 </tgroup>
40381 </informaltable>
40382 <para>
40383 <indexterm role="concept">
40384 <primary>envelope sender</primary>
40385 </indexterm>
40386 <indexterm role="concept">
40387 <primary>transport</primary>
40388 <secondary>return path; changing</secondary>
40389 </indexterm>
40390 <indexterm role="concept">
40391 <primary>return path</primary>
40392 <secondary>changing in transport</secondary>
40393 </indexterm>
40394 If this option is set, the string is expanded at transport time and replaces
40395 the existing return path (envelope sender) value in the copy of the message
40396 that is being delivered. An empty return path is permitted. This feature is
40397 designed for remote deliveries, where the value of this option is used in the
40398 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
40399 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
40400 header line, if one is added to the message (see the next option).
40401 </para>
40402 <para>
40403 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
40404 <option>return_path_on_delivery</option> to the log selector.
40405 </para>
40406 <para>
40407 <indexterm role="variable">
40408 <primary><varname>$return_path</varname></primary>
40409 </indexterm>
40410 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
40411 either the message&#x2019;s envelope sender, or an address set by the
40412 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
40413 replacement occurs; if it fails for another reason, delivery is deferred. This
40414 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
40415 section <xref linkend="SECTverp"/>.
40416 </para>
40417 <para>
40418 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
40419 remote server rejects a message at SMTP time, the bounce message is not sent to
40420 the value of this option. It is sent to the previously set errors address.
40421 This defaults to the incoming sender address, but can be changed by setting
40422 <option>errors_to</option> in a router.
40423 </para>
40424 <para>
40425 <indexterm role="option">
40426 <primary><option>return_path_add</option></primary>
40427 </indexterm>
40428 </para>
40429 <informaltable frame="all">
40430 <tgroup cols="4" colsep="0" rowsep="0">
40431 <colspec colwidth="8*" align="left"/>
40432 <colspec colwidth="6*" align="center"/>
40433 <colspec colwidth="6*" align="center"/>
40434 <colspec colwidth="6*" align="right"/>
40435 <tbody>
40436 <row>
40437 <entry><option>return_path_add</option></entry>
40438 <entry>Use: <emphasis>transports</emphasis></entry>
40439 <entry>Type: <emphasis>boolean</emphasis></entry>
40440 <entry>Default: <emphasis>false</emphasis></entry>
40441 </row>
40442 </tbody>
40443 </tgroup>
40444 </informaltable>
40445 <para>
40446 <indexterm role="concept">
40447 <primary><emphasis>Return-path:</emphasis> header line</primary>
40448 </indexterm>
40449 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
40450 Although the return path is normally available in the prefix line of BSD
40451 mailboxes, this is commonly not displayed by MUAs, and so the user does not
40452 have easy access to it.
40453 </para>
40454 <para>
40455 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
40456 the delivery SMTP server makes the final delivery</quote>. This implies that this
40457 header should not be present in incoming messages. Exim has a configuration
40458 option, <option>return_path_remove</option>, which requests removal of this header from
40459 incoming messages, so that delivered messages can safely be resent to other
40460 recipients.
40461 </para>
40462 <para>
40463 <indexterm role="option">
40464 <primary><option>shadow_condition</option></primary>
40465 </indexterm>
40466 </para>
40467 <informaltable frame="all">
40468 <tgroup cols="4" colsep="0" rowsep="0">
40469 <colspec colwidth="8*" align="left"/>
40470 <colspec colwidth="6*" align="center"/>
40471 <colspec colwidth="6*" align="center"/>
40472 <colspec colwidth="6*" align="right"/>
40473 <tbody>
40474 <row>
40475 <entry><option>shadow_condition</option></entry>
40476 <entry>Use: <emphasis>transports</emphasis></entry>
40477 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40478 <entry>Default: <emphasis>unset</emphasis></entry>
40479 </row>
40480 </tbody>
40481 </tgroup>
40482 </informaltable>
40483 <para>
40484 See <option>shadow_transport</option> below.
40485 </para>
40486 <para>
40487 <indexterm role="option">
40488 <primary><option>shadow_transport</option></primary>
40489 </indexterm>
40490 </para>
40491 <informaltable frame="all">
40492 <tgroup cols="4" colsep="0" rowsep="0">
40493 <colspec colwidth="8*" align="left"/>
40494 <colspec colwidth="6*" align="center"/>
40495 <colspec colwidth="6*" align="center"/>
40496 <colspec colwidth="6*" align="right"/>
40497 <tbody>
40498 <row>
40499 <entry><option>shadow_transport</option></entry>
40500 <entry>Use: <emphasis>transports</emphasis></entry>
40501 <entry>Type: <emphasis>string</emphasis></entry>
40502 <entry>Default: <emphasis>unset</emphasis></entry>
40503 </row>
40504 </tbody>
40505 </tgroup>
40506 </informaltable>
40507 <para>
40508 <indexterm role="concept">
40509 <primary>shadow transport</primary>
40510 </indexterm>
40511 <indexterm role="concept">
40512 <primary>transport</primary>
40513 <secondary>shadow</secondary>
40514 </indexterm>
40515 A local transport may set the <option>shadow_transport</option> option to the name of
40516 another local transport. Shadow remote transports are not supported.
40517 </para>
40518 <para>
40519 Whenever a delivery to the main transport succeeds, and either
40520 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
40521 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
40522 passed to the shadow transport, with the same delivery address or addresses. If
40523 expansion fails, no action is taken except that non-forced expansion failures
40524 cause a log line to be written.
40525 </para>
40526 <para>
40527 The result of the shadow transport is discarded and does not affect the
40528 subsequent processing of the message. Only a single level of shadowing is
40529 provided; the <option>shadow_transport</option> option is ignored on any transport when it
40530 is running as a shadow. Options concerned with output from pipes are also
40531 ignored. The log line for the successful delivery has an item added on the end,
40532 of the form
40533 </para>
40534 <literallayout class="monospaced">
40535 ST=&lt;shadow transport name&gt;
40536 </literallayout>
40537 <para>
40538 If the shadow transport did not succeed, the error message is put in
40539 parentheses afterwards. Shadow transports can be used for a number of different
40540 purposes, including keeping more detailed log information than Exim normally
40541 provides, and implementing automatic acknowledgment policies based on message
40542 headers that some sites insist on.
40543 </para>
40544 <para>
40545 <indexterm role="option">
40546 <primary><option>transport_filter</option></primary>
40547 </indexterm>
40548 </para>
40549 <informaltable frame="all">
40550 <tgroup cols="4" colsep="0" rowsep="0">
40551 <colspec colwidth="8*" align="left"/>
40552 <colspec colwidth="6*" align="center"/>
40553 <colspec colwidth="6*" align="center"/>
40554 <colspec colwidth="6*" align="right"/>
40555 <tbody>
40556 <row>
40557 <entry><option>transport_filter</option></entry>
40558 <entry>Use: <emphasis>transports</emphasis></entry>
40559 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40560 <entry>Default: <emphasis>unset</emphasis></entry>
40561 </row>
40562 </tbody>
40563 </tgroup>
40564 </informaltable>
40565 <para>
40566 <indexterm role="concept">
40567 <primary>transport</primary>
40568 <secondary>filter</secondary>
40569 </indexterm>
40570 <indexterm role="concept">
40571 <primary>filter</primary>
40572 <secondary>transport filter</secondary>
40573 </indexterm>
40574 This option sets up a filtering (in the Unix shell sense) process for messages
40575 at transport time. It should not be confused with mail filtering as set up by
40576 individual users or via a system filter.
40577 If unset, or expanding to an empty string, no filtering is done.
40578 </para>
40579 <para>
40580 When the message is about to be written out, the command specified by
40581 <option>transport_filter</option> is started up in a separate, parallel process, and
40582 the entire message, including the header lines, is passed to it on its standard
40583 input (this in fact is done from a third process, to avoid deadlock). The
40584 command must be specified as an absolute path.
40585 </para>
40586 <para>
40587 The lines of the message that are written to the transport filter are
40588 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
40589 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
40590 lines beginning with a dot, and also before any processing implied by the
40591 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
40592 <command>pipe</command> transports.
40593 </para>
40594 <para>
40595 The standard error for the filter process is set to the same destination as its
40596 standard output; this is read and written to the message&#x2019;s ultimate
40597 destination. The process that writes the message to the filter, the
40598 filter itself, and the original process that reads the result and delivers it
40599 are all run in parallel, like a shell pipeline.
40600 </para>
40601 <para>
40602 The filter can perform any transformations it likes, but of course should take
40603 care not to break RFC 2822 syntax. Exim does not check the result, except to
40604 test for a final newline when SMTP is in use. All messages transmitted over
40605 SMTP must end with a newline, so Exim supplies one if it is missing.
40606 </para>
40607 <para>
40608 <indexterm role="concept">
40609 <primary>content scanning</primary>
40610 <secondary>per user</secondary>
40611 </indexterm>
40612 A transport filter can be used to provide content-scanning on a per-user basis
40613 at delivery time if the only required effect of the scan is to modify the
40614 message. For example, a content scan could insert a new header line containing
40615 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
40616 not possible to discard a message at this stage.
40617 </para>
40618 <para>
40619 <indexterm role="concept">
40620 <primary>SMTP</primary>
40621 <secondary>SIZE</secondary>
40622 </indexterm>
40623 A problem might arise if the filter increases the size of a message that is
40624 being sent down an SMTP connection. If the receiving SMTP server has indicated
40625 support for the SIZE parameter, Exim will have sent the size of the message
40626 at the start of the SMTP session. If what is actually sent is substantially
40627 more, the server might reject the message. This can be worked round by setting
40628 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
40629 additions to the message, or to disable the use of SIZE altogether.
40630 </para>
40631 <para>
40632 <indexterm role="variable">
40633 <primary><varname>$pipe_addresses</varname></primary>
40634 </indexterm>
40635 The value of the <option>transport_filter</option> option is the command string for starting
40636 the filter, which is run directly from Exim, not under a shell. The string is
40637 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
40638 Exim breaks it up into arguments and then expands each argument separately (see
40639 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
40640 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
40641 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
40642 an ideal name for this feature here, but as it was already implemented for the
40643 <command>pipe</command> transport, it seemed sensible not to change it.)
40644 </para>
40645 <para>
40646 <indexterm role="variable">
40647 <primary><varname>$host</varname></primary>
40648 </indexterm>
40649 <indexterm role="variable">
40650 <primary><varname>$host_address</varname></primary>
40651 </indexterm>
40652 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
40653 transport is a remote one. They contain the name and IP address of the host to
40654 which the message is being sent. For example:
40655 </para>
40656 <literallayout class="monospaced">
40657 transport_filter = /some/directory/transport-filter.pl \
40658   $host $host_address $sender_address $pipe_addresses
40659 </literallayout>
40660 <para>
40661 Two problems arise if you want to use more complicated expansion items to
40662 generate transport filter commands, both of which due to the fact that the
40663 command is split up <emphasis>before</emphasis> expansion.
40664 </para>
40665 <itemizedlist>
40666 <listitem>
40667 <para>
40668 If an expansion item contains white space, you must quote it, so that it is all
40669 part of the same command item. If the entire option setting is one such
40670 expansion item, you have to take care what kind of quoting you use. For
40671 example:
40672 </para>
40673 <literallayout class="monospaced">
40674 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
40675 </literallayout>
40676 <para>
40677 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
40678 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
40679 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
40680 the single quotes were missing, the line would be split into two items,
40681 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
40682 Exim tried to expand the first one.
40683 </para>
40684 </listitem>
40685 <listitem>
40686 <para>
40687 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
40688 expansion cannot generate multiple arguments, or a command name followed by
40689 arguments. Consider this example:
40690 </para>
40691 <literallayout class="monospaced">
40692 transport_filter = ${lookup{$host}lsearch{/a/file}\
40693                     {$value}{/bin/cat}}
40694 </literallayout>
40695 <para>
40696 The result of the lookup is interpreted as the name of the command, even
40697 if it contains white space. The simplest way round this is to use a shell:
40698 </para>
40699 <literallayout class="monospaced">
40700 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
40701                                {$value}{/bin/cat}}
40702 </literallayout>
40703 </listitem>
40704 </itemizedlist>
40705 <para>
40706 The filter process is run under the same uid and gid as the normal delivery.
40707 For remote deliveries this is the Exim uid/gid by default. The command should
40708 normally yield a zero return code. Transport filters are not supposed to fail.
40709 A non-zero code is taken to mean that the transport filter encountered some
40710 serious problem. Delivery of the message is deferred; the message remains on
40711 the queue and is tried again later. It is not possible to cause a message to be
40712 bounced from a transport filter.
40713 </para>
40714 <para>
40715 If a transport filter is set on an autoreply transport, the original message is
40716 passed through the filter as it is being copied into the newly generated
40717 message, which happens if the <option>return_message</option> option is set.
40718 </para>
40719 <para>
40720 <indexterm role="option">
40721 <primary><option>transport_filter_timeout</option></primary>
40722 </indexterm>
40723 </para>
40724 <informaltable frame="all">
40725 <tgroup cols="4" colsep="0" rowsep="0">
40726 <colspec colwidth="8*" align="left"/>
40727 <colspec colwidth="6*" align="center"/>
40728 <colspec colwidth="6*" align="center"/>
40729 <colspec colwidth="6*" align="right"/>
40730 <tbody>
40731 <row>
40732 <entry><option>transport_filter_timeout</option></entry>
40733 <entry>Use: <emphasis>transports</emphasis></entry>
40734 <entry>Type: <emphasis>time</emphasis></entry>
40735 <entry>Default: <emphasis>5m</emphasis></entry>
40736 </row>
40737 </tbody>
40738 </tgroup>
40739 </informaltable>
40740 <para>
40741 <indexterm role="concept">
40742 <primary>transport</primary>
40743 <secondary>filter, timeout</secondary>
40744 </indexterm>
40745 When Exim is reading the output of a transport filter, it applies a timeout
40746 that can be set by this option. Exceeding the timeout is normally treated as a
40747 temporary delivery failure. However, if a transport filter is used with a
40748 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
40749 way as a timeout in the pipe command itself. By default, a timeout is a hard
40750 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
40751 becomes a temporary error.
40752 </para>
40753 <para>
40754 <indexterm role="option">
40755 <primary><option>user</option></primary>
40756 </indexterm>
40757 </para>
40758 <informaltable frame="all">
40759 <tgroup cols="4" colsep="0" rowsep="0">
40760 <colspec colwidth="8*" align="left"/>
40761 <colspec colwidth="6*" align="center"/>
40762 <colspec colwidth="6*" align="center"/>
40763 <colspec colwidth="6*" align="right"/>
40764 <tbody>
40765 <row>
40766 <entry><option>user</option></entry>
40767 <entry>Use: <emphasis>transports</emphasis></entry>
40768 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40769 <entry>Default: <emphasis>Exim user</emphasis></entry>
40770 </row>
40771 </tbody>
40772 </tgroup>
40773 </informaltable>
40774 <para>
40775 <indexterm role="concept">
40776 <primary>uid (user id)</primary>
40777 <secondary>local delivery</secondary>
40778 </indexterm>
40779 <indexterm role="concept">
40780 <primary>transport</primary>
40781 <secondary>user, specifying</secondary>
40782 </indexterm>
40783 This option specifies the user under whose uid the delivery process is to be
40784 run, overriding any uid that may have been set by the router. If the user is
40785 given as a name, the uid is looked up from the password data, and the
40786 associated group is taken as the value of the gid to be used if the <option>group</option>
40787 option is not set.
40788 </para>
40789 <para>
40790 For deliveries that use local transports, a user and group are normally
40791 specified explicitly or implicitly (for example, as a result of
40792 <option>check_local_user</option>) by the router or transport.
40793 </para>
40794 <para>
40795 <indexterm role="concept">
40796 <primary>hints database</primary>
40797 <secondary>access by remote transport</secondary>
40798 </indexterm>
40799 For remote transports, you should leave this option unset unless you really are
40800 sure you know what you are doing. When a remote transport is running, it needs
40801 to be able to access Exim&#x2019;s hints databases, because each host may have its own
40802 retry data.
40803 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
40804 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
40805 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
40806 </para>
40807 </chapter>
40808
40809 <chapter id="CHAPbatching">
40810 <title>Address batching in local transports</title>
40811 <titleabbrev>Address batching</titleabbrev>
40812 <para>
40813 <indexterm role="concept">
40814 <primary>transport</primary>
40815 <secondary>local; address batching in</secondary>
40816 </indexterm>
40817 The only remote transport (<command>smtp</command>) is normally configured to handle more than
40818 one address at a time, so that when several addresses are routed to the same
40819 remote host, just one copy of the message is sent. Local transports, however,
40820 normally handle one address at a time. That is, a separate instance of the
40821 transport is run for each address that is routed to the transport. A separate
40822 copy of the message is delivered each time.
40823 </para>
40824 <para>
40825 <indexterm role="concept">
40826 <primary>batched local delivery</primary>
40827 </indexterm>
40828 <indexterm role="option">
40829 <primary><option>batch_max</option></primary>
40830 </indexterm>
40831 <indexterm role="option">
40832 <primary><option>batch_id</option></primary>
40833 </indexterm>
40834 In special cases, it may be desirable to handle several addresses at once in a
40835 local transport, for example:
40836 </para>
40837 <itemizedlist>
40838 <listitem>
40839 <para>
40840 In an <command>appendfile</command> transport, when storing messages in files for later
40841 delivery by some other means, a single copy of the message with multiple
40842 recipients saves space.
40843 </para>
40844 </listitem>
40845 <listitem>
40846 <para>
40847 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
40848 a single copy saves time, and is the normal way LMTP is expected to work.
40849 </para>
40850 </listitem>
40851 <listitem>
40852 <para>
40853 In a <command>pipe</command> transport, when passing the message
40854 to a scanner program or
40855 to some other delivery mechanism such as UUCP, multiple recipients may be
40856 acceptable.
40857 </para>
40858 </listitem>
40859 </itemizedlist>
40860 <para>
40861 These three local transports all have the same options for controlling multiple
40862 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
40863 repeating the information for each transport, these options are described here.
40864 </para>
40865 <para>
40866 The <option>batch_max</option> option specifies the maximum number of addresses that can be
40867 delivered together in a single run of the transport. Its default value is one
40868 (no batching). When more than one address is routed to a transport that has a
40869 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
40870 (that is, in a single run of the transport with multiple recipients), subject
40871 to certain conditions:
40872 </para>
40873 <itemizedlist>
40874 <listitem>
40875 <para>
40876 <indexterm role="variable">
40877 <primary><varname>$local_part</varname></primary>
40878 </indexterm>
40879 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
40880 batching is possible.
40881 </para>
40882 </listitem>
40883 <listitem>
40884 <para>
40885 <indexterm role="variable">
40886 <primary><varname>$domain</varname></primary>
40887 </indexterm>
40888 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
40889 addresses with the same domain are batched.
40890 </para>
40891 </listitem>
40892 <listitem>
40893 <para>
40894 <indexterm role="concept">
40895 <primary>customizing</primary>
40896 <secondary>batching condition</secondary>
40897 </indexterm>
40898 If <option>batch_id</option> is set, it is expanded for each address, and only those
40899 addresses with the same expanded value are batched. This allows you to specify
40900 customized batching conditions. Failure of the expansion for any reason,
40901 including forced failure, disables batching, but it does not stop the delivery
40902 from taking place.
40903 </para>
40904 </listitem>
40905 <listitem>
40906 <para>
40907 Batched addresses must also have the same errors address (where to send
40908 delivery errors), the same header additions and removals, the same user and
40909 group for the transport, and if a host list is present, the first host must
40910 be the same.
40911 </para>
40912 </listitem>
40913 </itemizedlist>
40914 <para>
40915 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
40916 both when the file or pipe command is specified in the transport, and when it
40917 is specified by a <command>redirect</command> router, but all the batched addresses must of
40918 course be routed to the same file or pipe command. These two transports have an
40919 option called <option>use_bsmtp</option>, which causes them to deliver the message in
40920 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
40921 <option>check_string</option> and <option>escape_string</option> options are forced to the values
40922 </para>
40923 <literallayout class="monospaced">
40924 check_string = "."
40925 escape_string = ".."
40926 </literallayout>
40927 <para>
40928 when batched SMTP is in use. A full description of the batch SMTP mechanism is
40929 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
40930 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
40931 </para>
40932 <para>
40933 <indexterm role="concept">
40934 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
40935 </indexterm>
40936 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
40937 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
40938 that are being processed together. If you are using a batching <command>appendfile</command>
40939 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
40940 addresses is to set the <option>envelope_to_add</option> option.
40941 </para>
40942 <para>
40943 <indexterm role="concept">
40944 <primary><command>pipe</command> transport</primary>
40945 <secondary>with multiple addresses</secondary>
40946 </indexterm>
40947 <indexterm role="variable">
40948 <primary><varname>$pipe_addresses</varname></primary>
40949 </indexterm>
40950 If you are using a <command>pipe</command> transport without BSMTP, and setting the
40951 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
40952 the command. This is not a true variable; it is a bit of magic that causes each
40953 of the recipient addresses to be inserted into the command as a separate
40954 argument. This provides a way of accessing all the addresses that are being
40955 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
40956 are specified by a <command>redirect</command> router.
40957 </para>
40958 </chapter>
40959
40960 <chapter id="CHAPappendfile">
40961 <title>The appendfile transport</title>
40962 <para>
40963 <indexterm role="concept" id="IIDapptra1" class="startofrange">
40964 <primary><command>appendfile</command> transport</primary>
40965 </indexterm>
40966 <indexterm role="concept" id="IIDapptra2" class="startofrange">
40967 <primary>transports</primary>
40968 <secondary><command>appendfile</command></secondary>
40969 </indexterm>
40970 <indexterm role="concept">
40971 <primary>directory creation</primary>
40972 </indexterm>
40973 <indexterm role="concept">
40974 <primary>creating directories</primary>
40975 </indexterm>
40976 The <command>appendfile</command> transport delivers a message by appending it to an existing
40977 file, or by creating an entirely new file in a specified directory. Single
40978 files to which messages are appended can be in the traditional Unix mailbox
40979 format, or optionally in the MBX format supported by the Pine MUA and
40980 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
40981 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
40982 to give added protection against failures that happen part-way through the
40983 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
40984 supported. For all file formats, Exim attempts to create as many levels of
40985 directory as necessary, provided that <option>create_directory</option> is set.
40986 </para>
40987 <para>
40988 The code for the optional formats is not included in the Exim binary by
40989 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
40990 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
40991 included.
40992 </para>
40993 <para>
40994 <indexterm role="concept">
40995 <primary>quota</primary>
40996 <secondary>system</secondary>
40997 </indexterm>
40998 Exim recognizes system quota errors, and generates an appropriate message. Exim
40999 also supports its own quota control within the transport, for use when the
41000 system facility is unavailable or cannot be used for some reason.
41001 </para>
41002 <para>
41003 If there is an error while appending to a file (for example, quota exceeded or
41004 partition filled), Exim attempts to reset the file&#x2019;s length and last
41005 modification time back to what they were before. If there is an error while
41006 creating an entirely new file, the new file is removed.
41007 </para>
41008 <para>
41009 Before appending to a file, a number of security checks are made, and the
41010 file is locked. A detailed description is given below, after the list of
41011 private options.
41012 </para>
41013 <para>
41014 The <command>appendfile</command> transport is most commonly used for local deliveries to
41015 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
41016 putting messages into files for remote delivery by some means other than Exim.
41017 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
41018 option).
41019 </para>
41020 <section id="SECTfildiropt">
41021 <title>The file and directory options</title>
41022 <para>
41023 The <option>file</option> option specifies a single file, to which the message is appended;
41024 the <option>directory</option> option specifies a directory, in which a new file containing
41025 the message is created. Only one of these two options can be set, and for
41026 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
41027 </para>
41028 <para>
41029 <indexterm role="variable">
41030 <primary><varname>$address_file</varname></primary>
41031 </indexterm>
41032 <indexterm role="variable">
41033 <primary><varname>$local_part</varname></primary>
41034 </indexterm>
41035 However, <command>appendfile</command> is also used for delivering messages to files or
41036 directories whose names (or parts of names) are obtained from alias,
41037 forwarding, or filtering operations (for example, a <option>save</option> command in a
41038 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
41039 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
41040 name (or partial name) of the file or directory generated by the redirection
41041 operation. There are two cases:
41042 </para>
41043 <itemizedlist>
41044 <listitem>
41045 <para>
41046 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
41047 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
41048 common case when users with local accounts use filtering to sort mail into
41049 different folders. See for example, the <command>address_file</command> transport in the
41050 default configuration. If the path ends with a slash, it is assumed to be the
41051 name of a directory. A delivery to a directory can also be forced by setting
41052 <option>maildir_format</option> or <option>mailstore_format</option>.
41053 </para>
41054 </listitem>
41055 <listitem>
41056 <para>
41057 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
41058 used to determine the file or directory name for the delivery. Normally, the
41059 contents of <varname>$address_file</varname> are used in some way in the string expansion.
41060 </para>
41061 </listitem>
41062 </itemizedlist>
41063 <para>
41064 <indexterm role="concept">
41065 <primary>Sieve filter</primary>
41066 <secondary>configuring <command>appendfile</command></secondary>
41067 </indexterm>
41068 <indexterm role="concept">
41069 <primary>Sieve filter</primary>
41070 <secondary>relative mailbox path handling</secondary>
41071 </indexterm>
41072 As an example of the second case, consider an environment where users do not
41073 have home directories. They may be permitted to use Exim filter commands of the
41074 form:
41075 </para>
41076 <literallayout class="monospaced">
41077 save folder23
41078 </literallayout>
41079 <para>
41080 or Sieve filter commands of the form:
41081 </para>
41082 <literallayout class="monospaced">
41083 require "fileinto";
41084 fileinto "folder23";
41085 </literallayout>
41086 <para>
41087 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
41088 must transform the relative path into an appropriate absolute file name. In the
41089 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
41090 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
41091 way of handling this requirement:
41092 </para>
41093 <literallayout class="monospaced">
41094 file = ${if eq{$address_file}{inbox} \
41095             {/var/mail/$local_part} \
41096             {${if eq{${substr_0_1:$address_file}}{/} \
41097                   {$address_file} \
41098                   {$home/mail/$address_file} \
41099             }} \
41100        }
41101 </literallayout>
41102 <para>
41103 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
41104 location, absolute paths are used without change, and other folders are in the
41105 <filename>mail</filename> directory within the home directory.
41106 </para>
41107 <para>
41108 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
41109 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
41110 the router. In particular, this is the case if <option>check_local_user</option> is set. If
41111 you want to prevent this happening at routing time, you can set
41112 <option>router_home_directory</option> empty. This forces the router to pass the relative
41113 path to the transport.
41114 </para>
41115 <para>
41116 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
41117 the <option>file</option> or <option>directory</option> option is still used if it is set.
41118 </para>
41119 </section>
41120 <section id="SECID134">
41121 <title>Private options for appendfile</title>
41122 <para>
41123 <indexterm role="concept">
41124 <primary>options</primary>
41125 <secondary><command>appendfile</command> transport</secondary>
41126 </indexterm>
41127 </para>
41128 <para>
41129 <indexterm role="option">
41130 <primary><option>allow_fifo</option></primary>
41131 </indexterm>
41132 </para>
41133 <informaltable frame="all">
41134 <tgroup cols="4" colsep="0" rowsep="0">
41135 <colspec colwidth="8*" align="left"/>
41136 <colspec colwidth="6*" align="center"/>
41137 <colspec colwidth="6*" align="center"/>
41138 <colspec colwidth="6*" align="right"/>
41139 <tbody>
41140 <row>
41141 <entry><option>allow_fifo</option></entry>
41142 <entry>Use: <emphasis>appendfile</emphasis></entry>
41143 <entry>Type: <emphasis>boolean</emphasis></entry>
41144 <entry>Default: <emphasis>false</emphasis></entry>
41145 </row>
41146 </tbody>
41147 </tgroup>
41148 </informaltable>
41149 <para>
41150 <indexterm role="concept">
41151 <primary>fifo (named pipe)</primary>
41152 </indexterm>
41153 <indexterm role="concept">
41154 <primary>named pipe (fifo)</primary>
41155 </indexterm>
41156 <indexterm role="concept">
41157 <primary>pipe</primary>
41158 <secondary>named (fifo)</secondary>
41159 </indexterm>
41160 Setting this option permits delivery to named pipes (FIFOs) as well as to
41161 regular files. If no process is reading the named pipe at delivery time, the
41162 delivery is deferred.
41163 </para>
41164 <para>
41165 <indexterm role="option">
41166 <primary><option>allow_symlink</option></primary>
41167 </indexterm>
41168 </para>
41169 <informaltable frame="all">
41170 <tgroup cols="4" colsep="0" rowsep="0">
41171 <colspec colwidth="8*" align="left"/>
41172 <colspec colwidth="6*" align="center"/>
41173 <colspec colwidth="6*" align="center"/>
41174 <colspec colwidth="6*" align="right"/>
41175 <tbody>
41176 <row>
41177 <entry><option>allow_symlink</option></entry>
41178 <entry>Use: <emphasis>appendfile</emphasis></entry>
41179 <entry>Type: <emphasis>boolean</emphasis></entry>
41180 <entry>Default: <emphasis>false</emphasis></entry>
41181 </row>
41182 </tbody>
41183 </tgroup>
41184 </informaltable>
41185 <para>
41186 <indexterm role="concept">
41187 <primary>symbolic link</primary>
41188 <secondary>to mailbox</secondary>
41189 </indexterm>
41190 <indexterm role="concept">
41191 <primary>mailbox</primary>
41192 <secondary>symbolic link</secondary>
41193 </indexterm>
41194 By default, <command>appendfile</command> will not deliver if the path name for the file is
41195 that of a symbolic link. Setting this option relaxes that constraint, but there
41196 are security issues involved in the use of symbolic links. Be sure you know
41197 what you are doing if you set this. Details of exactly what this option affects
41198 are included in the discussion which follows this list of options.
41199 </para>
41200 <para>
41201 <indexterm role="option">
41202 <primary><option>batch_id</option></primary>
41203 </indexterm>
41204 </para>
41205 <informaltable frame="all">
41206 <tgroup cols="4" colsep="0" rowsep="0">
41207 <colspec colwidth="8*" align="left"/>
41208 <colspec colwidth="6*" align="center"/>
41209 <colspec colwidth="6*" align="center"/>
41210 <colspec colwidth="6*" align="right"/>
41211 <tbody>
41212 <row>
41213 <entry><option>batch_id</option></entry>
41214 <entry>Use: <emphasis>appendfile</emphasis></entry>
41215 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41216 <entry>Default: <emphasis>unset</emphasis></entry>
41217 </row>
41218 </tbody>
41219 </tgroup>
41220 </informaltable>
41221 <para>
41222 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41223 However, batching is automatically disabled for <command>appendfile</command> deliveries that
41224 happen as a result of forwarding or aliasing or other redirection directly to a
41225 file.
41226 </para>
41227 <para>
41228 <indexterm role="option">
41229 <primary><option>batch_max</option></primary>
41230 </indexterm>
41231 </para>
41232 <informaltable frame="all">
41233 <tgroup cols="4" colsep="0" rowsep="0">
41234 <colspec colwidth="8*" align="left"/>
41235 <colspec colwidth="6*" align="center"/>
41236 <colspec colwidth="6*" align="center"/>
41237 <colspec colwidth="6*" align="right"/>
41238 <tbody>
41239 <row>
41240 <entry><option>batch_max</option></entry>
41241 <entry>Use: <emphasis>appendfile</emphasis></entry>
41242 <entry>Type: <emphasis>integer</emphasis></entry>
41243 <entry>Default: <emphasis>1</emphasis></entry>
41244 </row>
41245 </tbody>
41246 </tgroup>
41247 </informaltable>
41248 <para>
41249 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
41250 </para>
41251 <para>
41252 <indexterm role="option">
41253 <primary><option>check_group</option></primary>
41254 </indexterm>
41255 </para>
41256 <informaltable frame="all">
41257 <tgroup cols="4" colsep="0" rowsep="0">
41258 <colspec colwidth="8*" align="left"/>
41259 <colspec colwidth="6*" align="center"/>
41260 <colspec colwidth="6*" align="center"/>
41261 <colspec colwidth="6*" align="right"/>
41262 <tbody>
41263 <row>
41264 <entry><option>check_group</option></entry>
41265 <entry>Use: <emphasis>appendfile</emphasis></entry>
41266 <entry>Type: <emphasis>boolean</emphasis></entry>
41267 <entry>Default: <emphasis>false</emphasis></entry>
41268 </row>
41269 </tbody>
41270 </tgroup>
41271 </informaltable>
41272 <para>
41273 When this option is set, the group owner of the file defined by the <option>file</option>
41274 option is checked to see that it is the same as the group under which the
41275 delivery process is running. The default setting is false because the default
41276 file mode is 0600, which means that the group is irrelevant.
41277 </para>
41278 <para>
41279 <indexterm role="option">
41280 <primary><option>check_owner</option></primary>
41281 </indexterm>
41282 </para>
41283 <informaltable frame="all">
41284 <tgroup cols="4" colsep="0" rowsep="0">
41285 <colspec colwidth="8*" align="left"/>
41286 <colspec colwidth="6*" align="center"/>
41287 <colspec colwidth="6*" align="center"/>
41288 <colspec colwidth="6*" align="right"/>
41289 <tbody>
41290 <row>
41291 <entry><option>check_owner</option></entry>
41292 <entry>Use: <emphasis>appendfile</emphasis></entry>
41293 <entry>Type: <emphasis>boolean</emphasis></entry>
41294 <entry>Default: <emphasis>true</emphasis></entry>
41295 </row>
41296 </tbody>
41297 </tgroup>
41298 </informaltable>
41299 <para>
41300 When this option is set, the owner of the file defined by the <option>file</option> option
41301 is checked to ensure that it is the same as the user under which the delivery
41302 process is running.
41303 </para>
41304 <para>
41305 <indexterm role="option">
41306 <primary><option>check_string</option></primary>
41307 </indexterm>
41308 </para>
41309 <informaltable frame="all">
41310 <tgroup cols="4" colsep="0" rowsep="0">
41311 <colspec colwidth="8*" align="left"/>
41312 <colspec colwidth="6*" align="center"/>
41313 <colspec colwidth="6*" align="center"/>
41314 <colspec colwidth="6*" align="right"/>
41315 <tbody>
41316 <row>
41317 <entry><option>check_string</option></entry>
41318 <entry>Use: <emphasis>appendfile</emphasis></entry>
41319 <entry>Type: <emphasis>string</emphasis></entry>
41320 <entry>Default: <emphasis>see below</emphasis></entry>
41321 </row>
41322 </tbody>
41323 </tgroup>
41324 </informaltable>
41325 <para>
41326 <indexterm role="concept">
41327 <primary><quote>From</quote> line</primary>
41328 </indexterm>
41329 As <command>appendfile</command> writes the message, the start of each line is tested for
41330 matching <option>check_string</option>, and if it does, the initial matching characters are
41331 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
41332 a literal string, not a regular expression, and the case of any letters it
41333 contains is significant.
41334 </para>
41335 <para>
41336 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
41337 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
41338 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
41339 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
41340 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
41341 </para>
41342 <para>
41343 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
41344 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
41345 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
41346 if another format is used. For example, to deliver to mailboxes in MMDF format:
41347 <indexterm role="concept">
41348 <primary>MMDF format mailbox</primary>
41349 </indexterm>
41350 <indexterm role="concept">
41351 <primary>mailbox</primary>
41352 <secondary>MMDF format</secondary>
41353 </indexterm>
41354 </para>
41355 <literallayout class="monospaced">
41356 check_string = "\1\1\1\1\n"
41357 escape_string = "\1\1\1\1 \n"
41358 message_prefix = "\1\1\1\1\n"
41359 message_suffix = "\1\1\1\1\n"
41360 </literallayout>
41361 <para>
41362 <indexterm role="option">
41363 <primary><option>create_directory</option></primary>
41364 </indexterm>
41365 </para>
41366 <informaltable frame="all">
41367 <tgroup cols="4" colsep="0" rowsep="0">
41368 <colspec colwidth="8*" align="left"/>
41369 <colspec colwidth="6*" align="center"/>
41370 <colspec colwidth="6*" align="center"/>
41371 <colspec colwidth="6*" align="right"/>
41372 <tbody>
41373 <row>
41374 <entry><option>create_directory</option></entry>
41375 <entry>Use: <emphasis>appendfile</emphasis></entry>
41376 <entry>Type: <emphasis>boolean</emphasis></entry>
41377 <entry>Default: <emphasis>true</emphasis></entry>
41378 </row>
41379 </tbody>
41380 </tgroup>
41381 </informaltable>
41382 <para>
41383 <indexterm role="concept">
41384 <primary>directory creation</primary>
41385 </indexterm>
41386 When this option is true, Exim attempts to create any missing superior
41387 directories for the file that it is about to write. A created directory&#x2019;s mode
41388 is given by the <option>directory_mode</option> option.
41389 </para>
41390 <para>
41391 The group ownership of a newly created directory is highly dependent on the
41392 operating system (and possibly the file system) that is being used. For
41393 example, in Solaris, if the parent directory has the setgid bit set, its group
41394 is propagated to the child; if not, the currently set group is used. However,
41395 in FreeBSD, the parent&#x2019;s group is always used.
41396 </para>
41397 <para>
41398 <indexterm role="option">
41399 <primary><option>create_file</option></primary>
41400 </indexterm>
41401 </para>
41402 <informaltable frame="all">
41403 <tgroup cols="4" colsep="0" rowsep="0">
41404 <colspec colwidth="8*" align="left"/>
41405 <colspec colwidth="6*" align="center"/>
41406 <colspec colwidth="6*" align="center"/>
41407 <colspec colwidth="6*" align="right"/>
41408 <tbody>
41409 <row>
41410 <entry><option>create_file</option></entry>
41411 <entry>Use: <emphasis>appendfile</emphasis></entry>
41412 <entry>Type: <emphasis>string</emphasis></entry>
41413 <entry>Default: <emphasis>anywhere</emphasis></entry>
41414 </row>
41415 </tbody>
41416 </tgroup>
41417 </informaltable>
41418 <para>
41419 This option constrains the location of files and directories that are created
41420 by this transport. It applies to files defined by the <option>file</option> option and
41421 directories defined by the <option>directory</option> option. In the case of maildir
41422 delivery, it applies to the top level directory, not the maildir directories
41423 beneath.
41424 </para>
41425 <para>
41426 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
41427 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
41428 set for the transport. This option is not useful when an explicit file name is
41429 given for normal mailbox deliveries. It is intended for the case when file
41430 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
41431 by an <command>appendfile</command> transport called <option>address_file</option>. See also
41432 <option>file_must_exist</option>.
41433 </para>
41434 <para>
41435 <indexterm role="option">
41436 <primary><option>directory</option></primary>
41437 </indexterm>
41438 </para>
41439 <informaltable frame="all">
41440 <tgroup cols="4" colsep="0" rowsep="0">
41441 <colspec colwidth="8*" align="left"/>
41442 <colspec colwidth="6*" align="center"/>
41443 <colspec colwidth="6*" align="center"/>
41444 <colspec colwidth="6*" align="right"/>
41445 <tbody>
41446 <row>
41447 <entry><option>directory</option></entry>
41448 <entry>Use: <emphasis>appendfile</emphasis></entry>
41449 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41450 <entry>Default: <emphasis>unset</emphasis></entry>
41451 </row>
41452 </tbody>
41453 </tgroup>
41454 </informaltable>
41455 <para>
41456 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
41457 or <option>directory</option> must be set, unless the delivery is the direct result of a
41458 redirection (see section <xref linkend="SECTfildiropt"/>).
41459 </para>
41460 <para>
41461 When <option>directory</option> is set, the string is expanded, and the message is delivered
41462 into a new file or files in or below the given directory, instead of being
41463 appended to a single mailbox file. A number of different formats are provided
41464 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
41465 <xref linkend="SECTopdir"/> for further details of this form of delivery.
41466 </para>
41467 <para>
41468 <indexterm role="option">
41469 <primary><option>directory_file</option></primary>
41470 </indexterm>
41471 </para>
41472 <informaltable frame="all">
41473 <tgroup cols="4" colsep="0" rowsep="0">
41474 <colspec colwidth="8*" align="left"/>
41475 <colspec colwidth="6*" align="center"/>
41476 <colspec colwidth="6*" align="center"/>
41477 <colspec colwidth="6*" align="right"/>
41478 <tbody>
41479 <row>
41480 <entry><option>directory_file</option></entry>
41481 <entry>Use: <emphasis>appendfile</emphasis></entry>
41482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41483 <entry>Default: <emphasis>see below</emphasis></entry>
41484 </row>
41485 </tbody>
41486 </tgroup>
41487 </informaltable>
41488 <para>
41489 <indexterm role="concept">
41490 <primary>base62</primary>
41491 </indexterm>
41492 <indexterm role="variable">
41493 <primary><varname>$inode</varname></primary>
41494 </indexterm>
41495 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
41496 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
41497 whose name is obtained by expanding this string. The default value is:
41498 </para>
41499 <literallayout class="monospaced">
41500 q${base62:$tod_epoch}-$inode
41501 </literallayout>
41502 <para>
41503 This generates a unique name from the current time, in base 62 form, and the
41504 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
41505 option.
41506 </para>
41507 <para>
41508 <indexterm role="option">
41509 <primary><option>directory_mode</option></primary>
41510 </indexterm>
41511 </para>
41512 <informaltable frame="all">
41513 <tgroup cols="4" colsep="0" rowsep="0">
41514 <colspec colwidth="8*" align="left"/>
41515 <colspec colwidth="6*" align="center"/>
41516 <colspec colwidth="6*" align="center"/>
41517 <colspec colwidth="6*" align="right"/>
41518 <tbody>
41519 <row>
41520 <entry><option>directory_mode</option></entry>
41521 <entry>Use: <emphasis>appendfile</emphasis></entry>
41522 <entry>Type: <emphasis>octal integer</emphasis></entry>
41523 <entry>Default: <emphasis>0700</emphasis></entry>
41524 </row>
41525 </tbody>
41526 </tgroup>
41527 </informaltable>
41528 <para>
41529 If <command>appendfile</command> creates any directories as a result of the
41530 <option>create_directory</option> option, their mode is specified by this option.
41531 </para>
41532 <para>
41533 <indexterm role="option">
41534 <primary><option>escape_string</option></primary>
41535 </indexterm>
41536 </para>
41537 <informaltable frame="all">
41538 <tgroup cols="4" colsep="0" rowsep="0">
41539 <colspec colwidth="8*" align="left"/>
41540 <colspec colwidth="6*" align="center"/>
41541 <colspec colwidth="6*" align="center"/>
41542 <colspec colwidth="6*" align="right"/>
41543 <tbody>
41544 <row>
41545 <entry><option>escape_string</option></entry>
41546 <entry>Use: <emphasis>appendfile</emphasis></entry>
41547 <entry>Type: <emphasis>string</emphasis></entry>
41548 <entry>Default: <emphasis>see description</emphasis></entry>
41549 </row>
41550 </tbody>
41551 </tgroup>
41552 </informaltable>
41553 <para>
41554 See <option>check_string</option> above.
41555 </para>
41556 <para>
41557 <indexterm role="option">
41558 <primary><option>file</option></primary>
41559 </indexterm>
41560 </para>
41561 <informaltable frame="all">
41562 <tgroup cols="4" colsep="0" rowsep="0">
41563 <colspec colwidth="8*" align="left"/>
41564 <colspec colwidth="6*" align="center"/>
41565 <colspec colwidth="6*" align="center"/>
41566 <colspec colwidth="6*" align="right"/>
41567 <tbody>
41568 <row>
41569 <entry><option>file</option></entry>
41570 <entry>Use: <emphasis>appendfile</emphasis></entry>
41571 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41572 <entry>Default: <emphasis>unset</emphasis></entry>
41573 </row>
41574 </tbody>
41575 </tgroup>
41576 </informaltable>
41577 <para>
41578 This option is mutually exclusive with the <option>directory</option> option, but one of
41579 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
41580 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
41581 specifies a single file, to which the message is appended. One or more of
41582 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
41583 <option>file</option>.
41584 </para>
41585 <para>
41586 <indexterm role="concept">
41587 <primary>NFS</primary>
41588 <secondary>lock file</secondary>
41589 </indexterm>
41590 <indexterm role="concept">
41591 <primary>locking files</primary>
41592 </indexterm>
41593 <indexterm role="concept">
41594 <primary>lock files</primary>
41595 </indexterm>
41596 If you are using more than one host to deliver over NFS into the same
41597 mailboxes, you should always use lock files.
41598 </para>
41599 <para>
41600 The string value is expanded for each delivery, and must yield an absolute
41601 path. The most common settings of this option are variations on one of these
41602 examples:
41603 </para>
41604 <literallayout class="monospaced">
41605 file = /var/spool/mail/$local_part
41606 file = /home/$local_part/inbox
41607 file = $home/inbox
41608 </literallayout>
41609 <para>
41610 <indexterm role="concept">
41611 <primary><quote>sticky</quote> bit</primary>
41612 </indexterm>
41613 In the first example, all deliveries are done into the same directory. If Exim
41614 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
41615 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
41616 deliveries to be possible, or alternatively the <option>group</option> option can be used to
41617 run the delivery under a group id which has write access to the directory.
41618 </para>
41619 <para>
41620 <indexterm role="option">
41621 <primary><option>file_format</option></primary>
41622 </indexterm>
41623 </para>
41624 <informaltable frame="all">
41625 <tgroup cols="4" colsep="0" rowsep="0">
41626 <colspec colwidth="8*" align="left"/>
41627 <colspec colwidth="6*" align="center"/>
41628 <colspec colwidth="6*" align="center"/>
41629 <colspec colwidth="6*" align="right"/>
41630 <tbody>
41631 <row>
41632 <entry><option>file_format</option></entry>
41633 <entry>Use: <emphasis>appendfile</emphasis></entry>
41634 <entry>Type: <emphasis>string</emphasis></entry>
41635 <entry>Default: <emphasis>unset</emphasis></entry>
41636 </row>
41637 </tbody>
41638 </tgroup>
41639 </informaltable>
41640 <para>
41641 <indexterm role="concept">
41642 <primary>file</primary>
41643 <secondary>mailbox; checking existing format</secondary>
41644 </indexterm>
41645 This option requests the transport to check the format of an existing file
41646 before adding to it. The check consists of matching a specific string at the
41647 start of the file. The value of the option consists of an even number of
41648 colon-separated strings. The first of each pair is the test string, and the
41649 second is the name of a transport. If the transport associated with a matched
41650 string is not the current transport, control is passed over to the other
41651 transport. For example, suppose the standard <command>local_delivery</command> transport has
41652 this added to it:
41653 </para>
41654 <literallayout class="monospaced">
41655 file_format = "From       : local_delivery :\
41656                \1\1\1\1\n : local_mmdf_delivery"
41657 </literallayout>
41658 <para>
41659 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
41660 a mailbox begins with four binary ones followed by a newline, control is passed
41661 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
41662 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
41663 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
41664 match any string, or if the transport named for a given string is not defined,
41665 delivery is deferred.
41666 </para>
41667 <para>
41668 <indexterm role="option">
41669 <primary><option>file_must_exist</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>file_must_exist</option></entry>
41681 <entry>Use: <emphasis>appendfile</emphasis></entry>
41682 <entry>Type: <emphasis>boolean</emphasis></entry>
41683 <entry>Default: <emphasis>false</emphasis></entry>
41684 </row>
41685 </tbody>
41686 </tgroup>
41687 </informaltable>
41688 <para>
41689 If this option is true, the file specified by the <option>file</option> option must exist.
41690 A temporary error occurs if it does not, causing delivery to be deferred.
41691 If this option is false, the file is created if it does not exist.
41692 </para>
41693 <para>
41694 <indexterm role="option">
41695 <primary><option>lock_fcntl_timeout</option></primary>
41696 </indexterm>
41697 </para>
41698 <informaltable frame="all">
41699 <tgroup cols="4" colsep="0" rowsep="0">
41700 <colspec colwidth="8*" align="left"/>
41701 <colspec colwidth="6*" align="center"/>
41702 <colspec colwidth="6*" align="center"/>
41703 <colspec colwidth="6*" align="right"/>
41704 <tbody>
41705 <row>
41706 <entry><option>lock_fcntl_timeout</option></entry>
41707 <entry>Use: <emphasis>appendfile</emphasis></entry>
41708 <entry>Type: <emphasis>time</emphasis></entry>
41709 <entry>Default: <emphasis>0s</emphasis></entry>
41710 </row>
41711 </tbody>
41712 </tgroup>
41713 </informaltable>
41714 <para>
41715 <indexterm role="concept">
41716 <primary>timeout</primary>
41717 <secondary>mailbox locking</secondary>
41718 </indexterm>
41719 <indexterm role="concept">
41720 <primary>mailbox</primary>
41721 <secondary>locking, blocking and non-blocking</secondary>
41722 </indexterm>
41723 <indexterm role="concept">
41724 <primary>locking files</primary>
41725 </indexterm>
41726 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
41727 when locking an open mailbox file. If the call fails, the delivery process
41728 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
41729 Non-blocking calls are used so that the file is not kept open during the wait
41730 for the lock; the reason for this is to make it as safe as possible for
41731 deliveries over NFS in the case when processes might be accessing an NFS
41732 mailbox without using a lock file. This should not be done, but
41733 misunderstandings and hence misconfigurations are not unknown.
41734 </para>
41735 <para>
41736 On a busy system, however, the performance of a non-blocking lock approach is
41737 not as good as using a blocking lock with a timeout. In this case, the waiting
41738 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
41739 and can proceed as soon as the previous lock holder releases it.
41740 </para>
41741 <para>
41742 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
41743 timeout, are used. There may still be some retrying: the maximum number of
41744 retries is
41745 </para>
41746 <literallayout class="monospaced">
41747 (lock_retries * lock_interval) / lock_fcntl_timeout
41748 </literallayout>
41749 <para>
41750 rounded up to the next whole number. In other words, the total time during
41751 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
41752 <option>lock_fcntl_timeout</option> is set very large.
41753 </para>
41754 <para>
41755 You should consider setting this option if you are getting a lot of delayed
41756 local deliveries because of errors of the form
41757 </para>
41758 <literallayout class="monospaced">
41759 failed to lock mailbox /some/file (fcntl)
41760 </literallayout>
41761 <para>
41762 <indexterm role="option">
41763 <primary><option>lock_flock_timeout</option></primary>
41764 </indexterm>
41765 </para>
41766 <informaltable frame="all">
41767 <tgroup cols="4" colsep="0" rowsep="0">
41768 <colspec colwidth="8*" align="left"/>
41769 <colspec colwidth="6*" align="center"/>
41770 <colspec colwidth="6*" align="center"/>
41771 <colspec colwidth="6*" align="right"/>
41772 <tbody>
41773 <row>
41774 <entry><option>lock_flock_timeout</option></entry>
41775 <entry>Use: <emphasis>appendfile</emphasis></entry>
41776 <entry>Type: <emphasis>time</emphasis></entry>
41777 <entry>Default: <emphasis>0s</emphasis></entry>
41778 </row>
41779 </tbody>
41780 </tgroup>
41781 </informaltable>
41782 <para>
41783 This timeout applies to file locking when using <function>flock()</function> (see
41784 <option>use_flock</option>); the timeout operates in a similar manner to
41785 <option>lock_fcntl_timeout</option>.
41786 </para>
41787 <para>
41788 <indexterm role="option">
41789 <primary><option>lock_interval</option></primary>
41790 </indexterm>
41791 </para>
41792 <informaltable frame="all">
41793 <tgroup cols="4" colsep="0" rowsep="0">
41794 <colspec colwidth="8*" align="left"/>
41795 <colspec colwidth="6*" align="center"/>
41796 <colspec colwidth="6*" align="center"/>
41797 <colspec colwidth="6*" align="right"/>
41798 <tbody>
41799 <row>
41800 <entry><option>lock_interval</option></entry>
41801 <entry>Use: <emphasis>appendfile</emphasis></entry>
41802 <entry>Type: <emphasis>time</emphasis></entry>
41803 <entry>Default: <emphasis>3s</emphasis></entry>
41804 </row>
41805 </tbody>
41806 </tgroup>
41807 </informaltable>
41808 <para>
41809 This specifies the time to wait between attempts to lock the file. See below
41810 for details of locking.
41811 </para>
41812 <para>
41813 <indexterm role="option">
41814 <primary><option>lock_retries</option></primary>
41815 </indexterm>
41816 </para>
41817 <informaltable frame="all">
41818 <tgroup cols="4" colsep="0" rowsep="0">
41819 <colspec colwidth="8*" align="left"/>
41820 <colspec colwidth="6*" align="center"/>
41821 <colspec colwidth="6*" align="center"/>
41822 <colspec colwidth="6*" align="right"/>
41823 <tbody>
41824 <row>
41825 <entry><option>lock_retries</option></entry>
41826 <entry>Use: <emphasis>appendfile</emphasis></entry>
41827 <entry>Type: <emphasis>integer</emphasis></entry>
41828 <entry>Default: <emphasis>10</emphasis></entry>
41829 </row>
41830 </tbody>
41831 </tgroup>
41832 </informaltable>
41833 <para>
41834 This specifies the maximum number of attempts to lock the file. A value of zero
41835 is treated as 1. See below for details of locking.
41836 </para>
41837 <para>
41838 <indexterm role="option">
41839 <primary><option>lockfile_mode</option></primary>
41840 </indexterm>
41841 </para>
41842 <informaltable frame="all">
41843 <tgroup cols="4" colsep="0" rowsep="0">
41844 <colspec colwidth="8*" align="left"/>
41845 <colspec colwidth="6*" align="center"/>
41846 <colspec colwidth="6*" align="center"/>
41847 <colspec colwidth="6*" align="right"/>
41848 <tbody>
41849 <row>
41850 <entry><option>lockfile_mode</option></entry>
41851 <entry>Use: <emphasis>appendfile</emphasis></entry>
41852 <entry>Type: <emphasis>octal integer</emphasis></entry>
41853 <entry>Default: <emphasis>0600</emphasis></entry>
41854 </row>
41855 </tbody>
41856 </tgroup>
41857 </informaltable>
41858 <para>
41859 This specifies the mode of the created lock file, when a lock file is being
41860 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
41861 </para>
41862 <para>
41863 <indexterm role="option">
41864 <primary><option>lockfile_timeout</option></primary>
41865 </indexterm>
41866 </para>
41867 <informaltable frame="all">
41868 <tgroup cols="4" colsep="0" rowsep="0">
41869 <colspec colwidth="8*" align="left"/>
41870 <colspec colwidth="6*" align="center"/>
41871 <colspec colwidth="6*" align="center"/>
41872 <colspec colwidth="6*" align="right"/>
41873 <tbody>
41874 <row>
41875 <entry><option>lockfile_timeout</option></entry>
41876 <entry>Use: <emphasis>appendfile</emphasis></entry>
41877 <entry>Type: <emphasis>time</emphasis></entry>
41878 <entry>Default: <emphasis>30m</emphasis></entry>
41879 </row>
41880 </tbody>
41881 </tgroup>
41882 </informaltable>
41883 <para>
41884 <indexterm role="concept">
41885 <primary>timeout</primary>
41886 <secondary>mailbox locking</secondary>
41887 </indexterm>
41888 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
41889 exists and is older than this value, it is assumed to have been left behind by
41890 accident, and Exim attempts to remove it.
41891 </para>
41892 <para>
41893 <indexterm role="option">
41894 <primary><option>mailbox_filecount</option></primary>
41895 </indexterm>
41896 </para>
41897 <informaltable frame="all">
41898 <tgroup cols="4" colsep="0" rowsep="0">
41899 <colspec colwidth="8*" align="left"/>
41900 <colspec colwidth="6*" align="center"/>
41901 <colspec colwidth="6*" align="center"/>
41902 <colspec colwidth="6*" align="right"/>
41903 <tbody>
41904 <row>
41905 <entry><option>mailbox_filecount</option></entry>
41906 <entry>Use: <emphasis>appendfile</emphasis></entry>
41907 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41908 <entry>Default: <emphasis>unset</emphasis></entry>
41909 </row>
41910 </tbody>
41911 </tgroup>
41912 </informaltable>
41913 <para>
41914 <indexterm role="concept">
41915 <primary>mailbox</primary>
41916 <secondary>specifying size of</secondary>
41917 </indexterm>
41918 <indexterm role="concept">
41919 <primary>size</primary>
41920 <secondary>of mailbox</secondary>
41921 </indexterm>
41922 If this option is set, it is expanded, and the result is taken as the current
41923 number of files in the mailbox. It must be a decimal number, optionally
41924 followed by K or M. This provides a way of obtaining this information from an
41925 external source that maintains the data.
41926 </para>
41927 <para>
41928 <indexterm role="option">
41929 <primary><option>mailbox_size</option></primary>
41930 </indexterm>
41931 </para>
41932 <informaltable frame="all">
41933 <tgroup cols="4" colsep="0" rowsep="0">
41934 <colspec colwidth="8*" align="left"/>
41935 <colspec colwidth="6*" align="center"/>
41936 <colspec colwidth="6*" align="center"/>
41937 <colspec colwidth="6*" align="right"/>
41938 <tbody>
41939 <row>
41940 <entry><option>mailbox_size</option></entry>
41941 <entry>Use: <emphasis>appendfile</emphasis></entry>
41942 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41943 <entry>Default: <emphasis>unset</emphasis></entry>
41944 </row>
41945 </tbody>
41946 </tgroup>
41947 </informaltable>
41948 <para>
41949 <indexterm role="concept">
41950 <primary>mailbox</primary>
41951 <secondary>specifying size of</secondary>
41952 </indexterm>
41953 <indexterm role="concept">
41954 <primary>size</primary>
41955 <secondary>of mailbox</secondary>
41956 </indexterm>
41957 If this option is set, it is expanded, and the result is taken as the current
41958 size the mailbox. It must be a decimal number, optionally followed by K or M.
41959 This provides a way of obtaining this information from an external source that
41960 maintains the data. This is likely to be helpful for maildir deliveries where
41961 it is computationally expensive to compute the size of a mailbox.
41962 </para>
41963 <para>
41964 <indexterm role="option">
41965 <primary><option>maildir_format</option></primary>
41966 </indexterm>
41967 </para>
41968 <informaltable frame="all">
41969 <tgroup cols="4" colsep="0" rowsep="0">
41970 <colspec colwidth="8*" align="left"/>
41971 <colspec colwidth="6*" align="center"/>
41972 <colspec colwidth="6*" align="center"/>
41973 <colspec colwidth="6*" align="right"/>
41974 <tbody>
41975 <row>
41976 <entry><option>maildir_format</option></entry>
41977 <entry>Use: <emphasis>appendfile</emphasis></entry>
41978 <entry>Type: <emphasis>boolean</emphasis></entry>
41979 <entry>Default: <emphasis>false</emphasis></entry>
41980 </row>
41981 </tbody>
41982 </tgroup>
41983 </informaltable>
41984 <para>
41985 <indexterm role="concept">
41986 <primary>maildir format</primary>
41987 <secondary>specifying</secondary>
41988 </indexterm>
41989 If this option is set with the <option>directory</option> option, the delivery is into a new
41990 file, in the <quote>maildir</quote> format that is used by other mail software. When the
41991 transport is activated directly from a <command>redirect</command> router (for example, the
41992 <command>address_file</command> transport in the default configuration), setting
41993 <option>maildir_format</option> causes the path received from the router to be treated as a
41994 directory, whether or not it ends with <literal>/</literal>. This option is available only if
41995 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
41996 <xref linkend="SECTmaildirdelivery"/> below for further details.
41997 </para>
41998 <para>
41999 <indexterm role="option">
42000 <primary><option>maildir_quota_directory_regex</option></primary>
42001 </indexterm>
42002 </para>
42003 <informaltable frame="all">
42004 <tgroup cols="4" colsep="0" rowsep="0">
42005 <colspec colwidth="8*" align="left"/>
42006 <colspec colwidth="6*" align="center"/>
42007 <colspec colwidth="6*" align="center"/>
42008 <colspec colwidth="6*" align="right"/>
42009 <tbody>
42010 <row>
42011 <entry><option>maildir_quota_directory_regex</option></entry>
42012 <entry>Use: <emphasis>appendfile</emphasis></entry>
42013 <entry>Type: <emphasis>string</emphasis></entry>
42014 <entry>Default: <emphasis>See below</emphasis></entry>
42015 </row>
42016 </tbody>
42017 </tgroup>
42018 </informaltable>
42019 <para>
42020 <indexterm role="concept">
42021 <primary>maildir format</primary>
42022 <secondary>quota; directories included in</secondary>
42023 </indexterm>
42024 <indexterm role="concept">
42025 <primary>quota</primary>
42026 <secondary>maildir; directories included in</secondary>
42027 </indexterm>
42028 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
42029 a regular expression for specifying directories, relative to the quota
42030 directory (see <option>quota_directory</option>), that should be included in the quota
42031 calculation. The default value is:
42032 </para>
42033 <literallayout class="monospaced">
42034 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
42035 </literallayout>
42036 <para>
42037 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
42038 (directories whose names begin with a dot). If you want to exclude the
42039 <filename>Trash</filename>
42040 folder from the count (as some sites do), you need to change this setting to
42041 </para>
42042 <literallayout class="monospaced">
42043 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
42044 </literallayout>
42045 <para>
42046 This uses a negative lookahead in the regular expression to exclude the
42047 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
42048 calculations, quota processing is bypassed for any messages that are delivered
42049 directly into that directory.
42050 </para>
42051 <para>
42052 <indexterm role="option">
42053 <primary><option>maildir_retries</option></primary>
42054 </indexterm>
42055 </para>
42056 <informaltable frame="all">
42057 <tgroup cols="4" colsep="0" rowsep="0">
42058 <colspec colwidth="8*" align="left"/>
42059 <colspec colwidth="6*" align="center"/>
42060 <colspec colwidth="6*" align="center"/>
42061 <colspec colwidth="6*" align="right"/>
42062 <tbody>
42063 <row>
42064 <entry><option>maildir_retries</option></entry>
42065 <entry>Use: <emphasis>appendfile</emphasis></entry>
42066 <entry>Type: <emphasis>integer</emphasis></entry>
42067 <entry>Default: <emphasis>10</emphasis></entry>
42068 </row>
42069 </tbody>
42070 </tgroup>
42071 </informaltable>
42072 <para>
42073 This option specifies the number of times to retry when writing a file in
42074 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
42075 </para>
42076 <para>
42077 <indexterm role="option">
42078 <primary><option>maildir_tag</option></primary>
42079 </indexterm>
42080 </para>
42081 <informaltable frame="all">
42082 <tgroup cols="4" colsep="0" rowsep="0">
42083 <colspec colwidth="8*" align="left"/>
42084 <colspec colwidth="6*" align="center"/>
42085 <colspec colwidth="6*" align="center"/>
42086 <colspec colwidth="6*" align="right"/>
42087 <tbody>
42088 <row>
42089 <entry><option>maildir_tag</option></entry>
42090 <entry>Use: <emphasis>appendfile</emphasis></entry>
42091 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42092 <entry>Default: <emphasis>unset</emphasis></entry>
42093 </row>
42094 </tbody>
42095 </tgroup>
42096 </informaltable>
42097 <para>
42098 This option applies only to deliveries in maildir format, and is described in
42099 section <xref linkend="SECTmaildirdelivery"/> below.
42100 </para>
42101 <para>
42102 <indexterm role="option">
42103 <primary><option>maildir_use_size_file</option></primary>
42104 </indexterm>
42105 </para>
42106 <informaltable frame="all">
42107 <tgroup cols="4" colsep="0" rowsep="0">
42108 <colspec colwidth="8*" align="left"/>
42109 <colspec colwidth="6*" align="center"/>
42110 <colspec colwidth="6*" align="center"/>
42111 <colspec colwidth="6*" align="right"/>
42112 <tbody>
42113 <row>
42114 <entry><option>maildir_use_size_file</option></entry>
42115 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
42116 <entry>Type: <emphasis>boolean</emphasis></entry>
42117 <entry>Default: <emphasis>false</emphasis></entry>
42118 </row>
42119 </tbody>
42120 </tgroup>
42121 </informaltable>
42122 <para>
42123 <indexterm role="concept">
42124 <primary>maildir format</primary>
42125 <secondary><filename>maildirsize</filename> file</secondary>
42126 </indexterm>
42127 The result of string expansion for this option must be a valid boolean value.
42128 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
42129 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
42130 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
42131 value is zero. See <option>maildir_quota_directory_regex</option> above and section
42132 <xref linkend="SECTmaildirdelivery"/> below for further details.
42133 </para>
42134 <para>
42135 <indexterm role="option">
42136 <primary><option>maildirfolder_create_regex</option></primary>
42137 </indexterm>
42138 </para>
42139 <informaltable frame="all">
42140 <tgroup cols="4" colsep="0" rowsep="0">
42141 <colspec colwidth="8*" align="left"/>
42142 <colspec colwidth="6*" align="center"/>
42143 <colspec colwidth="6*" align="center"/>
42144 <colspec colwidth="6*" align="right"/>
42145 <tbody>
42146 <row>
42147 <entry><option>maildirfolder_create_regex</option></entry>
42148 <entry>Use: <emphasis>appendfile</emphasis></entry>
42149 <entry>Type: <emphasis>string</emphasis></entry>
42150 <entry>Default: <emphasis>unset</emphasis></entry>
42151 </row>
42152 </tbody>
42153 </tgroup>
42154 </informaltable>
42155 <para>
42156 <indexterm role="concept">
42157 <primary>maildir format</primary>
42158 <secondary><filename>maildirfolder</filename> file</secondary>
42159 </indexterm>
42160 <indexterm role="concept">
42161 <primary><filename>maildirfolder</filename>, creating</primary>
42162 </indexterm>
42163 The value of this option is a regular expression. If it is unset, it has no
42164 effect. Otherwise, before a maildir delivery takes place, the pattern is
42165 matched against the name of the maildir directory, that is, the directory
42166 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
42167 delivery. If there is a match, Exim checks for the existence of a file called
42168 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
42169 See section <xref linkend="SECTmaildirdelivery"/> for more details.
42170 </para>
42171 <para>
42172 <indexterm role="option">
42173 <primary><option>mailstore_format</option></primary>
42174 </indexterm>
42175 </para>
42176 <informaltable frame="all">
42177 <tgroup cols="4" colsep="0" rowsep="0">
42178 <colspec colwidth="8*" align="left"/>
42179 <colspec colwidth="6*" align="center"/>
42180 <colspec colwidth="6*" align="center"/>
42181 <colspec colwidth="6*" align="right"/>
42182 <tbody>
42183 <row>
42184 <entry><option>mailstore_format</option></entry>
42185 <entry>Use: <emphasis>appendfile</emphasis></entry>
42186 <entry>Type: <emphasis>boolean</emphasis></entry>
42187 <entry>Default: <emphasis>false</emphasis></entry>
42188 </row>
42189 </tbody>
42190 </tgroup>
42191 </informaltable>
42192 <para>
42193 <indexterm role="concept">
42194 <primary>mailstore format</primary>
42195 <secondary>specifying</secondary>
42196 </indexterm>
42197 If this option is set with the <option>directory</option> option, the delivery is into two
42198 new files in  <quote>mailstore</quote> format. The option is available only if
42199 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
42200 below for further details.
42201 </para>
42202 <para>
42203 <indexterm role="option">
42204 <primary><option>mailstore_prefix</option></primary>
42205 </indexterm>
42206 </para>
42207 <informaltable frame="all">
42208 <tgroup cols="4" colsep="0" rowsep="0">
42209 <colspec colwidth="8*" align="left"/>
42210 <colspec colwidth="6*" align="center"/>
42211 <colspec colwidth="6*" align="center"/>
42212 <colspec colwidth="6*" align="right"/>
42213 <tbody>
42214 <row>
42215 <entry><option>mailstore_prefix</option></entry>
42216 <entry>Use: <emphasis>appendfile</emphasis></entry>
42217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42218 <entry>Default: <emphasis>unset</emphasis></entry>
42219 </row>
42220 </tbody>
42221 </tgroup>
42222 </informaltable>
42223 <para>
42224 This option applies only to deliveries in mailstore format, and is described in
42225 section <xref linkend="SECTopdir"/> below.
42226 </para>
42227 <para>
42228 <indexterm role="option">
42229 <primary><option>mailstore_suffix</option></primary>
42230 </indexterm>
42231 </para>
42232 <informaltable frame="all">
42233 <tgroup cols="4" colsep="0" rowsep="0">
42234 <colspec colwidth="8*" align="left"/>
42235 <colspec colwidth="6*" align="center"/>
42236 <colspec colwidth="6*" align="center"/>
42237 <colspec colwidth="6*" align="right"/>
42238 <tbody>
42239 <row>
42240 <entry><option>mailstore_suffix</option></entry>
42241 <entry>Use: <emphasis>appendfile</emphasis></entry>
42242 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42243 <entry>Default: <emphasis>unset</emphasis></entry>
42244 </row>
42245 </tbody>
42246 </tgroup>
42247 </informaltable>
42248 <para>
42249 This option applies only to deliveries in mailstore format, and is described in
42250 section <xref linkend="SECTopdir"/> below.
42251 </para>
42252 <para>
42253 <indexterm role="option">
42254 <primary><option>mbx_format</option></primary>
42255 </indexterm>
42256 </para>
42257 <informaltable frame="all">
42258 <tgroup cols="4" colsep="0" rowsep="0">
42259 <colspec colwidth="8*" align="left"/>
42260 <colspec colwidth="6*" align="center"/>
42261 <colspec colwidth="6*" align="center"/>
42262 <colspec colwidth="6*" align="right"/>
42263 <tbody>
42264 <row>
42265 <entry><option>mbx_format</option></entry>
42266 <entry>Use: <emphasis>appendfile</emphasis></entry>
42267 <entry>Type: <emphasis>boolean</emphasis></entry>
42268 <entry>Default: <emphasis>false</emphasis></entry>
42269 </row>
42270 </tbody>
42271 </tgroup>
42272 </informaltable>
42273 <para>
42274 <indexterm role="concept">
42275 <primary>locking files</primary>
42276 </indexterm>
42277 <indexterm role="concept">
42278 <primary>file</primary>
42279 <secondary>locking</secondary>
42280 </indexterm>
42281 <indexterm role="concept">
42282 <primary>file</primary>
42283 <secondary>MBX format</secondary>
42284 </indexterm>
42285 <indexterm role="concept">
42286 <primary>MBX format, specifying</primary>
42287 </indexterm>
42288 This option is available only if Exim has been compiled with SUPPORT_MBX
42289 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
42290 the message is appended to the mailbox file in MBX format instead of
42291 traditional Unix format. This format is supported by Pine4 and its associated
42292 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
42293 </para>
42294 <para>
42295 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
42296 automatically changed by the use of <option>mbx_format</option>. They should normally be set
42297 empty when using MBX format, so this option almost always appears in this
42298 combination:
42299 </para>
42300 <literallayout class="monospaced">
42301 mbx_format = true
42302 message_prefix =
42303 message_suffix =
42304 </literallayout>
42305 <para>
42306 If none of the locking options are mentioned in the configuration,
42307 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
42308 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
42309 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
42310 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
42311 should not be used if any program that does not use this form of locking is
42312 going to access the mailbox, nor should it be used if the mailbox file is NFS
42313 mounted, because it works only when the mailbox is accessed from a single host.
42314 </para>
42315 <para>
42316 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
42317 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
42318 (this means for the whole of a Pine or IMAP session), Exim will not be able to
42319 append messages to it.
42320 </para>
42321 <para>
42322 <indexterm role="option">
42323 <primary><option>message_prefix</option></primary>
42324 </indexterm>
42325 </para>
42326 <informaltable frame="all">
42327 <tgroup cols="4" colsep="0" rowsep="0">
42328 <colspec colwidth="8*" align="left"/>
42329 <colspec colwidth="6*" align="center"/>
42330 <colspec colwidth="6*" align="center"/>
42331 <colspec colwidth="6*" align="right"/>
42332 <tbody>
42333 <row>
42334 <entry><option>message_prefix</option></entry>
42335 <entry>Use: <emphasis>appendfile</emphasis></entry>
42336 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42337 <entry>Default: <emphasis>see below</emphasis></entry>
42338 </row>
42339 </tbody>
42340 </tgroup>
42341 </informaltable>
42342 <para>
42343 <indexterm role="concept">
42344 <primary><quote>From</quote> line</primary>
42345 </indexterm>
42346 The string specified here is expanded and output at the start of every message.
42347 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
42348 in which case it is:
42349 </para>
42350 <literallayout class="monospaced">
42351 message_prefix = "From ${if def:return_path{$return_path}\
42352   {MAILER-DAEMON}} $tod_bsdinbox\n"
42353 </literallayout>
42354 <para>
42355 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42356 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
42357 </para>
42358 <para>
42359 <indexterm role="option">
42360 <primary><option>message_suffix</option></primary>
42361 </indexterm>
42362 </para>
42363 <informaltable frame="all">
42364 <tgroup cols="4" colsep="0" rowsep="0">
42365 <colspec colwidth="8*" align="left"/>
42366 <colspec colwidth="6*" align="center"/>
42367 <colspec colwidth="6*" align="center"/>
42368 <colspec colwidth="6*" align="right"/>
42369 <tbody>
42370 <row>
42371 <entry><option>message_suffix</option></entry>
42372 <entry>Use: <emphasis>appendfile</emphasis></entry>
42373 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42374 <entry>Default: <emphasis>see below</emphasis></entry>
42375 </row>
42376 </tbody>
42377 </tgroup>
42378 </informaltable>
42379 <para>
42380 The string specified here is expanded and output at the end of every message.
42381 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
42382 in which case it is a single newline character. The suffix can be suppressed by
42383 setting
42384 </para>
42385 <literallayout class="monospaced">
42386 message_suffix =
42387 </literallayout>
42388 <para>
42389 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
42390 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
42391 </para>
42392 <para>
42393 <indexterm role="option">
42394 <primary><option>mode</option></primary>
42395 </indexterm>
42396 </para>
42397 <informaltable frame="all">
42398 <tgroup cols="4" colsep="0" rowsep="0">
42399 <colspec colwidth="8*" align="left"/>
42400 <colspec colwidth="6*" align="center"/>
42401 <colspec colwidth="6*" align="center"/>
42402 <colspec colwidth="6*" align="right"/>
42403 <tbody>
42404 <row>
42405 <entry><option>mode</option></entry>
42406 <entry>Use: <emphasis>appendfile</emphasis></entry>
42407 <entry>Type: <emphasis>octal integer</emphasis></entry>
42408 <entry>Default: <emphasis>0600</emphasis></entry>
42409 </row>
42410 </tbody>
42411 </tgroup>
42412 </informaltable>
42413 <para>
42414 If the output file is created, it is given this mode. If it already exists and
42415 has wider permissions, they are reduced to this mode. If it has narrower
42416 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
42417 if the delivery is the result of a <option>save</option> command in a filter file specifying
42418 a particular mode, the mode of the output file is always forced to take that
42419 value, and this option is ignored.
42420 </para>
42421 <para>
42422 <indexterm role="option">
42423 <primary><option>mode_fail_narrower</option></primary>
42424 </indexterm>
42425 </para>
42426 <informaltable frame="all">
42427 <tgroup cols="4" colsep="0" rowsep="0">
42428 <colspec colwidth="8*" align="left"/>
42429 <colspec colwidth="6*" align="center"/>
42430 <colspec colwidth="6*" align="center"/>
42431 <colspec colwidth="6*" align="right"/>
42432 <tbody>
42433 <row>
42434 <entry><option>mode_fail_narrower</option></entry>
42435 <entry>Use: <emphasis>appendfile</emphasis></entry>
42436 <entry>Type: <emphasis>boolean</emphasis></entry>
42437 <entry>Default: <emphasis>true</emphasis></entry>
42438 </row>
42439 </tbody>
42440 </tgroup>
42441 </informaltable>
42442 <para>
42443 This option applies in the case when an existing mailbox file has a narrower
42444 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
42445 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
42446 continues with the delivery attempt, using the existing mode of the file.
42447 </para>
42448 <para>
42449 <indexterm role="option">
42450 <primary><option>notify_comsat</option></primary>
42451 </indexterm>
42452 </para>
42453 <informaltable frame="all">
42454 <tgroup cols="4" colsep="0" rowsep="0">
42455 <colspec colwidth="8*" align="left"/>
42456 <colspec colwidth="6*" align="center"/>
42457 <colspec colwidth="6*" align="center"/>
42458 <colspec colwidth="6*" align="right"/>
42459 <tbody>
42460 <row>
42461 <entry><option>notify_comsat</option></entry>
42462 <entry>Use: <emphasis>appendfile</emphasis></entry>
42463 <entry>Type: <emphasis>boolean</emphasis></entry>
42464 <entry>Default: <emphasis>false</emphasis></entry>
42465 </row>
42466 </tbody>
42467 </tgroup>
42468 </informaltable>
42469 <para>
42470 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
42471 successful delivery to a user mailbox. This is the daemon that notifies logged
42472 on users about incoming mail.
42473 </para>
42474 <para>
42475 <indexterm role="option">
42476 <primary><option>quota</option></primary>
42477 </indexterm>
42478 </para>
42479 <informaltable frame="all">
42480 <tgroup cols="4" colsep="0" rowsep="0">
42481 <colspec colwidth="8*" align="left"/>
42482 <colspec colwidth="6*" align="center"/>
42483 <colspec colwidth="6*" align="center"/>
42484 <colspec colwidth="6*" align="right"/>
42485 <tbody>
42486 <row>
42487 <entry><option>quota</option></entry>
42488 <entry>Use: <emphasis>appendfile</emphasis></entry>
42489 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42490 <entry>Default: <emphasis>unset</emphasis></entry>
42491 </row>
42492 </tbody>
42493 </tgroup>
42494 </informaltable>
42495 <para>
42496 <indexterm role="concept">
42497 <primary>quota</primary>
42498 <secondary>imposed by Exim</secondary>
42499 </indexterm>
42500 This option imposes a limit on the size of the file to which Exim is appending,
42501 or to the total space used in the directory tree when the <option>directory</option> option
42502 is set. In the latter case, computation of the space used is expensive, because
42503 all the files in the directory (and any sub-directories) have to be
42504 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
42505 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
42506 have no shell access to their mailboxes).
42507 </para>
42508 <para>
42509 As there is no interlock against two simultaneous deliveries into a
42510 multi-file mailbox, it is possible for the quota to be overrun in this case.
42511 For single-file mailboxes, of course, an interlock is a necessity.
42512 </para>
42513 <para>
42514 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
42515 may be a lot less than the actual amount of disk space allocated to the file.
42516 If the sizes of a number of files are being added up, the rounding effect can
42517 become quite noticeable, especially on systems that have large block sizes.
42518 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
42519 the obvious value which users understand most easily.
42520 </para>
42521 <para>
42522 The value of the option is expanded, and must then be a numerical value
42523 (decimal point allowed), optionally followed by one of the letters K, M, or G,
42524 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
42525 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
42526 be handled.
42527 </para>
42528 <para>
42529 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
42530 </para>
42531 <para>
42532 The expansion happens while Exim is running as root, before it changes uid for
42533 the delivery. This means that files that are inaccessible to the end user can
42534 be used to hold quota values that are looked up in the expansion. When delivery
42535 fails because this quota is exceeded, the handling of the error is as for
42536 system quota failures.
42537 </para>
42538 <para>
42539 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
42540 mailbox to the specified maximum size, though the value is not accurate to the
42541 last byte, owing to separator lines and additional headers that may get added
42542 during message delivery. When a mailbox is nearly full, large messages may get
42543 refused even though small ones are accepted, because the size of the current
42544 message is added to the quota when the check is made. This behaviour can be
42545 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
42546 for exceeding the quota does not include the current message. Thus, deliveries
42547 continue until the quota has been exceeded; thereafter, no further messages are
42548 delivered. See also <option>quota_warn_threshold</option>.
42549 </para>
42550 <para>
42551 <indexterm role="option">
42552 <primary><option>quota_directory</option></primary>
42553 </indexterm>
42554 </para>
42555 <informaltable frame="all">
42556 <tgroup cols="4" colsep="0" rowsep="0">
42557 <colspec colwidth="8*" align="left"/>
42558 <colspec colwidth="6*" align="center"/>
42559 <colspec colwidth="6*" align="center"/>
42560 <colspec colwidth="6*" align="right"/>
42561 <tbody>
42562 <row>
42563 <entry><option>quota_directory</option></entry>
42564 <entry>Use: <emphasis>appendfile</emphasis></entry>
42565 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42566 <entry>Default: <emphasis>unset</emphasis></entry>
42567 </row>
42568 </tbody>
42569 </tgroup>
42570 </informaltable>
42571 <para>
42572 This option defines the directory to check for quota purposes when delivering
42573 into individual files. The default is the delivery directory, or, if a file
42574 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
42575 delivery directory.
42576 </para>
42577 <para>
42578 <indexterm role="option">
42579 <primary><option>quota_filecount</option></primary>
42580 </indexterm>
42581 </para>
42582 <informaltable frame="all">
42583 <tgroup cols="4" colsep="0" rowsep="0">
42584 <colspec colwidth="8*" align="left"/>
42585 <colspec colwidth="6*" align="center"/>
42586 <colspec colwidth="6*" align="center"/>
42587 <colspec colwidth="6*" align="right"/>
42588 <tbody>
42589 <row>
42590 <entry><option>quota_filecount</option></entry>
42591 <entry>Use: <emphasis>appendfile</emphasis></entry>
42592 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42593 <entry>Default: <emphasis>0</emphasis></entry>
42594 </row>
42595 </tbody>
42596 </tgroup>
42597 </informaltable>
42598 <para>
42599 This option applies when the <option>directory</option> option is set. It limits the total
42600 number of files in the directory (compare the inode limit in system quotas). It
42601 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
42602 failure causes delivery to be deferred. A value of zero is interpreted as
42603 <quote>no quota</quote>.
42604 </para>
42605 <para>
42606 <indexterm role="option">
42607 <primary><option>quota_is_inclusive</option></primary>
42608 </indexterm>
42609 </para>
42610 <informaltable frame="all">
42611 <tgroup cols="4" colsep="0" rowsep="0">
42612 <colspec colwidth="8*" align="left"/>
42613 <colspec colwidth="6*" align="center"/>
42614 <colspec colwidth="6*" align="center"/>
42615 <colspec colwidth="6*" align="right"/>
42616 <tbody>
42617 <row>
42618 <entry><option>quota_is_inclusive</option></entry>
42619 <entry>Use: <emphasis>appendfile</emphasis></entry>
42620 <entry>Type: <emphasis>boolean</emphasis></entry>
42621 <entry>Default: <emphasis>true</emphasis></entry>
42622 </row>
42623 </tbody>
42624 </tgroup>
42625 </informaltable>
42626 <para>
42627 See <option>quota</option> above.
42628 </para>
42629 <para>
42630 <indexterm role="option">
42631 <primary><option>quota_size_regex</option></primary>
42632 </indexterm>
42633 </para>
42634 <informaltable frame="all">
42635 <tgroup cols="4" colsep="0" rowsep="0">
42636 <colspec colwidth="8*" align="left"/>
42637 <colspec colwidth="6*" align="center"/>
42638 <colspec colwidth="6*" align="center"/>
42639 <colspec colwidth="6*" align="right"/>
42640 <tbody>
42641 <row>
42642 <entry><option>quota_size_regex</option></entry>
42643 <entry>Use: <emphasis>appendfile</emphasis></entry>
42644 <entry>Type: <emphasis>string</emphasis></entry>
42645 <entry>Default: <emphasis>unset</emphasis></entry>
42646 </row>
42647 </tbody>
42648 </tgroup>
42649 </informaltable>
42650 <para>
42651 This option applies when one of the delivery modes that writes a separate file
42652 for each message is being used. When Exim wants to find the size of one of
42653 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
42654 If this is set to a regular expression that matches the file name, and it
42655 captures one string, that string is interpreted as a representation of the
42656 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
42657 </para>
42658 <para>
42659 This feature is useful only when users have no shell access to their mailboxes
42660 &ndash; otherwise they could defeat the quota simply by renaming the files. This
42661 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
42662 the file length to the file name. For example:
42663 </para>
42664 <literallayout class="monospaced">
42665 maildir_tag = ,S=$message_size
42666 quota_size_regex = ,S=(\d+)
42667 </literallayout>
42668 <para>
42669 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
42670 number of lines in the message.
42671 </para>
42672 <para>
42673 The regular expression should not assume that the length is at the end of the
42674 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
42675 sometimes add other information onto the ends of message file names.
42676 </para>
42677 <para>
42678 Section <xref linkend="SECID136"/> contains further information.
42679 </para>
42680 <para>
42681 <indexterm role="option">
42682 <primary><option>quota_warn_message</option></primary>
42683 </indexterm>
42684 </para>
42685 <informaltable frame="all">
42686 <tgroup cols="4" colsep="0" rowsep="0">
42687 <colspec colwidth="8*" align="left"/>
42688 <colspec colwidth="6*" align="center"/>
42689 <colspec colwidth="6*" align="center"/>
42690 <colspec colwidth="6*" align="right"/>
42691 <tbody>
42692 <row>
42693 <entry><option>quota_warn_message</option></entry>
42694 <entry>Use: <emphasis>appendfile</emphasis></entry>
42695 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42696 <entry>Default: <emphasis>see below</emphasis></entry>
42697 </row>
42698 </tbody>
42699 </tgroup>
42700 </informaltable>
42701 <para>
42702 See below for the use of this option. If it is not set when
42703 <option>quota_warn_threshold</option> is set, it defaults to
42704 </para>
42705 <literallayout class="monospaced">
42706 quota_warn_message = "\
42707   To: $local_part@$domain\n\
42708   Subject: Your mailbox\n\n\
42709   This message is automatically created \
42710   by mail delivery software.\n\n\
42711   The size of your mailbox has exceeded \
42712   a warning threshold that is\n\
42713   set by the system administrator.\n"
42714 </literallayout>
42715 <para>
42716 <indexterm role="option">
42717 <primary><option>quota_warn_threshold</option></primary>
42718 </indexterm>
42719 </para>
42720 <informaltable frame="all">
42721 <tgroup cols="4" colsep="0" rowsep="0">
42722 <colspec colwidth="8*" align="left"/>
42723 <colspec colwidth="6*" align="center"/>
42724 <colspec colwidth="6*" align="center"/>
42725 <colspec colwidth="6*" align="right"/>
42726 <tbody>
42727 <row>
42728 <entry><option>quota_warn_threshold</option></entry>
42729 <entry>Use: <emphasis>appendfile</emphasis></entry>
42730 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42731 <entry>Default: <emphasis>0</emphasis></entry>
42732 </row>
42733 </tbody>
42734 </tgroup>
42735 </informaltable>
42736 <para>
42737 <indexterm role="concept">
42738 <primary>quota</primary>
42739 <secondary>warning threshold</secondary>
42740 </indexterm>
42741 <indexterm role="concept">
42742 <primary>mailbox</primary>
42743 <secondary>size warning</secondary>
42744 </indexterm>
42745 <indexterm role="concept">
42746 <primary>size</primary>
42747 <secondary>of mailbox</secondary>
42748 </indexterm>
42749 This option is expanded in the same way as <option>quota</option> (see above). If the
42750 resulting value is greater than zero, and delivery of the message causes the
42751 size of the file or total space in the directory tree to cross the given
42752 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
42753 may be specified as a percentage of it by following the value with a percent
42754 sign. For example:
42755 </para>
42756 <literallayout class="monospaced">
42757 quota = 10M
42758 quota_warn_threshold = 75%
42759 </literallayout>
42760 <para>
42761 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
42762 percent sign is ignored.
42763 </para>
42764 <para>
42765 The warning message itself is specified by the <option>quota_warn_message</option> option,
42766 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
42767 warning message. These do not necessarily have to include the recipient(s) of
42768 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
42769 can include any other header lines that you want. If you do not include a
42770 <emphasis>From:</emphasis> line, the default is:
42771 </para>
42772 <literallayout class="monospaced">
42773 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
42774 </literallayout>
42775 <para>
42776 <indexterm role="option">
42777 <primary><option>errors_reply_to</option></primary>
42778 </indexterm>
42779 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
42780 option.
42781 </para>
42782 <para>
42783 The <option>quota</option> option does not have to be set in order to use this option; they
42784 are independent of one another except when the threshold is specified as a
42785 percentage.
42786 </para>
42787 <para>
42788 <indexterm role="option">
42789 <primary><option>use_bsmtp</option></primary>
42790 </indexterm>
42791 </para>
42792 <informaltable frame="all">
42793 <tgroup cols="4" colsep="0" rowsep="0">
42794 <colspec colwidth="8*" align="left"/>
42795 <colspec colwidth="6*" align="center"/>
42796 <colspec colwidth="6*" align="center"/>
42797 <colspec colwidth="6*" align="right"/>
42798 <tbody>
42799 <row>
42800 <entry><option>use_bsmtp</option></entry>
42801 <entry>Use: <emphasis>appendfile</emphasis></entry>
42802 <entry>Type: <emphasis>boolean</emphasis></entry>
42803 <entry>Default: <emphasis>false</emphasis></entry>
42804 </row>
42805 </tbody>
42806 </tgroup>
42807 </informaltable>
42808 <para>
42809 <indexterm role="concept">
42810 <primary>envelope sender</primary>
42811 </indexterm>
42812 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
42813 format, with the envelope sender and recipient(s) included as SMTP commands. If
42814 you want to include a leading HELO command with such messages, you can do
42815 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
42816 for details of batch SMTP.
42817 </para>
42818 <para>
42819 <indexterm role="option">
42820 <primary><option>use_crlf</option></primary>
42821 </indexterm>
42822 </para>
42823 <informaltable frame="all">
42824 <tgroup cols="4" colsep="0" rowsep="0">
42825 <colspec colwidth="8*" align="left"/>
42826 <colspec colwidth="6*" align="center"/>
42827 <colspec colwidth="6*" align="center"/>
42828 <colspec colwidth="6*" align="right"/>
42829 <tbody>
42830 <row>
42831 <entry><option>use_crlf</option></entry>
42832 <entry>Use: <emphasis>appendfile</emphasis></entry>
42833 <entry>Type: <emphasis>boolean</emphasis></entry>
42834 <entry>Default: <emphasis>false</emphasis></entry>
42835 </row>
42836 </tbody>
42837 </tgroup>
42838 </informaltable>
42839 <para>
42840 <indexterm role="concept">
42841 <primary>carriage return</primary>
42842 </indexterm>
42843 <indexterm role="concept">
42844 <primary>linefeed</primary>
42845 </indexterm>
42846 This option causes lines to be terminated with the two-character CRLF sequence
42847 (carriage return, linefeed) instead of just a linefeed character. In the case
42848 of batched SMTP, the byte sequence written to the file is then an exact image
42849 of what would be sent down a real SMTP connection.
42850 </para>
42851 <para>
42852 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
42853 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
42854 in Berkeley-style mailboxes) are written verbatim, so must contain their own
42855 carriage return characters if these are needed. In cases where these options
42856 have non-empty defaults, the values end with a single linefeed, so they must be
42857 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
42858 </para>
42859 <para>
42860 <indexterm role="option">
42861 <primary><option>use_fcntl_lock</option></primary>
42862 </indexterm>
42863 </para>
42864 <informaltable frame="all">
42865 <tgroup cols="4" colsep="0" rowsep="0">
42866 <colspec colwidth="8*" align="left"/>
42867 <colspec colwidth="6*" align="center"/>
42868 <colspec colwidth="6*" align="center"/>
42869 <colspec colwidth="6*" align="right"/>
42870 <tbody>
42871 <row>
42872 <entry><option>use_fcntl_lock</option></entry>
42873 <entry>Use: <emphasis>appendfile</emphasis></entry>
42874 <entry>Type: <emphasis>boolean</emphasis></entry>
42875 <entry>Default: <emphasis>see below</emphasis></entry>
42876 </row>
42877 </tbody>
42878 </tgroup>
42879 </informaltable>
42880 <para>
42881 This option controls the use of the <function>fcntl()</function> function to lock a file for
42882 exclusive use when a message is being appended. It is set by default unless
42883 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
42884 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
42885 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
42886 </para>
42887 <para>
42888 <indexterm role="option">
42889 <primary><option>use_flock_lock</option></primary>
42890 </indexterm>
42891 </para>
42892 <informaltable frame="all">
42893 <tgroup cols="4" colsep="0" rowsep="0">
42894 <colspec colwidth="8*" align="left"/>
42895 <colspec colwidth="6*" align="center"/>
42896 <colspec colwidth="6*" align="center"/>
42897 <colspec colwidth="6*" align="right"/>
42898 <tbody>
42899 <row>
42900 <entry><option>use_flock_lock</option></entry>
42901 <entry>Use: <emphasis>appendfile</emphasis></entry>
42902 <entry>Type: <emphasis>boolean</emphasis></entry>
42903 <entry>Default: <emphasis>false</emphasis></entry>
42904 </row>
42905 </tbody>
42906 </tgroup>
42907 </informaltable>
42908 <para>
42909 This option is provided to support the use of <function>flock()</function> for file locking, for
42910 the few situations where it is needed. Most modern operating systems support
42911 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
42912 each other. Exim uses <function>fcntl()</function> locking by default.
42913 </para>
42914 <para>
42915 This option is required only if you are using an operating system where
42916 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
42917 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
42918 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
42919 </para>
42920 <para>
42921 <indexterm role="concept">
42922 <primary>Solaris</primary>
42923 <secondary><function>flock()</function> support</secondary>
42924 </indexterm>
42925 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
42926 have it (and some, I think, provide a not quite right version built on top of
42927 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
42928 the ability to use it, and any attempt to do so will cause a configuration
42929 error.
42930 </para>
42931 <para>
42932 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
42933 is just being mapped onto <function>fcntl()</function> by the OS).
42934 </para>
42935 <para>
42936 <indexterm role="option">
42937 <primary><option>use_lockfile</option></primary>
42938 </indexterm>
42939 </para>
42940 <informaltable frame="all">
42941 <tgroup cols="4" colsep="0" rowsep="0">
42942 <colspec colwidth="8*" align="left"/>
42943 <colspec colwidth="6*" align="center"/>
42944 <colspec colwidth="6*" align="center"/>
42945 <colspec colwidth="6*" align="right"/>
42946 <tbody>
42947 <row>
42948 <entry><option>use_lockfile</option></entry>
42949 <entry>Use: <emphasis>appendfile</emphasis></entry>
42950 <entry>Type: <emphasis>boolean</emphasis></entry>
42951 <entry>Default: <emphasis>see below</emphasis></entry>
42952 </row>
42953 </tbody>
42954 </tgroup>
42955 </informaltable>
42956 <para>
42957 If this option is turned off, Exim does not attempt to create a lock file when
42958 appending to a mailbox file. In this situation, the only locking is by
42959 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
42960 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
42961 <function>fcntl()</function> rather than a lock file, and even then only when you are not
42962 delivering over NFS from more than one host.
42963 </para>
42964 <para>
42965 <indexterm role="concept">
42966 <primary>NFS</primary>
42967 <secondary>lock file</secondary>
42968 </indexterm>
42969 In order to append to an NFS file safely from more than one host, it is
42970 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
42971 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
42972 file corruption.
42973 </para>
42974 <para>
42975 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
42976 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
42977 except when <option>mbx_format</option> is set.
42978 </para>
42979 <para>
42980 <indexterm role="option">
42981 <primary><option>use_mbx_lock</option></primary>
42982 </indexterm>
42983 </para>
42984 <informaltable frame="all">
42985 <tgroup cols="4" colsep="0" rowsep="0">
42986 <colspec colwidth="8*" align="left"/>
42987 <colspec colwidth="6*" align="center"/>
42988 <colspec colwidth="6*" align="center"/>
42989 <colspec colwidth="6*" align="right"/>
42990 <tbody>
42991 <row>
42992 <entry><option>use_mbx_lock</option></entry>
42993 <entry>Use: <emphasis>appendfile</emphasis></entry>
42994 <entry>Type: <emphasis>boolean</emphasis></entry>
42995 <entry>Default: <emphasis>see below</emphasis></entry>
42996 </row>
42997 </tbody>
42998 </tgroup>
42999 </informaltable>
43000 <para>
43001 This option is available only if Exim has been compiled with SUPPORT_MBX
43002 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
43003 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
43004 of the locking options are mentioned in the configuration. The locking rules
43005 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
43006 the IMAP4 and POP daemons that come with it (see the discussion below). The
43007 rules allow for shared access to the mailbox. However, this kind of locking
43008 does not work when the mailbox is NFS mounted.
43009 </para>
43010 <para>
43011 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
43012 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
43013 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
43014 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
43015 </para>
43016 </section>
43017 <section id="SECTopappend">
43018 <title>Operational details for appending</title>
43019 <para>
43020 <indexterm role="concept">
43021 <primary>appending to a file</primary>
43022 </indexterm>
43023 <indexterm role="concept">
43024 <primary>file</primary>
43025 <secondary>appending</secondary>
43026 </indexterm>
43027 Before appending to a file, the following preparations are made:
43028 </para>
43029 <itemizedlist>
43030 <listitem>
43031 <para>
43032 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
43033 return is given.
43034 </para>
43035 </listitem>
43036 <listitem>
43037 <para>
43038 <indexterm role="concept">
43039 <primary>directory creation</primary>
43040 </indexterm>
43041 If any directories on the file&#x2019;s path are missing, Exim creates them if the
43042 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
43043 <option>directory_mode</option> option.
43044 </para>
43045 </listitem>
43046 <listitem>
43047 <para>
43048 If <option>file_format</option> is set, the format of an existing file is checked. If this
43049 indicates that a different transport should be used, control is passed to that
43050 transport.
43051 </para>
43052 </listitem>
43053 <listitem>
43054 <para>
43055 <indexterm role="concept">
43056 <primary>file</primary>
43057 <secondary>locking</secondary>
43058 </indexterm>
43059 <indexterm role="concept">
43060 <primary>locking files</primary>
43061 </indexterm>
43062 <indexterm role="concept">
43063 <primary>NFS</primary>
43064 <secondary>lock file</secondary>
43065 </indexterm>
43066 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
43067 reliably over NFS, as follows:
43068 </para>
43069 <orderedlist numeration="arabic">
43070 <listitem>
43071 <para>
43072 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
43073 current time, primary host name, and process id added, by opening for writing
43074 as a new file. If this fails with an access error, delivery is deferred.
43075 </para>
43076 </listitem>
43077 <listitem>
43078 <para>
43079 Close the hitching post file, and hard link it to the lock file name.
43080 </para>
43081 </listitem>
43082 <listitem>
43083 <para>
43084 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
43085 Unlink the hitching post name.
43086 </para>
43087 </listitem>
43088 <listitem>
43089 <para>
43090 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
43091 then unlink hitching post name. If the number of links is exactly two, creation
43092 of the lock file succeeded but something (for example, an NFS server crash and
43093 restart) caused this fact not to be communicated to the <function>link()</function> call.
43094 </para>
43095 </listitem>
43096 <listitem>
43097 <para>
43098 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
43099 up to <option>lock_retries</option> times. However, since any program that writes to a
43100 mailbox should complete its task very quickly, it is reasonable to time out old
43101 lock files that are normally the result of user agent and system crashes. If an
43102 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
43103 it before trying again.
43104 </para>
43105 </listitem>
43106 </orderedlist>
43107 </listitem>
43108 <listitem>
43109 <para>
43110 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
43111 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
43112 than non-existence, delivery is deferred.
43113 </para>
43114 </listitem>
43115 <listitem>
43116 <para>
43117 <indexterm role="concept">
43118 <primary>symbolic link</primary>
43119 <secondary>to mailbox</secondary>
43120 </indexterm>
43121 <indexterm role="concept">
43122 <primary>mailbox</primary>
43123 <secondary>symbolic link</secondary>
43124 </indexterm>
43125 If the file does exist and is a symbolic link, delivery is deferred, unless the
43126 <option>allow_symlink</option> option is set, in which case the ownership of the link is
43127 checked, and then <function>stat()</function> is called to find out about the real file, which
43128 is then subjected to the checks below. The check on the top-level link
43129 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
43130 directory, though allowing symbolic links in this case is definitely not a good
43131 idea. If there is a chain of symbolic links, the intermediate ones are not
43132 checked.
43133 </para>
43134 </listitem>
43135 <listitem>
43136 <para>
43137 If the file already exists but is not a regular file, or if the file&#x2019;s owner
43138 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
43139 different from the user and group under which the delivery is running,
43140 delivery is deferred.
43141 </para>
43142 </listitem>
43143 <listitem>
43144 <para>
43145 If the file&#x2019;s permissions are more generous than specified, they are reduced.
43146 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
43147 is set false, in which case the delivery is tried using the existing
43148 permissions.
43149 </para>
43150 </listitem>
43151 <listitem>
43152 <para>
43153 The file&#x2019;s inode number is saved, and the file is then opened for appending.
43154 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
43155 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
43156 </para>
43157 </listitem>
43158 <listitem>
43159 <para>
43160 If the file is opened successfully, check that the inode number hasn&#x2019;t
43161 changed, that it is still a regular file, and that the owner and permissions
43162 have not changed. If anything is wrong, defer delivery and freeze the message.
43163 </para>
43164 </listitem>
43165 <listitem>
43166 <para>
43167 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
43168 option is set. Otherwise, check that the file is being created in a permitted
43169 directory if the <option>create_file</option> option is set (deferring on failure), and then
43170 open for writing as a new file, with the O_EXCL and O_CREAT options,
43171 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
43172 set). In this case, which can happen if the link points to a non-existent file,
43173 the file is opened for writing using O_CREAT but not O_EXCL, because
43174 that prevents link following.
43175 </para>
43176 </listitem>
43177 <listitem>
43178 <para>
43179 <indexterm role="concept">
43180 <primary>loop</primary>
43181 <secondary>while file testing</secondary>
43182 </indexterm>
43183 If opening fails because the file exists, obey the tests given above for
43184 existing files. However, to avoid looping in a situation where the file is
43185 being continuously created and destroyed, the exists/not-exists loop is broken
43186 after 10 repetitions, and the message is then frozen.
43187 </para>
43188 </listitem>
43189 <listitem>
43190 <para>
43191 If opening fails with any other error, defer delivery.
43192 </para>
43193 </listitem>
43194 <listitem>
43195 <para>
43196 <indexterm role="concept">
43197 <primary>file</primary>
43198 <secondary>locking</secondary>
43199 </indexterm>
43200 <indexterm role="concept">
43201 <primary>locking files</primary>
43202 </indexterm>
43203 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
43204 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
43205 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
43206 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
43207 file, and an exclusive lock on the file whose name is
43208 </para>
43209 <literallayout class="monospaced">
43210 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
43211 </literallayout>
43212 <para>
43213 using the device and inode numbers of the open mailbox file, in accordance with
43214 the MBX locking rules. This file is created with a mode that is specified by
43215 the <option>lockfile_mode</option> option.
43216 </para>
43217 <para>
43218 If Exim fails to lock the file, there are two possible courses of action,
43219 depending on the value of the locking timeout. This is obtained from
43220 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
43221 </para>
43222 <para>
43223 If the timeout value is zero, the file is closed, Exim waits for
43224 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
43225 to lock it again. This happens up to <option>lock_retries</option> times, after which the
43226 delivery is deferred.
43227 </para>
43228 <para>
43229 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
43230 <function>flock()</function> are used (with the given timeout), so there has already been some
43231 waiting involved by the time locking fails. Nevertheless, Exim does not give up
43232 immediately. It retries up to
43233 </para>
43234 <literallayout class="monospaced">
43235 (lock_retries * lock_interval) / &lt;timeout&gt;
43236 </literallayout>
43237 <para>
43238 times (rounded up).
43239 </para>
43240 </listitem>
43241 </itemizedlist>
43242 <para>
43243 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
43244 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
43245 </para>
43246 </section>
43247 <section id="SECTopdir">
43248 <title>Operational details for delivery to a new file</title>
43249 <para>
43250 <indexterm role="concept">
43251 <primary>delivery</primary>
43252 <secondary>to single file</secondary>
43253 </indexterm>
43254 <indexterm role="concept">
43255 <primary><quote>From</quote> line</primary>
43256 </indexterm>
43257 When the <option>directory</option> option is set instead of <option>file</option>, each message is
43258 delivered into a newly-created file or set of files. When <command>appendfile</command> is
43259 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
43260 <option>directory</option> is normally set, because the path for delivery is supplied by the
43261 router. (See for example, the <command>address_file</command> transport in the default
43262 configuration.) In this case, delivery is to a new file if either the path name
43263 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
43264 </para>
43265 <para>
43266 No locking is required while writing the message to a new file, so the various
43267 locking options of the transport are ignored. The <quote>From</quote> line that by default
43268 separates messages in a single file is not normally needed, nor is the escaping
43269 of message lines that start with <quote>From</quote>, and there is no need to ensure a
43270 newline at the end of each message. Consequently, the default values for
43271 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
43272 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
43273 </para>
43274 <para>
43275 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
43276 the files in the delivery directory by default. However, you can specify a
43277 different directory by setting <option>quota_directory</option>. Also, for maildir
43278 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
43279 </para>
43280 <para>
43281 <indexterm role="concept">
43282 <primary>maildir format</primary>
43283 </indexterm>
43284 <indexterm role="concept">
43285 <primary>mailstore format</primary>
43286 </indexterm>
43287 There are three different ways in which delivery to individual files can be
43288 done, controlled by the settings of the <option>maildir_format</option> and
43289 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
43290 formats is not included in the binary unless SUPPORT_MAILDIR or
43291 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
43292 </para>
43293 <para>
43294 <indexterm role="concept">
43295 <primary>directory creation</primary>
43296 </indexterm>
43297 In all three cases an attempt is made to create the directory and any necessary
43298 sub-directories if they do not exist, provided that the <option>create_directory</option>
43299 option is set (the default). The location of a created directory can be
43300 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
43301 the <option>directory_mode</option> option. If creation fails, or if the
43302 <option>create_directory</option> option is not set when creation is required, delivery is
43303 deferred.
43304 </para>
43305 </section>
43306 <section id="SECTmaildirdelivery">
43307 <title>Maildir delivery</title>
43308 <para>
43309 <indexterm role="concept">
43310 <primary>maildir format</primary>
43311 <secondary>description of</secondary>
43312 </indexterm>
43313 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
43314 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
43315 directory that is defined by the <option>directory</option> option (the <quote>delivery
43316 directory</quote>). If the delivery is successful, the file is renamed into the
43317 <filename>new</filename> subdirectory.
43318 </para>
43319 <para>
43320 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
43321 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
43322 Exim checks that the time-of-day clock has moved on by at least one microsecond
43323 before terminating the delivery process. This guarantees uniqueness for the
43324 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
43325 opening it. If any response other than ENOENT (does not exist) is given,
43326 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
43327 </para>
43328 <para>
43329 Before Exim carries out a maildir delivery, it ensures that subdirectories
43330 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
43331 do not exist, Exim tries to create them and any superior directories in their
43332 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
43333 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
43334 contains matches the delivery directory, Exim also ensures that a file called
43335 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
43336 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
43337 </para>
43338 <para>
43339 These features make it possible to use Exim to create all the necessary files
43340 and directories in a maildir mailbox, including subdirectories for maildir++
43341 folders. Consider this example:
43342 </para>
43343 <literallayout class="monospaced">
43344 maildir_format = true
43345 directory = /var/mail/$local_part\
43346            ${if eq{$local_part_suffix}{}{}\
43347            {/.${substr_1:$local_part_suffix}}}
43348 maildirfolder_create_regex = /\.[^/]+$
43349 </literallayout>
43350 <para>
43351 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
43352 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
43353 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
43354 not match this name, so Exim will not look for or create the file
43355 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
43356 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
43357 </para>
43358 <para>
43359 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
43360 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
43361 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
43362 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
43363 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
43364 </para>
43365 <para>
43366 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
43367 not inadvertently match the toplevel maildir directory, because a
43368 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
43369 </para>
43370 <para>
43371 <indexterm role="concept">
43372 <primary>quota</primary>
43373 <secondary>in maildir delivery</secondary>
43374 </indexterm>
43375 <indexterm role="concept">
43376 <primary>maildir++</primary>
43377 </indexterm>
43378 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
43379 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
43380 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
43381 Exim assumes the directory is a maildir++ folder directory, which is one level
43382 down from the user&#x2019;s top level mailbox directory. This causes it to start at
43383 the parent directory instead of the current directory when calculating the
43384 amount of space used.
43385 </para>
43386 <para>
43387 One problem with delivering into a multi-file mailbox is that it is
43388 computationally expensive to compute the size of the mailbox for quota
43389 checking. Various approaches have been taken to reduce the amount of work
43390 needed. The next two sections describe two of them. A third alternative is to
43391 use some external process for maintaining the size data, and use the expansion
43392 of the <option>mailbox_size</option> option as a way of importing it into Exim.
43393 </para>
43394 </section>
43395 <section id="SECID135">
43396 <title>Using tags to record message sizes</title>
43397 <para>
43398 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
43399 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
43400 tag is added to its name. However, if adding the tag takes the length of the
43401 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
43402 the tag is dropped and the maildir file is created with no tag.
43403 </para>
43404 <para>
43405 <indexterm role="variable">
43406 <primary><varname>$message_size</varname></primary>
43407 </indexterm>
43408 Tags can be used to encode the size of files in their names; see
43409 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
43410 happens after the message has been written. The value of the <varname>$message_size</varname>
43411 variable is set to the number of bytes actually written. If the expansion is
43412 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
43413 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
43414 Non-printing characters in the string are ignored; if the resulting string is
43415 empty, it is ignored. If it starts with an alphanumeric character, a leading
43416 colon is inserted; this default has not proven to be the path that popular
43417 maildir implementations have chosen (but changing it in Exim would break
43418 backwards compatibility).
43419 </para>
43420 <para>
43421 For one common implementation, you might set:
43422 </para>
43423 <literallayout class="monospaced">
43424 maildir_tag = ,S=${message_size}
43425 </literallayout>
43426 <para>
43427 but you should check the documentation of the other software to be sure.
43428 </para>
43429 <para>
43430 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
43431 as this allows Exim to extract the size from your tag, instead of having to
43432 <function>stat()</function> each message file.
43433 </para>
43434 </section>
43435 <section id="SECID136">
43436 <title>Using a maildirsize file</title>
43437 <para>
43438 <indexterm role="concept">
43439 <primary>quota</primary>
43440 <secondary>in maildir delivery</secondary>
43441 </indexterm>
43442 <indexterm role="concept">
43443 <primary>maildir format</primary>
43444 <secondary><filename>maildirsize</filename> file</secondary>
43445 </indexterm>
43446 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
43447 storing quota and message size information in a file called <filename>maildirsize</filename>
43448 within the toplevel maildir directory. If this file does not exist, Exim
43449 creates it, setting the quota from the <option>quota</option> option of the transport. If
43450 the maildir directory itself does not exist, it is created before any attempt
43451 to write a <filename>maildirsize</filename> file.
43452 </para>
43453 <para>
43454 The <filename>maildirsize</filename> file is used to hold information about the sizes of
43455 messages in the maildir, thus speeding up quota calculations. The quota value
43456 in the file is just a cache; if the quota is changed in the transport, the new
43457 value overrides the cached value when the next message is delivered. The cache
43458 is maintained for the benefit of other programs that access the maildir and
43459 need to know the quota.
43460 </para>
43461 <para>
43462 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
43463 file is maintained (with a zero quota setting), but no quota is imposed.
43464 </para>
43465 <para>
43466 A regular expression is available for controlling which directories in the
43467 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
43468 See the description of the <option>maildir_quota_directory_regex</option> option above for
43469 details.
43470 </para>
43471 </section>
43472 <section id="SECID137">
43473 <title>Mailstore delivery</title>
43474 <para>
43475 <indexterm role="concept">
43476 <primary>mailstore format</primary>
43477 <secondary>description of</secondary>
43478 </indexterm>
43479 If the <option>mailstore_format</option> option is true, each message is written as two
43480 files in the given directory. A unique base name is constructed from the
43481 message id and the current delivery process, and the files that are written use
43482 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
43483 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
43484 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
43485 </para>
43486 <para>
43487 During delivery, the envelope is first written to a file with the suffix
43488 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
43489 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
43490 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
43491 file before accessing either of them. An alternative approach is to wait for
43492 the absence of a <filename>.tmp</filename> file.
43493 </para>
43494 <para>
43495 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
43496 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
43497 the sender address on one line, then all the recipient addresses, one per line.
43498 There can be more than one recipient only if the <option>batch_max</option> option is set
43499 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
43500 appended to the file, followed by a newline if it does not end with one.
43501 </para>
43502 <para>
43503 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
43504 failure, it is ignored. Other expansion errors are treated as serious
43505 configuration errors, and delivery is deferred. The variable
43506 <varname>$mailstore_basename</varname> is available for use during these expansions.
43507 </para>
43508 </section>
43509 <section id="SECID138">
43510 <title>Non-special new file delivery</title>
43511 <para>
43512 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
43513 file is created directly in the named directory. For example, when delivering
43514 messages into files in batched SMTP format for later delivery to some host (see
43515 section <xref linkend="SECTbatchSMTP"/>), a setting such as
43516 </para>
43517 <literallayout class="monospaced">
43518 directory = /var/bsmtp/$host
43519 </literallayout>
43520 <para>
43521 might be used. A message is written to a file with a temporary name, which is
43522 then renamed when the delivery is complete. The final name is obtained by
43523 expanding the contents of the <option>directory_file</option> option.
43524 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
43525 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
43526 </para>
43527 </section>
43528 </chapter>
43529
43530 <chapter id="CHID8">
43531 <title>The autoreply transport</title>
43532 <para>
43533 <indexterm role="concept" id="IIDauttra1" class="startofrange">
43534 <primary>transports</primary>
43535 <secondary><command>autoreply</command></secondary>
43536 </indexterm>
43537 <indexterm role="concept" id="IIDauttra2" class="startofrange">
43538 <primary><command>autoreply</command> transport</primary>
43539 </indexterm>
43540 The <command>autoreply</command> transport is not a true transport in that it does not cause
43541 the message to be transmitted. Instead, it generates a new mail message as an
43542 automatic reply to the incoming message. <emphasis>References:</emphasis> and
43543 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
43544 to the rules in RFCs 2822 and 3834, respectively.
43545 </para>
43546 <para>
43547 If the router that passes the message to this transport does not have the
43548 <option>unseen</option> option set, the original message (for the current recipient) is not
43549 delivered anywhere. However, when the <option>unseen</option> option is set on the router
43550 that passes the message to this transport, routing of the address continues, so
43551 another router can set up a normal message delivery.
43552 </para>
43553 <para>
43554 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
43555 <quote>vacation</quote> message being the standard example. However, it can also be run
43556 directly from a router like any other transport. To reduce the possibility of
43557 message cascades, messages created by the <command>autoreply</command> transport always have
43558 empty envelope sender addresses, like bounce messages.
43559 </para>
43560 <para>
43561 The parameters of the message to be sent can be specified in the configuration
43562 by options described below. However, these are used only when the address
43563 passed to the transport does not contain its own reply information. When the
43564 transport is run as a consequence of a
43565 <option>mail</option>
43566 or <option>vacation</option> command in a filter file, the parameters of the message are
43567 supplied by the filter, and passed with the address. The transport&#x2019;s options
43568 that define the message are then ignored (so they are not usually set in this
43569 case). The message is specified entirely by the filter or by the transport; it
43570 is never built from a mixture of options. However, the <option>file_optional</option>,
43571 <option>mode</option>, and <option>return_message</option> options apply in all cases.
43572 </para>
43573 <para>
43574 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
43575 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
43576 gid of the user, and with appropriate current and home directories (see chapter
43577 <xref linkend="CHAPenvironment"/>).
43578 </para>
43579 <para>
43580 There is a subtle difference between routing a message to a <command>pipe</command> transport
43581 that generates some text to be returned to the sender, and routing it to an
43582 <command>autoreply</command> transport. This difference is noticeable only if more than one
43583 address from the same message is so handled. In the case of a pipe, the
43584 separate outputs from the different addresses are gathered up and returned to
43585 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
43586 message is generated for each address that is passed to it.
43587 </para>
43588 <para>
43589 Non-printing characters are not permitted in the header lines generated for the
43590 message that <command>autoreply</command> creates, with the exception of newlines that are
43591 immediately followed by white space. If any non-printing characters are found,
43592 the transport defers.
43593 Whether characters with the top bit set count as printing characters or not is
43594 controlled by the <option>print_topbitchars</option> global option.
43595 </para>
43596 <para>
43597 If any of the generic options for manipulating headers (for example,
43598 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
43599 of the original message that is included in the generated message when
43600 <option>return_message</option> is set. They do not apply to the generated message itself.
43601 </para>
43602 <para>
43603 <indexterm role="variable">
43604 <primary><varname>$sender_address</varname></primary>
43605 </indexterm>
43606 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
43607 the message, indicating that there were no recipients, it does not treat this
43608 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
43609 is empty (because the incoming message is a bounce message) do not cause
43610 problems. They are just discarded.
43611 </para>
43612 <section id="SECID139">
43613 <title>Private options for autoreply</title>
43614 <para>
43615 <indexterm role="concept">
43616 <primary>options</primary>
43617 <secondary><command>autoreply</command> transport</secondary>
43618 </indexterm>
43619 </para>
43620 <para>
43621 <indexterm role="option">
43622 <primary><option>bcc</option></primary>
43623 </indexterm>
43624 </para>
43625 <informaltable frame="all">
43626 <tgroup cols="4" colsep="0" rowsep="0">
43627 <colspec colwidth="8*" align="left"/>
43628 <colspec colwidth="6*" align="center"/>
43629 <colspec colwidth="6*" align="center"/>
43630 <colspec colwidth="6*" align="right"/>
43631 <tbody>
43632 <row>
43633 <entry><option>bcc</option></entry>
43634 <entry>Use: <emphasis>autoreply</emphasis></entry>
43635 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43636 <entry>Default: <emphasis>unset</emphasis></entry>
43637 </row>
43638 </tbody>
43639 </tgroup>
43640 </informaltable>
43641 <para>
43642 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
43643 message when the message is specified by the transport.
43644 </para>
43645 <para>
43646 <indexterm role="option">
43647 <primary><option>cc</option></primary>
43648 </indexterm>
43649 </para>
43650 <informaltable frame="all">
43651 <tgroup cols="4" colsep="0" rowsep="0">
43652 <colspec colwidth="8*" align="left"/>
43653 <colspec colwidth="6*" align="center"/>
43654 <colspec colwidth="6*" align="center"/>
43655 <colspec colwidth="6*" align="right"/>
43656 <tbody>
43657 <row>
43658 <entry><option>cc</option></entry>
43659 <entry>Use: <emphasis>autoreply</emphasis></entry>
43660 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43661 <entry>Default: <emphasis>unset</emphasis></entry>
43662 </row>
43663 </tbody>
43664 </tgroup>
43665 </informaltable>
43666 <para>
43667 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
43668 when the message is specified by the transport.
43669 </para>
43670 <para>
43671 <indexterm role="option">
43672 <primary><option>file</option></primary>
43673 </indexterm>
43674 </para>
43675 <informaltable frame="all">
43676 <tgroup cols="4" colsep="0" rowsep="0">
43677 <colspec colwidth="8*" align="left"/>
43678 <colspec colwidth="6*" align="center"/>
43679 <colspec colwidth="6*" align="center"/>
43680 <colspec colwidth="6*" align="right"/>
43681 <tbody>
43682 <row>
43683 <entry><option>file</option></entry>
43684 <entry>Use: <emphasis>autoreply</emphasis></entry>
43685 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43686 <entry>Default: <emphasis>unset</emphasis></entry>
43687 </row>
43688 </tbody>
43689 </tgroup>
43690 </informaltable>
43691 <para>
43692 The contents of the file are sent as the body of the message when the message
43693 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
43694 string comes first.
43695 </para>
43696 <para>
43697 <indexterm role="option">
43698 <primary><option>file_expand</option></primary>
43699 </indexterm>
43700 </para>
43701 <informaltable frame="all">
43702 <tgroup cols="4" colsep="0" rowsep="0">
43703 <colspec colwidth="8*" align="left"/>
43704 <colspec colwidth="6*" align="center"/>
43705 <colspec colwidth="6*" align="center"/>
43706 <colspec colwidth="6*" align="right"/>
43707 <tbody>
43708 <row>
43709 <entry><option>file_expand</option></entry>
43710 <entry>Use: <emphasis>autoreply</emphasis></entry>
43711 <entry>Type: <emphasis>boolean</emphasis></entry>
43712 <entry>Default: <emphasis>false</emphasis></entry>
43713 </row>
43714 </tbody>
43715 </tgroup>
43716 </informaltable>
43717 <para>
43718 If this is set, the contents of the file named by the <option>file</option> option are
43719 subjected to string expansion as they are added to the message.
43720 </para>
43721 <para>
43722 <indexterm role="option">
43723 <primary><option>file_optional</option></primary>
43724 </indexterm>
43725 </para>
43726 <informaltable frame="all">
43727 <tgroup cols="4" colsep="0" rowsep="0">
43728 <colspec colwidth="8*" align="left"/>
43729 <colspec colwidth="6*" align="center"/>
43730 <colspec colwidth="6*" align="center"/>
43731 <colspec colwidth="6*" align="right"/>
43732 <tbody>
43733 <row>
43734 <entry><option>file_optional</option></entry>
43735 <entry>Use: <emphasis>autoreply</emphasis></entry>
43736 <entry>Type: <emphasis>boolean</emphasis></entry>
43737 <entry>Default: <emphasis>false</emphasis></entry>
43738 </row>
43739 </tbody>
43740 </tgroup>
43741 </informaltable>
43742 <para>
43743 If this option is true, no error is generated if the file named by the <option>file</option>
43744 option or passed with the address does not exist or cannot be read.
43745 </para>
43746 <para>
43747 <indexterm role="option">
43748 <primary><option>from</option></primary>
43749 </indexterm>
43750 </para>
43751 <informaltable frame="all">
43752 <tgroup cols="4" colsep="0" rowsep="0">
43753 <colspec colwidth="8*" align="left"/>
43754 <colspec colwidth="6*" align="center"/>
43755 <colspec colwidth="6*" align="center"/>
43756 <colspec colwidth="6*" align="right"/>
43757 <tbody>
43758 <row>
43759 <entry><option>from</option></entry>
43760 <entry>Use: <emphasis>autoreply</emphasis></entry>
43761 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43762 <entry>Default: <emphasis>unset</emphasis></entry>
43763 </row>
43764 </tbody>
43765 </tgroup>
43766 </informaltable>
43767 <para>
43768 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
43769 specified by the transport.
43770 </para>
43771 <para>
43772 <indexterm role="option">
43773 <primary><option>headers</option></primary>
43774 </indexterm>
43775 </para>
43776 <informaltable frame="all">
43777 <tgroup cols="4" colsep="0" rowsep="0">
43778 <colspec colwidth="8*" align="left"/>
43779 <colspec colwidth="6*" align="center"/>
43780 <colspec colwidth="6*" align="center"/>
43781 <colspec colwidth="6*" align="right"/>
43782 <tbody>
43783 <row>
43784 <entry><option>headers</option></entry>
43785 <entry>Use: <emphasis>autoreply</emphasis></entry>
43786 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43787 <entry>Default: <emphasis>unset</emphasis></entry>
43788 </row>
43789 </tbody>
43790 </tgroup>
43791 </informaltable>
43792 <para>
43793 This specifies additional RFC 2822 headers that are to be added to the message
43794 when the message is specified by the transport. Several can be given by using
43795 <quote>\n</quote> to separate them. There is no check on the format.
43796 </para>
43797 <para>
43798 <indexterm role="option">
43799 <primary><option>log</option></primary>
43800 </indexterm>
43801 </para>
43802 <informaltable frame="all">
43803 <tgroup cols="4" colsep="0" rowsep="0">
43804 <colspec colwidth="8*" align="left"/>
43805 <colspec colwidth="6*" align="center"/>
43806 <colspec colwidth="6*" align="center"/>
43807 <colspec colwidth="6*" align="right"/>
43808 <tbody>
43809 <row>
43810 <entry><option>log</option></entry>
43811 <entry>Use: <emphasis>autoreply</emphasis></entry>
43812 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43813 <entry>Default: <emphasis>unset</emphasis></entry>
43814 </row>
43815 </tbody>
43816 </tgroup>
43817 </informaltable>
43818 <para>
43819 This option names a file in which a record of every message sent is logged when
43820 the message is specified by the transport.
43821 </para>
43822 <para>
43823 <indexterm role="option">
43824 <primary><option>mode</option></primary>
43825 </indexterm>
43826 </para>
43827 <informaltable frame="all">
43828 <tgroup cols="4" colsep="0" rowsep="0">
43829 <colspec colwidth="8*" align="left"/>
43830 <colspec colwidth="6*" align="center"/>
43831 <colspec colwidth="6*" align="center"/>
43832 <colspec colwidth="6*" align="right"/>
43833 <tbody>
43834 <row>
43835 <entry><option>mode</option></entry>
43836 <entry>Use: <emphasis>autoreply</emphasis></entry>
43837 <entry>Type: <emphasis>octal integer</emphasis></entry>
43838 <entry>Default: <emphasis>0600</emphasis></entry>
43839 </row>
43840 </tbody>
43841 </tgroup>
43842 </informaltable>
43843 <para>
43844 If either the log file or the <quote>once</quote> file has to be created, this mode is
43845 used.
43846 </para>
43847 <para>
43848 <indexterm role="option">
43849 <primary><option>never_mail</option></primary>
43850 </indexterm>
43851 </para>
43852 <informaltable frame="all">
43853 <tgroup cols="4" colsep="0" rowsep="0">
43854 <colspec colwidth="8*" align="left"/>
43855 <colspec colwidth="6*" align="center"/>
43856 <colspec colwidth="6*" align="center"/>
43857 <colspec colwidth="6*" align="right"/>
43858 <tbody>
43859 <row>
43860 <entry><option>never_mail</option></entry>
43861 <entry>Use: <emphasis>autoreply</emphasis></entry>
43862 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
43863 <entry>Default: <emphasis>unset</emphasis></entry>
43864 </row>
43865 </tbody>
43866 </tgroup>
43867 </informaltable>
43868 <para>
43869 If any run of the transport creates a message with a recipient that matches any
43870 item in the list, that recipient is quietly discarded. If all recipients are
43871 discarded, no message is created. This applies both when the recipients are
43872 generated by a filter and when they are specified in the transport.
43873 </para>
43874 <para>
43875 <indexterm role="option">
43876 <primary><option>once</option></primary>
43877 </indexterm>
43878 </para>
43879 <informaltable frame="all">
43880 <tgroup cols="4" colsep="0" rowsep="0">
43881 <colspec colwidth="8*" align="left"/>
43882 <colspec colwidth="6*" align="center"/>
43883 <colspec colwidth="6*" align="center"/>
43884 <colspec colwidth="6*" align="right"/>
43885 <tbody>
43886 <row>
43887 <entry><option>once</option></entry>
43888 <entry>Use: <emphasis>autoreply</emphasis></entry>
43889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43890 <entry>Default: <emphasis>unset</emphasis></entry>
43891 </row>
43892 </tbody>
43893 </tgroup>
43894 </informaltable>
43895 <para>
43896 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
43897 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
43898 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
43899 </para>
43900 <para>
43901 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
43902 By default, if <option>once</option> is set to a non-empty file name, the message
43903 is not sent if a potential recipient is already listed in the database.
43904 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
43905 message is sent if that much time has elapsed since a message was last sent to
43906 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
43907 prevents a message from being sent a second time &ndash; in this case, zero means
43908 infinity.
43909 </para>
43910 <para>
43911 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
43912 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
43913 greater than zero, it changes the way Exim implements the <option>once</option> option.
43914 Instead of using a DBM file to record every recipient it sends to, it uses a
43915 regular file, whose size will never get larger than the given value.
43916 </para>
43917 <para>
43918 In the file, Exim keeps a linear list of recipient addresses and the times at
43919 which they were sent messages. If the file is full when a new address needs to
43920 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
43921 means that a given recipient may receive multiple messages, but at
43922 unpredictable intervals that depend on the rate of turnover of addresses in the
43923 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
43924 </para>
43925 <para>
43926 <indexterm role="option">
43927 <primary><option>once_file_size</option></primary>
43928 </indexterm>
43929 </para>
43930 <informaltable frame="all">
43931 <tgroup cols="4" colsep="0" rowsep="0">
43932 <colspec colwidth="8*" align="left"/>
43933 <colspec colwidth="6*" align="center"/>
43934 <colspec colwidth="6*" align="center"/>
43935 <colspec colwidth="6*" align="right"/>
43936 <tbody>
43937 <row>
43938 <entry><option>once_file_size</option></entry>
43939 <entry>Use: <emphasis>autoreply</emphasis></entry>
43940 <entry>Type: <emphasis>integer</emphasis></entry>
43941 <entry>Default: <emphasis>0</emphasis></entry>
43942 </row>
43943 </tbody>
43944 </tgroup>
43945 </informaltable>
43946 <para>
43947 See <option>once</option> above.
43948 </para>
43949 <para>
43950 <indexterm role="option">
43951 <primary><option>once_repeat</option></primary>
43952 </indexterm>
43953 </para>
43954 <informaltable frame="all">
43955 <tgroup cols="4" colsep="0" rowsep="0">
43956 <colspec colwidth="8*" align="left"/>
43957 <colspec colwidth="6*" align="center"/>
43958 <colspec colwidth="6*" align="center"/>
43959 <colspec colwidth="6*" align="right"/>
43960 <tbody>
43961 <row>
43962 <entry><option>once_repeat</option></entry>
43963 <entry>Use: <emphasis>autoreply</emphasis></entry>
43964 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
43965 <entry>Default: <emphasis>0s</emphasis></entry>
43966 </row>
43967 </tbody>
43968 </tgroup>
43969 </informaltable>
43970 <para>
43971 See <option>once</option> above.
43972 After expansion, the value of this option must be a valid time value.
43973 </para>
43974 <para>
43975 <indexterm role="option">
43976 <primary><option>reply_to</option></primary>
43977 </indexterm>
43978 </para>
43979 <informaltable frame="all">
43980 <tgroup cols="4" colsep="0" rowsep="0">
43981 <colspec colwidth="8*" align="left"/>
43982 <colspec colwidth="6*" align="center"/>
43983 <colspec colwidth="6*" align="center"/>
43984 <colspec colwidth="6*" align="right"/>
43985 <tbody>
43986 <row>
43987 <entry><option>reply_to</option></entry>
43988 <entry>Use: <emphasis>autoreply</emphasis></entry>
43989 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43990 <entry>Default: <emphasis>unset</emphasis></entry>
43991 </row>
43992 </tbody>
43993 </tgroup>
43994 </informaltable>
43995 <para>
43996 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
43997 specified by the transport.
43998 </para>
43999 <para>
44000 <indexterm role="option">
44001 <primary><option>return_message</option></primary>
44002 </indexterm>
44003 </para>
44004 <informaltable frame="all">
44005 <tgroup cols="4" colsep="0" rowsep="0">
44006 <colspec colwidth="8*" align="left"/>
44007 <colspec colwidth="6*" align="center"/>
44008 <colspec colwidth="6*" align="center"/>
44009 <colspec colwidth="6*" align="right"/>
44010 <tbody>
44011 <row>
44012 <entry><option>return_message</option></entry>
44013 <entry>Use: <emphasis>autoreply</emphasis></entry>
44014 <entry>Type: <emphasis>boolean</emphasis></entry>
44015 <entry>Default: <emphasis>false</emphasis></entry>
44016 </row>
44017 </tbody>
44018 </tgroup>
44019 </informaltable>
44020 <para>
44021 If this is set, a copy of the original message is returned with the new
44022 message, subject to the maximum size set in the <option>return_size_limit</option> global
44023 configuration option.
44024 </para>
44025 <para>
44026 <indexterm role="option">
44027 <primary><option>subject</option></primary>
44028 </indexterm>
44029 </para>
44030 <informaltable frame="all">
44031 <tgroup cols="4" colsep="0" rowsep="0">
44032 <colspec colwidth="8*" align="left"/>
44033 <colspec colwidth="6*" align="center"/>
44034 <colspec colwidth="6*" align="center"/>
44035 <colspec colwidth="6*" align="right"/>
44036 <tbody>
44037 <row>
44038 <entry><option>subject</option></entry>
44039 <entry>Use: <emphasis>autoreply</emphasis></entry>
44040 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44041 <entry>Default: <emphasis>unset</emphasis></entry>
44042 </row>
44043 </tbody>
44044 </tgroup>
44045 </informaltable>
44046 <para>
44047 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
44048 specified by the transport. It is tempting to quote the original subject in
44049 automatic responses. For example:
44050 </para>
44051 <literallayout class="monospaced">
44052 subject = Re: $h_subject:
44053 </literallayout>
44054 <para>
44055 There is a danger in doing this, however. It may allow a third party to
44056 subscribe your users to an opt-in mailing list, provided that the list accepts
44057 bounce messages as subscription confirmations. Well-managed lists require a
44058 non-bounce message to confirm a subscription, so the danger is relatively
44059 small.
44060 </para>
44061 <para>
44062 <indexterm role="option">
44063 <primary><option>text</option></primary>
44064 </indexterm>
44065 </para>
44066 <informaltable frame="all">
44067 <tgroup cols="4" colsep="0" rowsep="0">
44068 <colspec colwidth="8*" align="left"/>
44069 <colspec colwidth="6*" align="center"/>
44070 <colspec colwidth="6*" align="center"/>
44071 <colspec colwidth="6*" align="right"/>
44072 <tbody>
44073 <row>
44074 <entry><option>text</option></entry>
44075 <entry>Use: <emphasis>autoreply</emphasis></entry>
44076 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44077 <entry>Default: <emphasis>unset</emphasis></entry>
44078 </row>
44079 </tbody>
44080 </tgroup>
44081 </informaltable>
44082 <para>
44083 This specifies a single string to be used as the body of the message when the
44084 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
44085 the text comes first.
44086 </para>
44087 <para>
44088 <indexterm role="option">
44089 <primary><option>to</option></primary>
44090 </indexterm>
44091 </para>
44092 <informaltable frame="all">
44093 <tgroup cols="4" colsep="0" rowsep="0">
44094 <colspec colwidth="8*" align="left"/>
44095 <colspec colwidth="6*" align="center"/>
44096 <colspec colwidth="6*" align="center"/>
44097 <colspec colwidth="6*" align="right"/>
44098 <tbody>
44099 <row>
44100 <entry><option>to</option></entry>
44101 <entry>Use: <emphasis>autoreply</emphasis></entry>
44102 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44103 <entry>Default: <emphasis>unset</emphasis></entry>
44104 </row>
44105 </tbody>
44106 </tgroup>
44107 </informaltable>
44108 <para>
44109 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
44110 when the message is specified by the transport.
44111 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
44112 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
44113 </para>
44114 </section>
44115 </chapter>
44116
44117 <chapter id="CHAPLMTP">
44118 <title>The lmtp transport</title>
44119 <para>
44120 <indexterm role="concept">
44121 <primary>transports</primary>
44122 <secondary><command>lmtp</command></secondary>
44123 </indexterm>
44124 <indexterm role="concept">
44125 <primary><command>lmtp</command> transport</primary>
44126 </indexterm>
44127 <indexterm role="concept">
44128 <primary>LMTP</primary>
44129 <secondary>over a pipe</secondary>
44130 </indexterm>
44131 <indexterm role="concept">
44132 <primary>LMTP</primary>
44133 <secondary>over a socket</secondary>
44134 </indexterm>
44135 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
44136 specified command
44137 or by interacting with a Unix domain socket.
44138 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
44139 transports. Exim also has support for using LMTP over TCP/IP; this is
44140 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
44141 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
44142 has it commented out. You need to ensure that
44143 </para>
44144 <literallayout class="monospaced">
44145 TRANSPORT_LMTP=yes
44146 </literallayout>
44147 <para>
44148 <indexterm role="concept">
44149 <primary>options</primary>
44150 <secondary><command>lmtp</command> transport</secondary>
44151 </indexterm>
44152 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
44153 included in the Exim binary. The private options of the <command>lmtp</command> transport are
44154 as follows:
44155 </para>
44156 <para>
44157 <indexterm role="option">
44158 <primary><option>batch_id</option></primary>
44159 </indexterm>
44160 </para>
44161 <informaltable frame="all">
44162 <tgroup cols="4" colsep="0" rowsep="0">
44163 <colspec colwidth="8*" align="left"/>
44164 <colspec colwidth="6*" align="center"/>
44165 <colspec colwidth="6*" align="center"/>
44166 <colspec colwidth="6*" align="right"/>
44167 <tbody>
44168 <row>
44169 <entry><option>batch_id</option></entry>
44170 <entry>Use: <emphasis>lmtp</emphasis></entry>
44171 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44172 <entry>Default: <emphasis>unset</emphasis></entry>
44173 </row>
44174 </tbody>
44175 </tgroup>
44176 </informaltable>
44177 <para>
44178 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44179 </para>
44180 <para>
44181 <indexterm role="option">
44182 <primary><option>batch_max</option></primary>
44183 </indexterm>
44184 </para>
44185 <informaltable frame="all">
44186 <tgroup cols="4" colsep="0" rowsep="0">
44187 <colspec colwidth="8*" align="left"/>
44188 <colspec colwidth="6*" align="center"/>
44189 <colspec colwidth="6*" align="center"/>
44190 <colspec colwidth="6*" align="right"/>
44191 <tbody>
44192 <row>
44193 <entry><option>batch_max</option></entry>
44194 <entry>Use: <emphasis>lmtp</emphasis></entry>
44195 <entry>Type: <emphasis>integer</emphasis></entry>
44196 <entry>Default: <emphasis>1</emphasis></entry>
44197 </row>
44198 </tbody>
44199 </tgroup>
44200 </informaltable>
44201 <para>
44202 This limits the number of addresses that can be handled in a single delivery.
44203 Most LMTP servers can handle several addresses at once, so it is normally a
44204 good idea to increase this value. See the description of local delivery
44205 batching in chapter <xref linkend="CHAPbatching"/>.
44206 </para>
44207 <para>
44208 <indexterm role="option">
44209 <primary><option>command</option></primary>
44210 </indexterm>
44211 </para>
44212 <informaltable frame="all">
44213 <tgroup cols="4" colsep="0" rowsep="0">
44214 <colspec colwidth="8*" align="left"/>
44215 <colspec colwidth="6*" align="center"/>
44216 <colspec colwidth="6*" align="center"/>
44217 <colspec colwidth="6*" align="right"/>
44218 <tbody>
44219 <row>
44220 <entry><option>command</option></entry>
44221 <entry>Use: <emphasis>lmtp</emphasis></entry>
44222 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44223 <entry>Default: <emphasis>unset</emphasis></entry>
44224 </row>
44225 </tbody>
44226 </tgroup>
44227 </informaltable>
44228 <para>
44229 This option must be set if <option>socket</option> is not set. The string is a command which
44230 is run in a separate process. It is split up into a command name and list of
44231 arguments, each of which is separately expanded (so expansion cannot change the
44232 number of arguments). The command is run directly, not via a shell. The message
44233 is passed to the new process using the standard input and output to operate the
44234 LMTP protocol.
44235 </para>
44236 <para>
44237 <indexterm role="option">
44238 <primary><option>ignore_quota</option></primary>
44239 </indexterm>
44240 </para>
44241 <informaltable frame="all">
44242 <tgroup cols="4" colsep="0" rowsep="0">
44243 <colspec colwidth="8*" align="left"/>
44244 <colspec colwidth="6*" align="center"/>
44245 <colspec colwidth="6*" align="center"/>
44246 <colspec colwidth="6*" align="right"/>
44247 <tbody>
44248 <row>
44249 <entry><option>ignore_quota</option></entry>
44250 <entry>Use: <emphasis>lmtp</emphasis></entry>
44251 <entry>Type: <emphasis>boolean</emphasis></entry>
44252 <entry>Default: <emphasis>false</emphasis></entry>
44253 </row>
44254 </tbody>
44255 </tgroup>
44256 </informaltable>
44257 <para>
44258 <indexterm role="concept">
44259 <primary>LMTP</primary>
44260 <secondary>ignoring quota errors</secondary>
44261 </indexterm>
44262 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
44263 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
44264 in its response to the LHLO command.
44265 </para>
44266 <para>
44267 <indexterm role="option">
44268 <primary><option>socket</option></primary>
44269 </indexterm>
44270 </para>
44271 <informaltable frame="all">
44272 <tgroup cols="4" colsep="0" rowsep="0">
44273 <colspec colwidth="8*" align="left"/>
44274 <colspec colwidth="6*" align="center"/>
44275 <colspec colwidth="6*" align="center"/>
44276 <colspec colwidth="6*" align="right"/>
44277 <tbody>
44278 <row>
44279 <entry><option>socket</option></entry>
44280 <entry>Use: <emphasis>lmtp</emphasis></entry>
44281 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44282 <entry>Default: <emphasis>unset</emphasis></entry>
44283 </row>
44284 </tbody>
44285 </tgroup>
44286 </informaltable>
44287 <para>
44288 This option must be set if <option>command</option> is not set. The result of expansion must
44289 be the name of a Unix domain socket. The transport connects to the socket and
44290 delivers the message to it using the LMTP protocol.
44291 </para>
44292 <para>
44293 <indexterm role="option">
44294 <primary><option>timeout</option></primary>
44295 </indexterm>
44296 </para>
44297 <informaltable frame="all">
44298 <tgroup cols="4" colsep="0" rowsep="0">
44299 <colspec colwidth="8*" align="left"/>
44300 <colspec colwidth="6*" align="center"/>
44301 <colspec colwidth="6*" align="center"/>
44302 <colspec colwidth="6*" align="right"/>
44303 <tbody>
44304 <row>
44305 <entry><option>timeout</option></entry>
44306 <entry>Use: <emphasis>lmtp</emphasis></entry>
44307 <entry>Type: <emphasis>time</emphasis></entry>
44308 <entry>Default: <emphasis>5m</emphasis></entry>
44309 </row>
44310 </tbody>
44311 </tgroup>
44312 </informaltable>
44313 <para>
44314 The transport is aborted if the created process or Unix domain socket does not
44315 respond to LMTP commands or message input within this timeout. Delivery
44316 is deferred, and will be tried again later. Here is an example of a typical
44317 LMTP transport:
44318 </para>
44319 <literallayout class="monospaced">
44320 lmtp:
44321   driver = lmtp
44322   command = /some/local/lmtp/delivery/program
44323   batch_max = 20
44324   user = exim
44325 </literallayout>
44326 <para>
44327 This delivers up to 20 addresses at a time, in a mixture of domains if
44328 necessary, running as the user <emphasis>exim</emphasis>.
44329 </para>
44330 </chapter>
44331
44332 <chapter id="CHAPpipetransport">
44333 <title>The pipe transport</title>
44334 <para>
44335 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
44336 <primary>transports</primary>
44337 <secondary><command>pipe</command></secondary>
44338 </indexterm>
44339 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
44340 <primary><command>pipe</command> transport</primary>
44341 </indexterm>
44342 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
44343 running in another process. One example is the use of <command>pipe</command> as a
44344 pseudo-remote transport for passing messages to some other delivery mechanism
44345 (such as UUCP). Another is the use by individual users to automatically process
44346 their incoming messages. The <command>pipe</command> transport can be used in one of the
44347 following ways:
44348 </para>
44349 <itemizedlist>
44350 <listitem>
44351 <para>
44352 <indexterm role="variable">
44353 <primary><varname>$local_part</varname></primary>
44354 </indexterm>
44355 A router routes one address to a transport in the normal way, and the
44356 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
44357 contains the local part of the address (as usual), and the command that is run
44358 is specified by the <option>command</option> option on the transport.
44359 </para>
44360 </listitem>
44361 <listitem>
44362 <para>
44363 <indexterm role="variable">
44364 <primary><varname>$pipe_addresses</varname></primary>
44365 </indexterm>
44366 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
44367 transport can handle more than one address in a single run. In this case, when
44368 more than one address is routed to the transport, <varname>$local_part</varname> is not set
44369 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
44370 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
44371 that are routed to the transport.
44372 </para>
44373 </listitem>
44374 <listitem>
44375 <para>
44376 <indexterm role="variable">
44377 <primary><varname>$address_pipe</varname></primary>
44378 </indexterm>
44379 A router redirects an address directly to a pipe command (for example, from an
44380 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
44381 pipe command, and the <option>command</option> option on the transport is ignored unless
44382 <option>force_command</option> is set. If only one address is being transported
44383 (<option>batch_max</option> is not greater than one, or only one address was redirected to
44384 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
44385 </para>
44386 </listitem>
44387 </itemizedlist>
44388 <para>
44389 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
44390 deliver messages over pipes using the LMTP interactive protocol. This is
44391 implemented by the <command>lmtp</command> transport.
44392 </para>
44393 <para>
44394 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
44395 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
44396 other cases, the uid and gid have to be specified explicitly, either on the
44397 transport or on the router that handles the address. Current and <quote>home</quote>
44398 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
44399 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
44400 for a discussion of local delivery batching.
44401 </para>
44402 <section id="SECID140">
44403 <title>Concurrent delivery</title>
44404 <para>
44405 If two messages arrive at almost the same time, and both are routed to a pipe
44406 delivery, the two pipe transports may be run concurrently. You must ensure that
44407 any pipe commands you set up are robust against this happening. If the commands
44408 write to a file, the <option>exim_lock</option> utility might be of use.
44409 Alternatively the <option>max_parallel</option> option could be used with a value
44410 of "1" to enforce serialization.
44411 </para>
44412 </section>
44413 <section id="SECID141">
44414 <title>Returned status and data</title>
44415 <para>
44416 <indexterm role="concept">
44417 <primary><command>pipe</command> transport</primary>
44418 <secondary>returned data</secondary>
44419 </indexterm>
44420 If the command exits with a non-zero return code, the delivery is deemed to
44421 have failed, unless either the <option>ignore_status</option> option is set (in which case
44422 the return code is treated as zero), or the return code is one of those listed
44423 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
44424 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
44425 logged, but are not included in the bounce message, which merely contains
44426 <quote>local delivery failed</quote>.
44427 </para>
44428 <para>
44429 If the command exits on a signal and the <option>freeze_signal</option> option is set then
44430 the message will be frozen in the queue. If that option is not set, a bounce
44431 will be sent as normal.
44432 </para>
44433 <para>
44434 If the return code is greater than 128 and the command being run is a shell
44435 script, it normally means that the script was terminated by a signal whose
44436 value is the return code minus 128. The <option>freeze_signal</option> option does not
44437 apply in this case.
44438 </para>
44439 <para>
44440 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
44441 return code is set to 127. This is the value that a shell returns if it is
44442 asked to run a non-existent command. The wording for the log line suggests that
44443 a non-existent command may be the problem.
44444 </para>
44445 <para>
44446 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
44447 set and the command produces any output on its standard output or standard
44448 error streams, the command is considered to have failed, even if it gave a zero
44449 return code or if <option>ignore_status</option> is set. The output from the command is
44450 included as part of the bounce message. The <option>return_fail_output</option> option is
44451 similar, except that output is returned only when the command exits with a
44452 failure return code, that is, a value other than zero or a code that matches
44453 <option>temp_errors</option>.
44454 </para>
44455 </section>
44456 <section id="SECThowcommandrun">
44457 <title>How the command is run</title>
44458 <para>
44459 <indexterm role="concept">
44460 <primary><command>pipe</command> transport</primary>
44461 <secondary>path for command</secondary>
44462 </indexterm>
44463 The command line is (by default) broken down into a command name and arguments
44464 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
44465 <option>restrict_to_path</option> options can be used to restrict the commands that may be
44466 run.
44467 </para>
44468 <para>
44469 <indexterm role="concept">
44470 <primary>quoting</primary>
44471 <secondary>in pipe command</secondary>
44472 </indexterm>
44473 Unquoted arguments are delimited by white space. If an argument appears in
44474 double quotes, backslash is interpreted as an escape character in the usual
44475 way. If an argument appears in single quotes, no escaping is done.
44476 </para>
44477 <para>
44478 String expansion is applied to the command line except when it comes from a
44479 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
44480 expansion is applied to each argument in turn rather than to the whole line.
44481 For this reason, any string expansion item that contains white space must be
44482 quoted so as to be contained within a single argument. A setting such as
44483 </para>
44484 <literallayout class="monospaced">
44485 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
44486 </literallayout>
44487 <para>
44488 will not work, because the expansion item gets split between several
44489 arguments. You have to write
44490 </para>
44491 <literallayout class="monospaced">
44492 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
44493 </literallayout>
44494 <para>
44495 to ensure that it is all in one argument. The expansion is done in this way,
44496 argument by argument, so that the number of arguments cannot be changed as a
44497 result of expansion, and quotes or backslashes in inserted variables do not
44498 interact with external quoting. However, this leads to problems if you want to
44499 generate multiple arguments (or the command name plus arguments) from a single
44500 expansion. In this situation, the simplest solution is to use a shell. For
44501 example:
44502 </para>
44503 <literallayout class="monospaced">
44504 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
44505 </literallayout>
44506 <para>
44507 <indexterm role="concept">
44508 <primary>transport</primary>
44509 <secondary>filter</secondary>
44510 </indexterm>
44511 <indexterm role="concept">
44512 <primary>filter</primary>
44513 <secondary>transport filter</secondary>
44514 </indexterm>
44515 <indexterm role="variable">
44516 <primary><varname>$pipe_addresses</varname></primary>
44517 </indexterm>
44518 Special handling takes place when an argument consists of precisely the text
44519 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
44520 place this string is recognized is when it appears as an argument for a pipe or
44521 transport filter command. It causes each address that is being handled to be
44522 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
44523 avoids any problems with spaces or shell metacharacters, and is of use when a
44524 <command>pipe</command> transport is handling groups of addresses in a batch.
44525 </para>
44526 <para>
44527 If <option>force_command</option> is enabled on the transport, Special handling takes place
44528 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
44529 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
44530 argument is inserted in the argument list at that point
44531 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
44532 the only item in the argument; in fact, if it were then <option>force_command</option>
44533 should behave as a no-op.  Rather, it should be used to adjust the command
44534 run while preserving the argument vector separation.
44535 </para>
44536 <para>
44537 After splitting up into arguments and expansion, the resulting command is run
44538 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
44539 message that is being delivered is supplied on the standard input, and the
44540 standard output and standard error are both connected to a single pipe that is
44541 read by Exim. The <option>max_output</option> option controls how much output the command
44542 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
44543 control what is done with it.
44544 </para>
44545 <para>
44546 Not running the command under a shell (by default) lessens the security risks
44547 in cases when a command from a user&#x2019;s filter file is built out of data that was
44548 taken from an incoming message. If a shell is required, it can of course be
44549 explicitly specified as the command to be run. However, there are circumstances
44550 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
44551 under a shell and cannot easily be modified. To allow for these cases, there is
44552 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
44553 works. Instead of breaking up the command line as just described, it expands it
44554 as a single string and passes the result to <filename>/bin/sh</filename>. The
44555 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
44556 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
44557 </para>
44558 </section>
44559 <section id="SECTpipeenv">
44560 <title>Environment variables</title>
44561 <para>
44562 <indexterm role="concept">
44563 <primary><command>pipe</command> transport</primary>
44564 <secondary>environment for command</secondary>
44565 </indexterm>
44566 <indexterm role="concept">
44567 <primary>environment</primary>
44568 <secondary><command>pipe</command> transport</secondary>
44569 </indexterm>
44570 The environment variables listed below are set up when the command is invoked.
44571 This list is a compromise for maximum compatibility with other MTAs. Note that
44572 the <option>environment</option> option can be used to add additional variables to this
44573 environment. The environment for the <command>pipe</command> transport is not subject
44574 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
44575 </para>
44576 <literallayout>
44577 <literal>DOMAIN            </literal>   the domain of the address
44578 <literal>HOME              </literal>   the home directory, if set
44579 <literal>HOST              </literal>   the host name when called from a router (see below)
44580 <literal>LOCAL_PART        </literal>   see below
44581 <literal>LOCAL_PART_PREFIX </literal>   see below
44582 <literal>LOCAL_PART_SUFFIX </literal>   see below
44583 <literal>LOGNAME           </literal>   see below
44584 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
44585 <literal>PATH              </literal>   as specified by the <option>path</option> option below
44586 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
44587 <literal>RECIPIENT         </literal>   the complete recipient address
44588 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
44589 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
44590 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
44591 <literal>USER              </literal>   see below
44592 </literallayout>
44593 <para>
44594 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
44595 router, LOCAL_PART is set to the local part of the address. When it is
44596 called as a result of a forward or alias expansion, LOCAL_PART is set to
44597 the local part of the address that was expanded. In both cases, any affixes are
44598 removed from the local part, and made available in LOCAL_PART_PREFIX and
44599 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
44600 same value as LOCAL_PART for compatibility with other MTAs.
44601 </para>
44602 <para>
44603 <indexterm role="concept">
44604 <primary>HOST</primary>
44605 </indexterm>
44606 HOST is set only when a <command>pipe</command> transport is called from a router that
44607 associates hosts with an address, typically when using <command>pipe</command> as a
44608 pseudo-remote transport. HOST is set to the first host name specified by
44609 the router.
44610 </para>
44611 <para>
44612 <indexterm role="concept">
44613 <primary>HOME</primary>
44614 </indexterm>
44615 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
44616 for the HOME environment variable. Otherwise, a home directory may be set
44617 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
44618 user&#x2019;s home directory if <option>check_local_user</option> is set.
44619 </para>
44620 </section>
44621 <section id="SECID142">
44622 <title>Private options for pipe</title>
44623 <para>
44624 <indexterm role="concept">
44625 <primary>options</primary>
44626 <secondary><command>pipe</command> transport</secondary>
44627 </indexterm>
44628 </para>
44629 <para>
44630 <indexterm role="option">
44631 <primary><option>allow_commands</option></primary>
44632 </indexterm>
44633 </para>
44634 <informaltable frame="all">
44635 <tgroup cols="4" colsep="0" rowsep="0">
44636 <colspec colwidth="8*" align="left"/>
44637 <colspec colwidth="6*" align="center"/>
44638 <colspec colwidth="6*" align="center"/>
44639 <colspec colwidth="6*" align="right"/>
44640 <tbody>
44641 <row>
44642 <entry><option>allow_commands</option></entry>
44643 <entry>Use: <emphasis>pipe</emphasis></entry>
44644 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
44645 <entry>Default: <emphasis>unset</emphasis></entry>
44646 </row>
44647 </tbody>
44648 </tgroup>
44649 </informaltable>
44650 <para>
44651 <indexterm role="concept">
44652 <primary><command>pipe</command> transport</primary>
44653 <secondary>permitted commands</secondary>
44654 </indexterm>
44655 The string is expanded, and is then interpreted as a colon-separated list of
44656 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
44657 permitted are those in the <option>allow_commands</option> list. They need not be absolute
44658 paths; the <option>path</option> option is still used for relative paths. If
44659 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
44660 in the <option>allow_commands</option> list, or a name without any slashes that is found on
44661 the path. In other words, if neither <option>allow_commands</option> nor
44662 <option>restrict_to_path</option> is set, there is no restriction on the command, but
44663 otherwise only commands that are permitted by one or the other are allowed. For
44664 example, if
44665 </para>
44666 <literallayout class="monospaced">
44667 allow_commands = /usr/bin/vacation
44668 </literallayout>
44669 <para>
44670 and <option>restrict_to_path</option> is not set, the only permitted command is
44671 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
44672 <option>use_shell</option> is set.
44673 </para>
44674 <para>
44675 <indexterm role="option">
44676 <primary><option>batch_id</option></primary>
44677 </indexterm>
44678 </para>
44679 <informaltable frame="all">
44680 <tgroup cols="4" colsep="0" rowsep="0">
44681 <colspec colwidth="8*" align="left"/>
44682 <colspec colwidth="6*" align="center"/>
44683 <colspec colwidth="6*" align="center"/>
44684 <colspec colwidth="6*" align="right"/>
44685 <tbody>
44686 <row>
44687 <entry><option>batch_id</option></entry>
44688 <entry>Use: <emphasis>pipe</emphasis></entry>
44689 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44690 <entry>Default: <emphasis>unset</emphasis></entry>
44691 </row>
44692 </tbody>
44693 </tgroup>
44694 </informaltable>
44695 <para>
44696 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44697 </para>
44698 <para>
44699 <indexterm role="option">
44700 <primary><option>batch_max</option></primary>
44701 </indexterm>
44702 </para>
44703 <informaltable frame="all">
44704 <tgroup cols="4" colsep="0" rowsep="0">
44705 <colspec colwidth="8*" align="left"/>
44706 <colspec colwidth="6*" align="center"/>
44707 <colspec colwidth="6*" align="center"/>
44708 <colspec colwidth="6*" align="right"/>
44709 <tbody>
44710 <row>
44711 <entry><option>batch_max</option></entry>
44712 <entry>Use: <emphasis>pipe</emphasis></entry>
44713 <entry>Type: <emphasis>integer</emphasis></entry>
44714 <entry>Default: <emphasis>1</emphasis></entry>
44715 </row>
44716 </tbody>
44717 </tgroup>
44718 </informaltable>
44719 <para>
44720 This limits the number of addresses that can be handled in a single delivery.
44721 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44722 </para>
44723 <para>
44724 <indexterm role="option">
44725 <primary><option>check_string</option></primary>
44726 </indexterm>
44727 </para>
44728 <informaltable frame="all">
44729 <tgroup cols="4" colsep="0" rowsep="0">
44730 <colspec colwidth="8*" align="left"/>
44731 <colspec colwidth="6*" align="center"/>
44732 <colspec colwidth="6*" align="center"/>
44733 <colspec colwidth="6*" align="right"/>
44734 <tbody>
44735 <row>
44736 <entry><option>check_string</option></entry>
44737 <entry>Use: <emphasis>pipe</emphasis></entry>
44738 <entry>Type: <emphasis>string</emphasis></entry>
44739 <entry>Default: <emphasis>unset</emphasis></entry>
44740 </row>
44741 </tbody>
44742 </tgroup>
44743 </informaltable>
44744 <para>
44745 As <command>pipe</command> writes the message, the start of each line is tested for matching
44746 <option>check_string</option>, and if it does, the initial matching characters are replaced
44747 by the contents of <option>escape_string</option>, provided both are set. The value of
44748 <option>check_string</option> is a literal string, not a regular expression, and the case of
44749 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
44750 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
44751 the SMTP escaping protocol. Any settings made in the configuration file are
44752 ignored.
44753 </para>
44754 <para>
44755 <indexterm role="option">
44756 <primary><option>command</option></primary>
44757 </indexterm>
44758 </para>
44759 <informaltable frame="all">
44760 <tgroup cols="4" colsep="0" rowsep="0">
44761 <colspec colwidth="8*" align="left"/>
44762 <colspec colwidth="6*" align="center"/>
44763 <colspec colwidth="6*" align="center"/>
44764 <colspec colwidth="6*" align="right"/>
44765 <tbody>
44766 <row>
44767 <entry><option>command</option></entry>
44768 <entry>Use: <emphasis>pipe</emphasis></entry>
44769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44770 <entry>Default: <emphasis>unset</emphasis></entry>
44771 </row>
44772 </tbody>
44773 </tgroup>
44774 </informaltable>
44775 <para>
44776 This option need not be set when <command>pipe</command> is being used to deliver to pipes
44777 obtained directly from address redirections. In other cases, the option must be
44778 set, to provide a command to be run. It need not yield an absolute path (see
44779 the <option>path</option> option below). The command is split up into separate arguments by
44780 Exim, and each argument is separately expanded, as described in section
44781 <xref linkend="SECThowcommandrun"/> above.
44782 </para>
44783 <para>
44784 <indexterm role="option">
44785 <primary><option>environment</option></primary>
44786 </indexterm>
44787 </para>
44788 <informaltable frame="all">
44789 <tgroup cols="4" colsep="0" rowsep="0">
44790 <colspec colwidth="8*" align="left"/>
44791 <colspec colwidth="6*" align="center"/>
44792 <colspec colwidth="6*" align="center"/>
44793 <colspec colwidth="6*" align="right"/>
44794 <tbody>
44795 <row>
44796 <entry><option>environment</option></entry>
44797 <entry>Use: <emphasis>pipe</emphasis></entry>
44798 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44799 <entry>Default: <emphasis>unset</emphasis></entry>
44800 </row>
44801 </tbody>
44802 </tgroup>
44803 </informaltable>
44804 <para>
44805 <indexterm role="concept">
44806 <primary><command>pipe</command> transport</primary>
44807 <secondary>environment for command</secondary>
44808 </indexterm>
44809 <indexterm role="concept">
44810 <primary>environment</primary>
44811 <secondary><command>pipe</command> transport</secondary>
44812 </indexterm>
44813 This option is used to add additional variables to the environment in which the
44814 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
44815 a string which is expanded, and then interpreted as a colon-separated list of
44816 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
44817 </para>
44818 <para>
44819 <indexterm role="option">
44820 <primary><option>escape_string</option></primary>
44821 </indexterm>
44822 </para>
44823 <informaltable frame="all">
44824 <tgroup cols="4" colsep="0" rowsep="0">
44825 <colspec colwidth="8*" align="left"/>
44826 <colspec colwidth="6*" align="center"/>
44827 <colspec colwidth="6*" align="center"/>
44828 <colspec colwidth="6*" align="right"/>
44829 <tbody>
44830 <row>
44831 <entry><option>escape_string</option></entry>
44832 <entry>Use: <emphasis>pipe</emphasis></entry>
44833 <entry>Type: <emphasis>string</emphasis></entry>
44834 <entry>Default: <emphasis>unset</emphasis></entry>
44835 </row>
44836 </tbody>
44837 </tgroup>
44838 </informaltable>
44839 <para>
44840 See <option>check_string</option> above.
44841 </para>
44842 <para>
44843 <indexterm role="option">
44844 <primary><option>freeze_exec_fail</option></primary>
44845 </indexterm>
44846 </para>
44847 <informaltable frame="all">
44848 <tgroup cols="4" colsep="0" rowsep="0">
44849 <colspec colwidth="8*" align="left"/>
44850 <colspec colwidth="6*" align="center"/>
44851 <colspec colwidth="6*" align="center"/>
44852 <colspec colwidth="6*" align="right"/>
44853 <tbody>
44854 <row>
44855 <entry><option>freeze_exec_fail</option></entry>
44856 <entry>Use: <emphasis>pipe</emphasis></entry>
44857 <entry>Type: <emphasis>boolean</emphasis></entry>
44858 <entry>Default: <emphasis>false</emphasis></entry>
44859 </row>
44860 </tbody>
44861 </tgroup>
44862 </informaltable>
44863 <para>
44864 <indexterm role="concept">
44865 <primary>exec failure</primary>
44866 </indexterm>
44867 <indexterm role="concept">
44868 <primary>failure of exec</primary>
44869 </indexterm>
44870 <indexterm role="concept">
44871 <primary><command>pipe</command> transport</primary>
44872 <secondary>failure of exec</secondary>
44873 </indexterm>
44874 Failure to exec the command in a pipe transport is by default treated like
44875 any other failure while running the command. However, if <option>freeze_exec_fail</option>
44876 is set, failure to exec is treated specially, and causes the message to be
44877 frozen, whatever the setting of <option>ignore_status</option>.
44878 </para>
44879 <para>
44880 <indexterm role="option">
44881 <primary><option>freeze_signal</option></primary>
44882 </indexterm>
44883 </para>
44884 <informaltable frame="all">
44885 <tgroup cols="4" colsep="0" rowsep="0">
44886 <colspec colwidth="8*" align="left"/>
44887 <colspec colwidth="6*" align="center"/>
44888 <colspec colwidth="6*" align="center"/>
44889 <colspec colwidth="6*" align="right"/>
44890 <tbody>
44891 <row>
44892 <entry><option>freeze_signal</option></entry>
44893 <entry>Use: <emphasis>pipe</emphasis></entry>
44894 <entry>Type: <emphasis>boolean</emphasis></entry>
44895 <entry>Default: <emphasis>false</emphasis></entry>
44896 </row>
44897 </tbody>
44898 </tgroup>
44899 </informaltable>
44900 <para>
44901 <indexterm role="concept">
44902 <primary>signal exit</primary>
44903 </indexterm>
44904 <indexterm role="concept">
44905 <primary><command>pipe</command> transport</primary>
44906 <secondary>,</secondary>
44907 </indexterm>
44908 Normally if the process run by a command in a pipe transport exits on a signal,
44909 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
44910 frozen in Exim&#x2019;s queue instead.
44911 </para>
44912 <para>
44913 <indexterm role="option">
44914 <primary><option>force_command</option></primary>
44915 </indexterm>
44916 </para>
44917 <informaltable frame="all">
44918 <tgroup cols="4" colsep="0" rowsep="0">
44919 <colspec colwidth="8*" align="left"/>
44920 <colspec colwidth="6*" align="center"/>
44921 <colspec colwidth="6*" align="center"/>
44922 <colspec colwidth="6*" align="right"/>
44923 <tbody>
44924 <row>
44925 <entry><option>force_command</option></entry>
44926 <entry>Use: <emphasis>pipe</emphasis></entry>
44927 <entry>Type: <emphasis>boolean</emphasis></entry>
44928 <entry>Default: <emphasis>false</emphasis></entry>
44929 </row>
44930 </tbody>
44931 </tgroup>
44932 </informaltable>
44933 <para>
44934 <indexterm role="concept">
44935 <primary>force command</primary>
44936 </indexterm>
44937 <indexterm role="concept">
44938 <primary><command>pipe</command> transport</primary>
44939 <secondary>,</secondary>
44940 </indexterm>
44941 Normally when a router redirects an address directly to a pipe command
44942 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
44943 is set, the <option>command</option> option will used. This is especially
44944 useful for forcing a wrapper or additional argument to be added to the
44945 command. For example:
44946 </para>
44947 <literallayout class="monospaced">
44948 command = /usr/bin/remote_exec myhost -- $address_pipe
44949 force_command
44950 </literallayout>
44951 <para>
44952 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
44953 <option>force_command</option> is set, expanding out to the original argument vector as
44954 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
44955 </para>
44956 <para>
44957 <indexterm role="option">
44958 <primary><option>ignore_status</option></primary>
44959 </indexterm>
44960 </para>
44961 <informaltable frame="all">
44962 <tgroup cols="4" colsep="0" rowsep="0">
44963 <colspec colwidth="8*" align="left"/>
44964 <colspec colwidth="6*" align="center"/>
44965 <colspec colwidth="6*" align="center"/>
44966 <colspec colwidth="6*" align="right"/>
44967 <tbody>
44968 <row>
44969 <entry><option>ignore_status</option></entry>
44970 <entry>Use: <emphasis>pipe</emphasis></entry>
44971 <entry>Type: <emphasis>boolean</emphasis></entry>
44972 <entry>Default: <emphasis>false</emphasis></entry>
44973 </row>
44974 </tbody>
44975 </tgroup>
44976 </informaltable>
44977 <para>
44978 If this option is true, the status returned by the subprocess that is set up to
44979 run the command is ignored, and Exim behaves as if zero had been returned.
44980 Otherwise, a non-zero status or termination by signal causes an error return
44981 from the transport unless the status value is one of those listed in
44982 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
44983 </para>
44984 <para>
44985 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
44986 See the <option>timeout_defer</option> option for how timeouts are handled.
44987 </para>
44988 <para>
44989 <indexterm role="option">
44990 <primary><option>log_defer_output</option></primary>
44991 </indexterm>
44992 </para>
44993 <informaltable frame="all">
44994 <tgroup cols="4" colsep="0" rowsep="0">
44995 <colspec colwidth="8*" align="left"/>
44996 <colspec colwidth="6*" align="center"/>
44997 <colspec colwidth="6*" align="center"/>
44998 <colspec colwidth="6*" align="right"/>
44999 <tbody>
45000 <row>
45001 <entry><option>log_defer_output</option></entry>
45002 <entry>Use: <emphasis>pipe</emphasis></entry>
45003 <entry>Type: <emphasis>boolean</emphasis></entry>
45004 <entry>Default: <emphasis>false</emphasis></entry>
45005 </row>
45006 </tbody>
45007 </tgroup>
45008 </informaltable>
45009 <para>
45010 <indexterm role="concept">
45011 <primary><command>pipe</command> transport</primary>
45012 <secondary>logging output</secondary>
45013 </indexterm>
45014 If this option is set, and the status returned by the command is
45015 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
45016 and any output was produced on stdout or stderr, the first line of it is
45017 written to the main log.
45018 </para>
45019 <para>
45020 <indexterm role="option">
45021 <primary><option>log_fail_output</option></primary>
45022 </indexterm>
45023 </para>
45024 <informaltable frame="all">
45025 <tgroup cols="4" colsep="0" rowsep="0">
45026 <colspec colwidth="8*" align="left"/>
45027 <colspec colwidth="6*" align="center"/>
45028 <colspec colwidth="6*" align="center"/>
45029 <colspec colwidth="6*" align="right"/>
45030 <tbody>
45031 <row>
45032 <entry><option>log_fail_output</option></entry>
45033 <entry>Use: <emphasis>pipe</emphasis></entry>
45034 <entry>Type: <emphasis>boolean</emphasis></entry>
45035 <entry>Default: <emphasis>false</emphasis></entry>
45036 </row>
45037 </tbody>
45038 </tgroup>
45039 </informaltable>
45040 <para>
45041 If this option is set, and the command returns any output on stdout or
45042 stderr, and also ends with a return code that is neither zero nor one of
45043 the return codes listed in <option>temp_errors</option> (that is, the delivery
45044 failed), the first line of output is written to the main log. This
45045 option and <option>log_output</option> are mutually exclusive.  Only one of them may
45046 be set.
45047 </para>
45048 <para>
45049 <indexterm role="option">
45050 <primary><option>log_output</option></primary>
45051 </indexterm>
45052 </para>
45053 <informaltable frame="all">
45054 <tgroup cols="4" colsep="0" rowsep="0">
45055 <colspec colwidth="8*" align="left"/>
45056 <colspec colwidth="6*" align="center"/>
45057 <colspec colwidth="6*" align="center"/>
45058 <colspec colwidth="6*" align="right"/>
45059 <tbody>
45060 <row>
45061 <entry><option>log_output</option></entry>
45062 <entry>Use: <emphasis>pipe</emphasis></entry>
45063 <entry>Type: <emphasis>boolean</emphasis></entry>
45064 <entry>Default: <emphasis>false</emphasis></entry>
45065 </row>
45066 </tbody>
45067 </tgroup>
45068 </informaltable>
45069 <para>
45070 If this option is set and the command returns any output on stdout or
45071 stderr, the first line of output is written to the main log, whatever
45072 the return code. This option and <option>log_fail_output</option> are mutually
45073 exclusive. Only one of them may be set.
45074 </para>
45075 <para>
45076 <indexterm role="option">
45077 <primary><option>max_output</option></primary>
45078 </indexterm>
45079 </para>
45080 <informaltable frame="all">
45081 <tgroup cols="4" colsep="0" rowsep="0">
45082 <colspec colwidth="8*" align="left"/>
45083 <colspec colwidth="6*" align="center"/>
45084 <colspec colwidth="6*" align="center"/>
45085 <colspec colwidth="6*" align="right"/>
45086 <tbody>
45087 <row>
45088 <entry><option>max_output</option></entry>
45089 <entry>Use: <emphasis>pipe</emphasis></entry>
45090 <entry>Type: <emphasis>integer</emphasis></entry>
45091 <entry>Default: <emphasis>20K</emphasis></entry>
45092 </row>
45093 </tbody>
45094 </tgroup>
45095 </informaltable>
45096 <para>
45097 This specifies the maximum amount of output that the command may produce on its
45098 standard output and standard error file combined. If the limit is exceeded, the
45099 process running the command is killed. This is intended as a safety measure to
45100 catch runaway processes. The limit is applied independently of the settings of
45101 the options that control what is done with such output (for example,
45102 <option>return_output</option>). Because of buffering effects, the amount of output may
45103 exceed the limit by a small amount before Exim notices.
45104 </para>
45105 <para>
45106 <indexterm role="option">
45107 <primary><option>message_prefix</option></primary>
45108 </indexterm>
45109 </para>
45110 <informaltable frame="all">
45111 <tgroup cols="4" colsep="0" rowsep="0">
45112 <colspec colwidth="8*" align="left"/>
45113 <colspec colwidth="6*" align="center"/>
45114 <colspec colwidth="6*" align="center"/>
45115 <colspec colwidth="6*" align="right"/>
45116 <tbody>
45117 <row>
45118 <entry><option>message_prefix</option></entry>
45119 <entry>Use: <emphasis>pipe</emphasis></entry>
45120 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45121 <entry>Default: <emphasis>see below</emphasis></entry>
45122 </row>
45123 </tbody>
45124 </tgroup>
45125 </informaltable>
45126 <para>
45127 The string specified here is expanded and output at the start of every message.
45128 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
45129 </para>
45130 <literallayout class="monospaced">
45131 message_prefix = \
45132   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
45133   ${tod_bsdinbox}\n
45134 </literallayout>
45135 <para>
45136 <indexterm role="concept">
45137 <primary>Cyrus</primary>
45138 </indexterm>
45139 <indexterm role="concept">
45140 <primary><option>tmail</option></primary>
45141 </indexterm>
45142 <indexterm role="concept">
45143 <primary><quote>From</quote> line</primary>
45144 </indexterm>
45145 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
45146 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
45147 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
45148 setting
45149 </para>
45150 <literallayout class="monospaced">
45151 message_prefix =
45152 </literallayout>
45153 <para>
45154 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45155 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
45156 </para>
45157 <para>
45158 <indexterm role="option">
45159 <primary><option>message_suffix</option></primary>
45160 </indexterm>
45161 </para>
45162 <informaltable frame="all">
45163 <tgroup cols="4" colsep="0" rowsep="0">
45164 <colspec colwidth="8*" align="left"/>
45165 <colspec colwidth="6*" align="center"/>
45166 <colspec colwidth="6*" align="center"/>
45167 <colspec colwidth="6*" align="right"/>
45168 <tbody>
45169 <row>
45170 <entry><option>message_suffix</option></entry>
45171 <entry>Use: <emphasis>pipe</emphasis></entry>
45172 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45173 <entry>Default: <emphasis>see below</emphasis></entry>
45174 </row>
45175 </tbody>
45176 </tgroup>
45177 </informaltable>
45178 <para>
45179 The string specified here is expanded and output at the end of every message.
45180 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
45181 The suffix can be suppressed by setting
45182 </para>
45183 <literallayout class="monospaced">
45184 message_suffix =
45185 </literallayout>
45186 <para>
45187 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45188 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
45189 </para>
45190 <para>
45191 <indexterm role="option">
45192 <primary><option>path</option></primary>
45193 </indexterm>
45194 </para>
45195 <informaltable frame="all">
45196 <tgroup cols="4" colsep="0" rowsep="0">
45197 <colspec colwidth="8*" align="left"/>
45198 <colspec colwidth="6*" align="center"/>
45199 <colspec colwidth="6*" align="center"/>
45200 <colspec colwidth="6*" align="right"/>
45201 <tbody>
45202 <row>
45203 <entry><option>path</option></entry>
45204 <entry>Use: <emphasis>pipe</emphasis></entry>
45205 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45206 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
45207 </row>
45208 </tbody>
45209 </tgroup>
45210 </informaltable>
45211 <para revisionflag="changed">
45212 This option is expanded and
45213 </para>
45214 <para>
45215 specifies the string that is set up in the PATH environment
45216 variable of the subprocess.
45217 If the <option>command</option> option does not yield an absolute path name, the command is
45218 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
45219 apply to a command specified as a transport filter.
45220 </para>
45221 <para>
45222 <indexterm role="option">
45223 <primary><option>permit_coredump</option></primary>
45224 </indexterm>
45225 </para>
45226 <informaltable frame="all">
45227 <tgroup cols="4" colsep="0" rowsep="0">
45228 <colspec colwidth="8*" align="left"/>
45229 <colspec colwidth="6*" align="center"/>
45230 <colspec colwidth="6*" align="center"/>
45231 <colspec colwidth="6*" align="right"/>
45232 <tbody>
45233 <row>
45234 <entry><option>permit_coredump</option></entry>
45235 <entry>Use: <emphasis>pipe</emphasis></entry>
45236 <entry>Type: <emphasis>boolean</emphasis></entry>
45237 <entry>Default: <emphasis>false</emphasis></entry>
45238 </row>
45239 </tbody>
45240 </tgroup>
45241 </informaltable>
45242 <para>
45243 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
45244 a core-dump of a pipe command, enable this command.  This enables core-dumps
45245 during delivery and affects both the Exim binary and the pipe command run.
45246 It is recommended that this option remain off unless and until you have a need
45247 for it and that this only be enabled when needed, as the risk of excessive
45248 resource consumption can be quite high.  Note also that Exim is typically
45249 installed as a setuid binary and most operating systems will inhibit coredumps
45250 of these by default, so further OS-specific action may be required.
45251 </para>
45252 <para>
45253 <indexterm role="option">
45254 <primary><option>pipe_as_creator</option></primary>
45255 </indexterm>
45256 </para>
45257 <informaltable frame="all">
45258 <tgroup cols="4" colsep="0" rowsep="0">
45259 <colspec colwidth="8*" align="left"/>
45260 <colspec colwidth="6*" align="center"/>
45261 <colspec colwidth="6*" align="center"/>
45262 <colspec colwidth="6*" align="right"/>
45263 <tbody>
45264 <row>
45265 <entry><option>pipe_as_creator</option></entry>
45266 <entry>Use: <emphasis>pipe</emphasis></entry>
45267 <entry>Type: <emphasis>boolean</emphasis></entry>
45268 <entry>Default: <emphasis>false</emphasis></entry>
45269 </row>
45270 </tbody>
45271 </tgroup>
45272 </informaltable>
45273 <para>
45274 <indexterm role="concept">
45275 <primary>uid (user id)</primary>
45276 <secondary>local delivery</secondary>
45277 </indexterm>
45278 If the generic <option>user</option> option is not set and this option is true, the delivery
45279 process is run under the uid that was in force when Exim was originally called
45280 to accept the message. If the group id is not otherwise set (via the generic
45281 <option>group</option> option), the gid that was in force when Exim was originally called to
45282 accept the message is used.
45283 </para>
45284 <para>
45285 <indexterm role="option">
45286 <primary><option>restrict_to_path</option></primary>
45287 </indexterm>
45288 </para>
45289 <informaltable frame="all">
45290 <tgroup cols="4" colsep="0" rowsep="0">
45291 <colspec colwidth="8*" align="left"/>
45292 <colspec colwidth="6*" align="center"/>
45293 <colspec colwidth="6*" align="center"/>
45294 <colspec colwidth="6*" align="right"/>
45295 <tbody>
45296 <row>
45297 <entry><option>restrict_to_path</option></entry>
45298 <entry>Use: <emphasis>pipe</emphasis></entry>
45299 <entry>Type: <emphasis>boolean</emphasis></entry>
45300 <entry>Default: <emphasis>false</emphasis></entry>
45301 </row>
45302 </tbody>
45303 </tgroup>
45304 </informaltable>
45305 <para>
45306 When this option is set, any command name not listed in <option>allow_commands</option> must
45307 contain no slashes. The command is searched for only in the directories listed
45308 in the <option>path</option> option. This option is intended for use in the case when a pipe
45309 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
45310 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
45311 </para>
45312 <para>
45313 <indexterm role="option">
45314 <primary><option>return_fail_output</option></primary>
45315 </indexterm>
45316 </para>
45317 <informaltable frame="all">
45318 <tgroup cols="4" colsep="0" rowsep="0">
45319 <colspec colwidth="8*" align="left"/>
45320 <colspec colwidth="6*" align="center"/>
45321 <colspec colwidth="6*" align="center"/>
45322 <colspec colwidth="6*" align="right"/>
45323 <tbody>
45324 <row>
45325 <entry><option>return_fail_output</option></entry>
45326 <entry>Use: <emphasis>pipe</emphasis></entry>
45327 <entry>Type: <emphasis>boolean</emphasis></entry>
45328 <entry>Default: <emphasis>false</emphasis></entry>
45329 </row>
45330 </tbody>
45331 </tgroup>
45332 </informaltable>
45333 <para>
45334 If this option is true, and the command produced any output and ended with a
45335 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
45336 is, the delivery failed), the output is returned in the bounce message.
45337 However, if the message has a null sender (that is, it is itself a bounce
45338 message), output from the command is discarded. This option and
45339 <option>return_output</option> are mutually exclusive. Only one of them may be set.
45340 </para>
45341 <para>
45342 <indexterm role="option">
45343 <primary><option>return_output</option></primary>
45344 </indexterm>
45345 </para>
45346 <informaltable frame="all">
45347 <tgroup cols="4" colsep="0" rowsep="0">
45348 <colspec colwidth="8*" align="left"/>
45349 <colspec colwidth="6*" align="center"/>
45350 <colspec colwidth="6*" align="center"/>
45351 <colspec colwidth="6*" align="right"/>
45352 <tbody>
45353 <row>
45354 <entry><option>return_output</option></entry>
45355 <entry>Use: <emphasis>pipe</emphasis></entry>
45356 <entry>Type: <emphasis>boolean</emphasis></entry>
45357 <entry>Default: <emphasis>false</emphasis></entry>
45358 </row>
45359 </tbody>
45360 </tgroup>
45361 </informaltable>
45362 <para>
45363 If this option is true, and the command produced any output, the delivery is
45364 deemed to have failed whatever the return code from the command, and the output
45365 is returned in the bounce message. Otherwise, the output is just discarded.
45366 However, if the message has a null sender (that is, it is a bounce message),
45367 output from the command is always discarded, whatever the setting of this
45368 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
45369 of them may be set.
45370 </para>
45371 <para>
45372 <indexterm role="option">
45373 <primary><option>temp_errors</option></primary>
45374 </indexterm>
45375 </para>
45376 <informaltable frame="all">
45377 <tgroup cols="4" colsep="0" rowsep="0">
45378 <colspec colwidth="8*" align="left"/>
45379 <colspec colwidth="6*" align="center"/>
45380 <colspec colwidth="6*" align="center"/>
45381 <colspec colwidth="6*" align="right"/>
45382 <tbody>
45383 <row>
45384 <entry><option>temp_errors</option></entry>
45385 <entry>Use: <emphasis>pipe</emphasis></entry>
45386 <entry>Type: <emphasis>string list</emphasis></entry>
45387 <entry>Default: <emphasis>see below</emphasis></entry>
45388 </row>
45389 </tbody>
45390 </tgroup>
45391 </informaltable>
45392 <para>
45393 <indexterm role="concept">
45394 <primary><command>pipe</command> transport</primary>
45395 <secondary>temporary failure</secondary>
45396 </indexterm>
45397 This option contains either a colon-separated list of numbers, or a single
45398 asterisk. If <option>ignore_status</option> is false
45399 and <option>return_output</option> is not set,
45400 and the command exits with a non-zero return code, the failure is treated as
45401 temporary and the delivery is deferred if the return code matches one of the
45402 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
45403 codes are treated as permanent errors. The default setting contains the codes
45404 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
45405 compiled on a system that does not define these macros, it assumes values of 75
45406 and 73, respectively.
45407 </para>
45408 <para>
45409 <indexterm role="option">
45410 <primary><option>timeout</option></primary>
45411 </indexterm>
45412 </para>
45413 <informaltable frame="all">
45414 <tgroup cols="4" colsep="0" rowsep="0">
45415 <colspec colwidth="8*" align="left"/>
45416 <colspec colwidth="6*" align="center"/>
45417 <colspec colwidth="6*" align="center"/>
45418 <colspec colwidth="6*" align="right"/>
45419 <tbody>
45420 <row>
45421 <entry><option>timeout</option></entry>
45422 <entry>Use: <emphasis>pipe</emphasis></entry>
45423 <entry>Type: <emphasis>time</emphasis></entry>
45424 <entry>Default: <emphasis>1h</emphasis></entry>
45425 </row>
45426 </tbody>
45427 </tgroup>
45428 </informaltable>
45429 <para>
45430 If the command fails to complete within this time, it is killed. This normally
45431 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
45432 specifies no timeout. In order to ensure that any subprocesses created by the
45433 command are also killed, Exim makes the initial process a process group leader,
45434 and kills the whole process group on a timeout. However, this can be defeated
45435 if one of the processes starts a new process group.
45436 </para>
45437 <para>
45438 <indexterm role="option">
45439 <primary><option>timeout_defer</option></primary>
45440 </indexterm>
45441 </para>
45442 <informaltable frame="all">
45443 <tgroup cols="4" colsep="0" rowsep="0">
45444 <colspec colwidth="8*" align="left"/>
45445 <colspec colwidth="6*" align="center"/>
45446 <colspec colwidth="6*" align="center"/>
45447 <colspec colwidth="6*" align="right"/>
45448 <tbody>
45449 <row>
45450 <entry><option>timeout_defer</option></entry>
45451 <entry>Use: <emphasis>pipe</emphasis></entry>
45452 <entry>Type: <emphasis>boolean</emphasis></entry>
45453 <entry>Default: <emphasis>false</emphasis></entry>
45454 </row>
45455 </tbody>
45456 </tgroup>
45457 </informaltable>
45458 <para>
45459 A timeout in a <command>pipe</command> transport, either in the command that the transport
45460 runs, or in a transport filter that is associated with it, is by default
45461 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
45462 is set true, both kinds of timeout become temporary errors, causing the
45463 delivery to be deferred.
45464 </para>
45465 <para>
45466 <indexterm role="option">
45467 <primary><option>umask</option></primary>
45468 </indexterm>
45469 </para>
45470 <informaltable frame="all">
45471 <tgroup cols="4" colsep="0" rowsep="0">
45472 <colspec colwidth="8*" align="left"/>
45473 <colspec colwidth="6*" align="center"/>
45474 <colspec colwidth="6*" align="center"/>
45475 <colspec colwidth="6*" align="right"/>
45476 <tbody>
45477 <row>
45478 <entry><option>umask</option></entry>
45479 <entry>Use: <emphasis>pipe</emphasis></entry>
45480 <entry>Type: <emphasis>octal integer</emphasis></entry>
45481 <entry>Default: <emphasis>022</emphasis></entry>
45482 </row>
45483 </tbody>
45484 </tgroup>
45485 </informaltable>
45486 <para>
45487 This specifies the umask setting for the subprocess that runs the command.
45488 </para>
45489 <para>
45490 <indexterm role="option">
45491 <primary><option>use_bsmtp</option></primary>
45492 </indexterm>
45493 </para>
45494 <informaltable frame="all">
45495 <tgroup cols="4" colsep="0" rowsep="0">
45496 <colspec colwidth="8*" align="left"/>
45497 <colspec colwidth="6*" align="center"/>
45498 <colspec colwidth="6*" align="center"/>
45499 <colspec colwidth="6*" align="right"/>
45500 <tbody>
45501 <row>
45502 <entry><option>use_bsmtp</option></entry>
45503 <entry>Use: <emphasis>pipe</emphasis></entry>
45504 <entry>Type: <emphasis>boolean</emphasis></entry>
45505 <entry>Default: <emphasis>false</emphasis></entry>
45506 </row>
45507 </tbody>
45508 </tgroup>
45509 </informaltable>
45510 <para>
45511 <indexterm role="concept">
45512 <primary>envelope sender</primary>
45513 </indexterm>
45514 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
45515 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
45516 commands. If you want to include a leading HELO command with such messages,
45517 you can do so by setting the <option>message_prefix</option> option. See section
45518 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
45519 </para>
45520 <para>
45521 <indexterm role="option">
45522 <primary><option>use_classresources</option></primary>
45523 </indexterm>
45524 </para>
45525 <informaltable frame="all">
45526 <tgroup cols="4" colsep="0" rowsep="0">
45527 <colspec colwidth="8*" align="left"/>
45528 <colspec colwidth="6*" align="center"/>
45529 <colspec colwidth="6*" align="center"/>
45530 <colspec colwidth="6*" align="right"/>
45531 <tbody>
45532 <row>
45533 <entry><option>use_classresources</option></entry>
45534 <entry>Use: <emphasis>pipe</emphasis></entry>
45535 <entry>Type: <emphasis>boolean</emphasis></entry>
45536 <entry>Default: <emphasis>false</emphasis></entry>
45537 </row>
45538 </tbody>
45539 </tgroup>
45540 </informaltable>
45541 <para>
45542 <indexterm role="concept">
45543 <primary>class resources (BSD)</primary>
45544 </indexterm>
45545 This option is available only when Exim is running on FreeBSD, NetBSD, or
45546 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
45547 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
45548 limits for the uid under which the pipe is to run are obtained from the login
45549 class database.
45550 </para>
45551 <para>
45552 <indexterm role="option">
45553 <primary><option>use_crlf</option></primary>
45554 </indexterm>
45555 </para>
45556 <informaltable frame="all">
45557 <tgroup cols="4" colsep="0" rowsep="0">
45558 <colspec colwidth="8*" align="left"/>
45559 <colspec colwidth="6*" align="center"/>
45560 <colspec colwidth="6*" align="center"/>
45561 <colspec colwidth="6*" align="right"/>
45562 <tbody>
45563 <row>
45564 <entry><option>use_crlf</option></entry>
45565 <entry>Use: <emphasis>pipe</emphasis></entry>
45566 <entry>Type: <emphasis>boolean</emphasis></entry>
45567 <entry>Default: <emphasis>false</emphasis></entry>
45568 </row>
45569 </tbody>
45570 </tgroup>
45571 </informaltable>
45572 <para>
45573 <indexterm role="concept">
45574 <primary>carriage return</primary>
45575 </indexterm>
45576 <indexterm role="concept">
45577 <primary>linefeed</primary>
45578 </indexterm>
45579 This option causes lines to be terminated with the two-character CRLF sequence
45580 (carriage return, linefeed) instead of just a linefeed character. In the case
45581 of batched SMTP, the byte sequence written to the pipe is then an exact image
45582 of what would be sent down a real SMTP connection.
45583 </para>
45584 <para>
45585 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
45586 written verbatim, so must contain their own carriage return characters if these
45587 are needed. When <option>use_bsmtp</option> is not set, the default values for both
45588 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
45589 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
45590 </para>
45591 <para>
45592 <indexterm role="option">
45593 <primary><option>use_shell</option></primary>
45594 </indexterm>
45595 </para>
45596 <informaltable frame="all">
45597 <tgroup cols="4" colsep="0" rowsep="0">
45598 <colspec colwidth="8*" align="left"/>
45599 <colspec colwidth="6*" align="center"/>
45600 <colspec colwidth="6*" align="center"/>
45601 <colspec colwidth="6*" align="right"/>
45602 <tbody>
45603 <row>
45604 <entry><option>use_shell</option></entry>
45605 <entry>Use: <emphasis>pipe</emphasis></entry>
45606 <entry>Type: <emphasis>boolean</emphasis></entry>
45607 <entry>Default: <emphasis>false</emphasis></entry>
45608 </row>
45609 </tbody>
45610 </tgroup>
45611 </informaltable>
45612 <para>
45613 <indexterm role="variable">
45614 <primary><varname>$pipe_addresses</varname></primary>
45615 </indexterm>
45616 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
45617 instead of being run directly from the transport, as described in section
45618 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
45619 where the command is expected to be run under a shell and cannot easily be
45620 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
45621 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
45622 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
45623 its <option>-c</option> option.
45624 </para>
45625 </section>
45626 <section id="SECID143">
45627 <title>Using an external local delivery agent</title>
45628 <para>
45629 <indexterm role="concept">
45630 <primary>local delivery</primary>
45631 <secondary>using an external agent</secondary>
45632 </indexterm>
45633 <indexterm role="concept">
45634 <primary><emphasis>procmail</emphasis></primary>
45635 </indexterm>
45636 <indexterm role="concept">
45637 <primary>external local delivery</primary>
45638 </indexterm>
45639 <indexterm role="concept">
45640 <primary>delivery</primary>
45641 <secondary><emphasis>procmail</emphasis></secondary>
45642 </indexterm>
45643 <indexterm role="concept">
45644 <primary>delivery</primary>
45645 <secondary>by external agent</secondary>
45646 </indexterm>
45647 The <command>pipe</command> transport can be used to pass all messages that require local
45648 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
45649 this, care must be taken to ensure that the pipe is run under an appropriate
45650 uid and gid. In some configurations one wants this to be a uid that is trusted
45651 by the delivery agent to supply the correct sender of the message. It may be
45652 necessary to recompile or reconfigure the delivery agent so that it trusts an
45653 appropriate user. The following is an example transport and router
45654 configuration for <option>procmail</option>:
45655 </para>
45656 <literallayout class="monospaced">
45657 # transport
45658 procmail_pipe:
45659   driver = pipe
45660   command = /usr/local/bin/procmail -d $local_part
45661   return_path_add
45662   delivery_date_add
45663   envelope_to_add
45664   check_string = "From "
45665   escape_string = "&gt;From "
45666   umask = 077
45667   user = $local_part
45668   group = mail
45669
45670 # router
45671 procmail:
45672   driver = accept
45673   check_local_user
45674   transport = procmail_pipe
45675 </literallayout>
45676 <para>
45677 In this example, the pipe is run as the local user, but with the group set to
45678 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
45679 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
45680 user to supply a correct sender address. If you do not specify either a
45681 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
45682 home directory is the user&#x2019;s home directory by default.
45683 </para>
45684 <para>
45685 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
45686 </para>
45687 <literallayout class="monospaced">
45688 IFS=" "
45689 </literallayout>
45690 <para>
45691 as shown in some <option>procmail</option> documentation, because Exim does not by default
45692 use a shell to run pipe commands.
45693 </para>
45694 <para>
45695 <indexterm role="concept">
45696 <primary>Cyrus</primary>
45697 </indexterm>
45698 The next example shows a transport and a router for a system where local
45699 deliveries are handled by the Cyrus IMAP server.
45700 </para>
45701 <literallayout class="monospaced">
45702 # transport
45703 local_delivery_cyrus:
45704   driver = pipe
45705   command = /usr/cyrus/bin/deliver \
45706             -m ${substr_1:$local_part_suffix} -- $local_part
45707   user = cyrus
45708   group = mail
45709   return_output
45710   log_output
45711   message_prefix =
45712   message_suffix =
45713
45714 # router
45715 local_user_cyrus:
45716   driver = accept
45717   check_local_user
45718   local_part_suffix = .*
45719   transport = local_delivery_cyrus
45720 </literallayout>
45721 <para>
45722 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
45723 <option>return_output</option> to cause any text written by Cyrus to be returned to the
45724 sender.
45725 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
45726 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
45727 </para>
45728 </section>
45729 </chapter>
45730
45731 <chapter id="CHAPsmtptrans">
45732 <title>The smtp transport</title>
45733 <para>
45734 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
45735 <primary>transports</primary>
45736 <secondary><command>smtp</command></secondary>
45737 </indexterm>
45738 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
45739 <primary><command>smtp</command> transport</primary>
45740 </indexterm>
45741 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
45742 or LMTP protocol. The list of hosts to try can either be taken from the address
45743 that is being processed (having been set up by the router), or specified
45744 explicitly for the transport. Timeout and retry processing (see chapter
45745 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
45746 </para>
45747 <section id="SECID144">
45748 <title>Multiple messages on a single connection</title>
45749 <para>
45750 The sending of multiple messages over a single TCP/IP connection can arise in
45751 two ways:
45752 </para>
45753 <itemizedlist>
45754 <listitem>
45755 <para>
45756 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
45757 routed to the same host, more than one copy of the message has to be sent to
45758 that host. In this situation, multiple copies may be sent in a single run of
45759 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
45760 does when it has too many addresses to send in one message also depends on the
45761 value of the global <option>remote_max_parallel</option> option. Details are given in
45762 section <xref linkend="SECToutSMTPTCP"/>.)
45763 </para>
45764 </listitem>
45765 <listitem>
45766 <para>
45767 <indexterm role="concept">
45768 <primary>hints database</primary>
45769 <secondary>remembering routing</secondary>
45770 </indexterm>
45771 When a message has been successfully delivered over a TCP/IP connection, Exim
45772 looks in its hints database to see if there are any other messages awaiting a
45773 connection to the same host. If there are, a new delivery process is started
45774 for one of them, and the current TCP/IP connection is passed on to it. The new
45775 process may in turn send multiple copies and possibly create yet another
45776 process.
45777 </para>
45778 </listitem>
45779 </itemizedlist>
45780 <para>
45781 For each copy sent over the same TCP/IP connection, a sequence counter is
45782 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
45783 no further messages are sent over that connection.
45784 </para>
45785 </section>
45786 <section id="SECID145">
45787 <title>Use of the $host and $host_address variables</title>
45788 <para>
45789 <indexterm role="variable">
45790 <primary><varname>$host</varname></primary>
45791 </indexterm>
45792 <indexterm role="variable">
45793 <primary><varname>$host_address</varname></primary>
45794 </indexterm>
45795 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
45796 <varname>$host_address</varname> are the name and IP address of the first host on the host list
45797 passed by the router. However, when the transport is about to connect to a
45798 specific host, and while it is connected to that host, <varname>$host</varname> and
45799 <varname>$host_address</varname> are set to the values for that host. These are the values
45800 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
45801 <option>serialize_hosts</option>, and the various TLS options are expanded.
45802 </para>
45803 </section>
45804 <section id="usecippeer">
45805 <title>Use of $tls_cipher and $tls_peerdn</title>
45806 <para>
45807 <indexterm role="variable">
45808 <primary><varname>$tls_bits</varname></primary>
45809 </indexterm>
45810 <indexterm role="variable">
45811 <primary><varname>$tls_cipher</varname></primary>
45812 </indexterm>
45813 <indexterm role="variable">
45814 <primary><varname>$tls_peerdn</varname></primary>
45815 </indexterm>
45816 <indexterm role="variable">
45817 <primary><varname>$tls_sni</varname></primary>
45818 </indexterm>
45819 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
45820 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
45821 are the values that were set when the message was received.
45822 These are the values that are used for options that are expanded before any
45823 SMTP connections are made. Just before each connection is made, these four
45824 variables are emptied. If TLS is subsequently started, they are set to the
45825 appropriate values for the outgoing connection, and these are the values that
45826 are in force when any authenticators are run and when the
45827 <option>authenticated_sender</option> option is expanded.
45828 </para>
45829 <para>
45830 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
45831 and will be removed in a future release.
45832 </para>
45833 </section>
45834 <section id="SECID146">
45835 <title>Private options for smtp</title>
45836 <para>
45837 <indexterm role="concept">
45838 <primary>options</primary>
45839 <secondary><command>smtp</command> transport</secondary>
45840 </indexterm>
45841 The private options of the <command>smtp</command> transport are as follows:
45842 </para>
45843 <para>
45844 <indexterm role="option">
45845 <primary><option>address_retry_include_sender</option></primary>
45846 </indexterm>
45847 </para>
45848 <informaltable frame="all">
45849 <tgroup cols="4" colsep="0" rowsep="0">
45850 <colspec colwidth="8*" align="left"/>
45851 <colspec colwidth="6*" align="center"/>
45852 <colspec colwidth="6*" align="center"/>
45853 <colspec colwidth="6*" align="right"/>
45854 <tbody>
45855 <row>
45856 <entry><option>address_retry_include_sender</option></entry>
45857 <entry>Use: <emphasis>smtp</emphasis></entry>
45858 <entry>Type: <emphasis>boolean</emphasis></entry>
45859 <entry>Default: <emphasis>true</emphasis></entry>
45860 </row>
45861 </tbody>
45862 </tgroup>
45863 </informaltable>
45864 <para>
45865 <indexterm role="concept">
45866 <primary>4<emphasis>xx</emphasis> responses</primary>
45867 <secondary>retrying after</secondary>
45868 </indexterm>
45869 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
45870 is the combination of sender and recipient that is delayed in subsequent queue
45871 runs until the retry time is reached. You can delay the recipient without
45872 reference to the sender (which is what earlier versions of Exim did), by
45873 setting <option>address_retry_include_sender</option> false. However, this can lead to
45874 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
45875 </para>
45876 <para>
45877 <indexterm role="option">
45878 <primary><option>allow_localhost</option></primary>
45879 </indexterm>
45880 </para>
45881 <informaltable frame="all">
45882 <tgroup cols="4" colsep="0" rowsep="0">
45883 <colspec colwidth="8*" align="left"/>
45884 <colspec colwidth="6*" align="center"/>
45885 <colspec colwidth="6*" align="center"/>
45886 <colspec colwidth="6*" align="right"/>
45887 <tbody>
45888 <row>
45889 <entry><option>allow_localhost</option></entry>
45890 <entry>Use: <emphasis>smtp</emphasis></entry>
45891 <entry>Type: <emphasis>boolean</emphasis></entry>
45892 <entry>Default: <emphasis>false</emphasis></entry>
45893 </row>
45894 </tbody>
45895 </tgroup>
45896 </informaltable>
45897 <para>
45898 <indexterm role="concept">
45899 <primary>local host</primary>
45900 <secondary>sending to</secondary>
45901 </indexterm>
45902 <indexterm role="concept">
45903 <primary>fallback</primary>
45904 <secondary>hosts specified on transport</secondary>
45905 </indexterm>
45906 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
45907 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
45908 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
45909 the delivery anyway. This should be used only in special cases when the
45910 configuration ensures that no looping will result (for example, a differently
45911 configured Exim is listening on the port to which the message is sent).
45912 </para>
45913 <para>
45914 <indexterm role="option">
45915 <primary><option>authenticated_sender</option></primary>
45916 </indexterm>
45917 </para>
45918 <informaltable frame="all">
45919 <tgroup cols="4" colsep="0" rowsep="0">
45920 <colspec colwidth="8*" align="left"/>
45921 <colspec colwidth="6*" align="center"/>
45922 <colspec colwidth="6*" align="center"/>
45923 <colspec colwidth="6*" align="right"/>
45924 <tbody>
45925 <row>
45926 <entry><option>authenticated_sender</option></entry>
45927 <entry>Use: <emphasis>smtp</emphasis></entry>
45928 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45929 <entry>Default: <emphasis>unset</emphasis></entry>
45930 </row>
45931 </tbody>
45932 </tgroup>
45933 </informaltable>
45934 <para>
45935 <indexterm role="concept">
45936 <primary>Cyrus</primary>
45937 </indexterm>
45938 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
45939 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
45940 overriding any existing authenticated sender value. If the string expansion is
45941 forced to fail, the option is ignored. Other expansion failures cause delivery
45942 to be deferred. If the result of expansion is an empty string, that is also
45943 ignored.
45944 </para>
45945 <para>
45946 The expansion happens after the outgoing connection has been made and TLS
45947 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
45948 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
45949 particular connection.
45950 </para>
45951 <para>
45952 If the SMTP session is not authenticated, the expansion of
45953 <option>authenticated_sender</option> still happens (and can cause the delivery to be
45954 deferred if it fails), but no AUTH= item is added to MAIL commands
45955 unless <option>authenticated_sender_force</option> is true.
45956 </para>
45957 <para>
45958 This option allows you to use the <command>smtp</command> transport in LMTP mode to
45959 deliver mail to Cyrus IMAP and provide the proper local part as the
45960 <quote>authenticated sender</quote>, via a setting such as:
45961 </para>
45962 <literallayout class="monospaced">
45963 authenticated_sender = $local_part
45964 </literallayout>
45965 <para>
45966 This removes the need for IMAP subfolders to be assigned special ACLs to
45967 allow direct delivery to those subfolders.
45968 </para>
45969 <para>
45970 Because of expected uses such as that just described for Cyrus (when no
45971 domain is involved), there is no checking on the syntax of the provided
45972 value.
45973 </para>
45974 <para>
45975 <indexterm role="option">
45976 <primary><option>authenticated_sender_force</option></primary>
45977 </indexterm>
45978 </para>
45979 <informaltable frame="all">
45980 <tgroup cols="4" colsep="0" rowsep="0">
45981 <colspec colwidth="8*" align="left"/>
45982 <colspec colwidth="6*" align="center"/>
45983 <colspec colwidth="6*" align="center"/>
45984 <colspec colwidth="6*" align="right"/>
45985 <tbody>
45986 <row>
45987 <entry><option>authenticated_sender_force</option></entry>
45988 <entry>Use: <emphasis>smtp</emphasis></entry>
45989 <entry>Type: <emphasis>boolean</emphasis></entry>
45990 <entry>Default: <emphasis>false</emphasis></entry>
45991 </row>
45992 </tbody>
45993 </tgroup>
45994 </informaltable>
45995 <para>
45996 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
45997 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
45998 authenticated as a client.
45999 </para>
46000 <para>
46001 <indexterm role="option">
46002 <primary><option>command_timeout</option></primary>
46003 </indexterm>
46004 </para>
46005 <informaltable frame="all">
46006 <tgroup cols="4" colsep="0" rowsep="0">
46007 <colspec colwidth="8*" align="left"/>
46008 <colspec colwidth="6*" align="center"/>
46009 <colspec colwidth="6*" align="center"/>
46010 <colspec colwidth="6*" align="right"/>
46011 <tbody>
46012 <row>
46013 <entry><option>command_timeout</option></entry>
46014 <entry>Use: <emphasis>smtp</emphasis></entry>
46015 <entry>Type: <emphasis>time</emphasis></entry>
46016 <entry>Default: <emphasis>5m</emphasis></entry>
46017 </row>
46018 </tbody>
46019 </tgroup>
46020 </informaltable>
46021 <para>
46022 This sets a timeout for receiving a response to an SMTP command that has been
46023 sent out. It is also used when waiting for the initial banner line from the
46024 remote host. Its value must not be zero.
46025 </para>
46026 <para>
46027 <indexterm role="option">
46028 <primary><option>connect_timeout</option></primary>
46029 </indexterm>
46030 </para>
46031 <informaltable frame="all">
46032 <tgroup cols="4" colsep="0" rowsep="0">
46033 <colspec colwidth="8*" align="left"/>
46034 <colspec colwidth="6*" align="center"/>
46035 <colspec colwidth="6*" align="center"/>
46036 <colspec colwidth="6*" align="right"/>
46037 <tbody>
46038 <row>
46039 <entry><option>connect_timeout</option></entry>
46040 <entry>Use: <emphasis>smtp</emphasis></entry>
46041 <entry>Type: <emphasis>time</emphasis></entry>
46042 <entry>Default: <emphasis>5m</emphasis></entry>
46043 </row>
46044 </tbody>
46045 </tgroup>
46046 </informaltable>
46047 <para>
46048 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
46049 to a remote host. A setting of zero allows the system timeout (typically
46050 several minutes) to act. To have any effect, the value of this option must be
46051 less than the system timeout. However, it has been observed that on some
46052 systems there is no system timeout, which is why the default value for this
46053 option is 5 minutes, a value recommended by RFC 1123.
46054 </para>
46055 <para>
46056 <indexterm role="option">
46057 <primary><option>connection_max_messages</option></primary>
46058 </indexterm>
46059 </para>
46060 <informaltable frame="all">
46061 <tgroup cols="4" colsep="0" rowsep="0">
46062 <colspec colwidth="8*" align="left"/>
46063 <colspec colwidth="6*" align="center"/>
46064 <colspec colwidth="6*" align="center"/>
46065 <colspec colwidth="6*" align="right"/>
46066 <tbody>
46067 <row>
46068 <entry><option>connection_max_messages</option></entry>
46069 <entry>Use: <emphasis>smtp</emphasis></entry>
46070 <entry>Type: <emphasis>integer</emphasis></entry>
46071 <entry>Default: <emphasis>500</emphasis></entry>
46072 </row>
46073 </tbody>
46074 </tgroup>
46075 </informaltable>
46076 <para>
46077 <indexterm role="concept">
46078 <primary>SMTP</primary>
46079 <secondary>passed connection</secondary>
46080 </indexterm>
46081 <indexterm role="concept">
46082 <primary>SMTP</primary>
46083 <secondary>multiple deliveries</secondary>
46084 </indexterm>
46085 <indexterm role="concept">
46086 <primary>multiple SMTP deliveries</primary>
46087 </indexterm>
46088 This controls the maximum number of separate message deliveries that are sent
46089 over a single TCP/IP connection. If the value is zero, there is no limit.
46090 For testing purposes, this value can be overridden by the <option>-oB</option> command line
46091 option.
46092 </para>
46093 <para>
46094 <indexterm role="option">
46095 <primary><option>data_timeout</option></primary>
46096 </indexterm>
46097 </para>
46098 <informaltable frame="all">
46099 <tgroup cols="4" colsep="0" rowsep="0">
46100 <colspec colwidth="8*" align="left"/>
46101 <colspec colwidth="6*" align="center"/>
46102 <colspec colwidth="6*" align="center"/>
46103 <colspec colwidth="6*" align="right"/>
46104 <tbody>
46105 <row>
46106 <entry><option>data_timeout</option></entry>
46107 <entry>Use: <emphasis>smtp</emphasis></entry>
46108 <entry>Type: <emphasis>time</emphasis></entry>
46109 <entry>Default: <emphasis>5m</emphasis></entry>
46110 </row>
46111 </tbody>
46112 </tgroup>
46113 </informaltable>
46114 <para>
46115 This sets a timeout for the transmission of each block in the data portion of
46116 the message. As a result, the overall timeout for a message depends on the size
46117 of the message. Its value must not be zero. See also <option>final_timeout</option>.
46118 </para>
46119 <para>
46120 <indexterm role="option">
46121 <primary><option>dkim_domain</option></primary>
46122 </indexterm>
46123 </para>
46124 <informaltable frame="all">
46125 <tgroup cols="4" colsep="0" rowsep="0">
46126 <colspec colwidth="8*" align="left"/>
46127 <colspec colwidth="6*" align="center"/>
46128 <colspec colwidth="6*" align="center"/>
46129 <colspec colwidth="6*" align="right"/>
46130 <tbody>
46131 <row>
46132 <entry><option>dkim_domain</option></entry>
46133 <entry>Use: <emphasis>smtp</emphasis></entry>
46134 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46135 <entry>Default: <emphasis>unset</emphasis></entry>
46136 </row>
46137 </tbody>
46138 </tgroup>
46139 </informaltable>
46140 <para>
46141 <indexterm role="option">
46142 <primary><option>dkim_selector</option></primary>
46143 </indexterm>
46144 </para>
46145 <informaltable frame="all">
46146 <tgroup cols="4" colsep="0" rowsep="0">
46147 <colspec colwidth="8*" align="left"/>
46148 <colspec colwidth="6*" align="center"/>
46149 <colspec colwidth="6*" align="center"/>
46150 <colspec colwidth="6*" align="right"/>
46151 <tbody>
46152 <row>
46153 <entry><option>dkim_selector</option></entry>
46154 <entry>Use: <emphasis>smtp</emphasis></entry>
46155 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46156 <entry>Default: <emphasis>unset</emphasis></entry>
46157 </row>
46158 </tbody>
46159 </tgroup>
46160 </informaltable>
46161 <para>
46162 <indexterm role="option">
46163 <primary><option>dkim_private_key</option></primary>
46164 </indexterm>
46165 </para>
46166 <informaltable frame="all">
46167 <tgroup cols="4" colsep="0" rowsep="0">
46168 <colspec colwidth="8*" align="left"/>
46169 <colspec colwidth="6*" align="center"/>
46170 <colspec colwidth="6*" align="center"/>
46171 <colspec colwidth="6*" align="right"/>
46172 <tbody>
46173 <row>
46174 <entry><option>dkim_private_key</option></entry>
46175 <entry>Use: <emphasis>smtp</emphasis></entry>
46176 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46177 <entry>Default: <emphasis>unset</emphasis></entry>
46178 </row>
46179 </tbody>
46180 </tgroup>
46181 </informaltable>
46182 <para>
46183 <indexterm role="option">
46184 <primary><option>dkim_canon</option></primary>
46185 </indexterm>
46186 </para>
46187 <informaltable frame="all">
46188 <tgroup cols="4" colsep="0" rowsep="0">
46189 <colspec colwidth="8*" align="left"/>
46190 <colspec colwidth="6*" align="center"/>
46191 <colspec colwidth="6*" align="center"/>
46192 <colspec colwidth="6*" align="right"/>
46193 <tbody>
46194 <row>
46195 <entry><option>dkim_canon</option></entry>
46196 <entry>Use: <emphasis>smtp</emphasis></entry>
46197 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46198 <entry>Default: <emphasis>unset</emphasis></entry>
46199 </row>
46200 </tbody>
46201 </tgroup>
46202 </informaltable>
46203 <para>
46204 <indexterm role="option">
46205 <primary><option>dkim_strict</option></primary>
46206 </indexterm>
46207 </para>
46208 <informaltable frame="all">
46209 <tgroup cols="4" colsep="0" rowsep="0">
46210 <colspec colwidth="8*" align="left"/>
46211 <colspec colwidth="6*" align="center"/>
46212 <colspec colwidth="6*" align="center"/>
46213 <colspec colwidth="6*" align="right"/>
46214 <tbody>
46215 <row>
46216 <entry><option>dkim_strict</option></entry>
46217 <entry>Use: <emphasis>smtp</emphasis></entry>
46218 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46219 <entry>Default: <emphasis>unset</emphasis></entry>
46220 </row>
46221 </tbody>
46222 </tgroup>
46223 </informaltable>
46224 <para>
46225 <indexterm role="option">
46226 <primary><option>dkim_sign_headers</option></primary>
46227 </indexterm>
46228 </para>
46229 <informaltable frame="all">
46230 <tgroup cols="4" colsep="0" rowsep="0">
46231 <colspec colwidth="8*" align="left"/>
46232 <colspec colwidth="6*" align="center"/>
46233 <colspec colwidth="6*" align="center"/>
46234 <colspec colwidth="6*" align="right"/>
46235 <tbody>
46236 <row>
46237 <entry><option>dkim_sign_headers</option></entry>
46238 <entry>Use: <emphasis>smtp</emphasis></entry>
46239 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46240 <entry>Default: <emphasis>unset</emphasis></entry>
46241 </row>
46242 </tbody>
46243 </tgroup>
46244 </informaltable>
46245 <para>
46246 DKIM signing options.  For details see section <xref linkend="SECDKIMSIGN"/>.
46247 </para>
46248 <para>
46249 <indexterm role="option">
46250 <primary><option>delay_after_cutoff</option></primary>
46251 </indexterm>
46252 </para>
46253 <informaltable frame="all">
46254 <tgroup cols="4" colsep="0" rowsep="0">
46255 <colspec colwidth="8*" align="left"/>
46256 <colspec colwidth="6*" align="center"/>
46257 <colspec colwidth="6*" align="center"/>
46258 <colspec colwidth="6*" align="right"/>
46259 <tbody>
46260 <row>
46261 <entry><option>delay_after_cutoff</option></entry>
46262 <entry>Use: <emphasis>smtp</emphasis></entry>
46263 <entry>Type: <emphasis>boolean</emphasis></entry>
46264 <entry>Default: <emphasis>true</emphasis></entry>
46265 </row>
46266 </tbody>
46267 </tgroup>
46268 </informaltable>
46269 <para>
46270 This option controls what happens when all remote IP addresses for a given
46271 domain have been inaccessible for so long that they have passed their retry
46272 cutoff times.
46273 </para>
46274 <para>
46275 In the default state, if the next retry time has not been reached for any of
46276 them, the address is bounced without trying any deliveries. In other words,
46277 Exim delays retrying an IP address after the final cutoff time until a new
46278 retry time is reached, and can therefore bounce an address without ever trying
46279 a delivery, when machines have been down for a long time. Some people are
46280 unhappy at this prospect, so...
46281 </para>
46282 <para>
46283 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
46284 addresses are past their final cutoff time, Exim tries to deliver to those
46285 IP addresses that have not been tried since the message arrived. If there are
46286 none, of if they all fail, the address is bounced. In other words, it does not
46287 delay when a new message arrives, but immediately tries those expired IP
46288 addresses that haven&#x2019;t been tried since the message arrived. If there is a
46289 continuous stream of messages for the dead hosts, unsetting
46290 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
46291 to them.
46292 </para>
46293 <para>
46294 <indexterm role="option">
46295 <primary><option>dns_qualify_single</option></primary>
46296 </indexterm>
46297 </para>
46298 <informaltable frame="all">
46299 <tgroup cols="4" colsep="0" rowsep="0">
46300 <colspec colwidth="8*" align="left"/>
46301 <colspec colwidth="6*" align="center"/>
46302 <colspec colwidth="6*" align="center"/>
46303 <colspec colwidth="6*" align="right"/>
46304 <tbody>
46305 <row>
46306 <entry><option>dns_qualify_single</option></entry>
46307 <entry>Use: <emphasis>smtp</emphasis></entry>
46308 <entry>Type: <emphasis>boolean</emphasis></entry>
46309 <entry>Default: <emphasis>true</emphasis></entry>
46310 </row>
46311 </tbody>
46312 </tgroup>
46313 </informaltable>
46314 <para>
46315 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
46316 and the <option>gethostbyname</option> option is false,
46317 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
46318 in chapter <xref linkend="CHAPdnslookup"/> for more details.
46319 </para>
46320 <para>
46321 <indexterm role="option">
46322 <primary><option>dns_search_parents</option></primary>
46323 </indexterm>
46324 </para>
46325 <informaltable frame="all">
46326 <tgroup cols="4" colsep="0" rowsep="0">
46327 <colspec colwidth="8*" align="left"/>
46328 <colspec colwidth="6*" align="center"/>
46329 <colspec colwidth="6*" align="center"/>
46330 <colspec colwidth="6*" align="right"/>
46331 <tbody>
46332 <row>
46333 <entry><option>dns_search_parents</option></entry>
46334 <entry>Use: <emphasis>smtp</emphasis></entry>
46335 <entry>Type: <emphasis>boolean</emphasis></entry>
46336 <entry>Default: <emphasis>false</emphasis></entry>
46337 </row>
46338 </tbody>
46339 </tgroup>
46340 </informaltable>
46341 <para>
46342 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
46343 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
46344 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
46345 details.
46346 </para>
46347 <para>
46348 <indexterm role="option">
46349 <primary><option>dnssec_request_domains</option></primary>
46350 </indexterm>
46351 </para>
46352 <informaltable frame="all">
46353 <tgroup cols="4" colsep="0" rowsep="0">
46354 <colspec colwidth="8*" align="left"/>
46355 <colspec colwidth="6*" align="center"/>
46356 <colspec colwidth="6*" align="center"/>
46357 <colspec colwidth="6*" align="right"/>
46358 <tbody>
46359 <row>
46360 <entry><option>dnssec_request_domains</option></entry>
46361 <entry>Use: <emphasis>smtp</emphasis></entry>
46362 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
46363 <entry>Default: <emphasis>unset</emphasis></entry>
46364 </row>
46365 </tbody>
46366 </tgroup>
46367 </informaltable>
46368 <para>
46369 <indexterm role="concept">
46370 <primary>MX record</primary>
46371 <secondary>security</secondary>
46372 </indexterm>
46373 <indexterm role="concept">
46374 <primary>DNSSEC</primary>
46375 <secondary>MX lookup</secondary>
46376 </indexterm>
46377 <indexterm role="concept">
46378 <primary>security</primary>
46379 <secondary>MX lookup</secondary>
46380 </indexterm>
46381 <indexterm role="concept">
46382 <primary>DNS</primary>
46383 <secondary>DNSSEC</secondary>
46384 </indexterm>
46385 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
46386 the dnssec request bit set.
46387 This applies to all of the SRV, MX, AAAA, A lookup sequence.
46388 </para>
46389 <para>
46390 <indexterm role="option">
46391 <primary><option>dnssec_require_domains</option></primary>
46392 </indexterm>
46393 </para>
46394 <informaltable frame="all">
46395 <tgroup cols="4" colsep="0" rowsep="0">
46396 <colspec colwidth="8*" align="left"/>
46397 <colspec colwidth="6*" align="center"/>
46398 <colspec colwidth="6*" align="center"/>
46399 <colspec colwidth="6*" align="right"/>
46400 <tbody>
46401 <row>
46402 <entry><option>dnssec_require_domains</option></entry>
46403 <entry>Use: <emphasis>smtp</emphasis></entry>
46404 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
46405 <entry>Default: <emphasis>unset</emphasis></entry>
46406 </row>
46407 </tbody>
46408 </tgroup>
46409 </informaltable>
46410 <para>
46411 <indexterm role="concept">
46412 <primary>MX record</primary>
46413 <secondary>security</secondary>
46414 </indexterm>
46415 <indexterm role="concept">
46416 <primary>DNSSEC</primary>
46417 <secondary>MX lookup</secondary>
46418 </indexterm>
46419 <indexterm role="concept">
46420 <primary>security</primary>
46421 <secondary>MX lookup</secondary>
46422 </indexterm>
46423 <indexterm role="concept">
46424 <primary>DNS</primary>
46425 <secondary>DNSSEC</secondary>
46426 </indexterm>
46427 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
46428 the dnssec request bit set.  Any returns not having the Authenticated Data bit
46429 (AD bit) set will be ignored and logged as a host-lookup failure.
46430 This applies to all of the SRV, MX, AAAA, A lookup sequence.
46431 </para>
46432 <para>
46433 <indexterm role="option">
46434 <primary><option>dscp</option></primary>
46435 </indexterm>
46436 </para>
46437 <informaltable frame="all">
46438 <tgroup cols="4" colsep="0" rowsep="0">
46439 <colspec colwidth="8*" align="left"/>
46440 <colspec colwidth="6*" align="center"/>
46441 <colspec colwidth="6*" align="center"/>
46442 <colspec colwidth="6*" align="right"/>
46443 <tbody>
46444 <row>
46445 <entry><option>dscp</option></entry>
46446 <entry>Use: <emphasis>smtp</emphasis></entry>
46447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46448 <entry>Default: <emphasis>unset</emphasis></entry>
46449 </row>
46450 </tbody>
46451 </tgroup>
46452 </informaltable>
46453 <para>
46454 <indexterm role="concept">
46455 <primary>DCSP</primary>
46456 <secondary>outbound</secondary>
46457 </indexterm>
46458 This option causes the DSCP value associated with a socket to be set to one
46459 of a number of fixed strings or to numeric value.
46460 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
46461 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
46462 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
46463 </para>
46464 <para>
46465 The outbound packets from Exim will be marked with this value in the header
46466 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
46467 that these values will have any effect, not be stripped by networking
46468 equipment, or do much of anything without cooperation with your Network
46469 Engineer and those of all network operators between the source and destination.
46470 </para>
46471 <para>
46472 <indexterm role="option">
46473 <primary><option>fallback_hosts</option></primary>
46474 </indexterm>
46475 </para>
46476 <informaltable frame="all">
46477 <tgroup cols="4" colsep="0" rowsep="0">
46478 <colspec colwidth="8*" align="left"/>
46479 <colspec colwidth="6*" align="center"/>
46480 <colspec colwidth="6*" align="center"/>
46481 <colspec colwidth="6*" align="right"/>
46482 <tbody>
46483 <row>
46484 <entry><option>fallback_hosts</option></entry>
46485 <entry>Use: <emphasis>smtp</emphasis></entry>
46486 <entry>Type: <emphasis>string list</emphasis></entry>
46487 <entry>Default: <emphasis>unset</emphasis></entry>
46488 </row>
46489 </tbody>
46490 </tgroup>
46491 </informaltable>
46492 <para>
46493 <indexterm role="concept">
46494 <primary>fallback</primary>
46495 <secondary>hosts specified on transport</secondary>
46496 </indexterm>
46497 String expansion is not applied to this option. The argument must be a
46498 colon-separated list of host names or IP addresses, optionally also including
46499 port numbers, though the separator can be changed, as described in section
46500 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
46501 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
46502 in section <xref linkend="SECTformatonehostitem"/>.
46503 </para>
46504 <para>
46505 Fallback hosts can also be specified on routers, which associate them with the
46506 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
46507 <option>fallback_hosts</option> specified on the transport is used only if the address does
46508 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
46509 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
46510 However, <option>hosts_randomize</option> does apply to fallback host lists.
46511 </para>
46512 <para>
46513 If Exim is unable to deliver to any of the hosts for a particular address, and
46514 the errors are not permanent rejections, the address is put on a separate
46515 transport queue with its host list replaced by the fallback hosts, unless the
46516 address was routed via MX records and the current host was in the original MX
46517 list. In that situation, the fallback host list is not used.
46518 </para>
46519 <para>
46520 Once normal deliveries are complete, the fallback queue is delivered by
46521 re-running the same transports with the new host lists. If several failing
46522 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
46523 copy of the message is sent.
46524 </para>
46525 <para>
46526 The resolution of the host names on the fallback list is controlled by the
46527 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
46528 both to cases when the host list comes with the address and when it is taken
46529 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
46530 fails</quote> facility.
46531 </para>
46532 <para>
46533 <indexterm role="option">
46534 <primary><option>final_timeout</option></primary>
46535 </indexterm>
46536 </para>
46537 <informaltable frame="all">
46538 <tgroup cols="4" colsep="0" rowsep="0">
46539 <colspec colwidth="8*" align="left"/>
46540 <colspec colwidth="6*" align="center"/>
46541 <colspec colwidth="6*" align="center"/>
46542 <colspec colwidth="6*" align="right"/>
46543 <tbody>
46544 <row>
46545 <entry><option>final_timeout</option></entry>
46546 <entry>Use: <emphasis>smtp</emphasis></entry>
46547 <entry>Type: <emphasis>time</emphasis></entry>
46548 <entry>Default: <emphasis>10m</emphasis></entry>
46549 </row>
46550 </tbody>
46551 </tgroup>
46552 </informaltable>
46553 <para>
46554 This is the timeout that applies while waiting for the response to the final
46555 line containing just <quote>.</quote> that terminates a message. Its value must not be
46556 zero.
46557 </para>
46558 <para>
46559 <indexterm role="option">
46560 <primary><option>gethostbyname</option></primary>
46561 </indexterm>
46562 </para>
46563 <informaltable frame="all">
46564 <tgroup cols="4" colsep="0" rowsep="0">
46565 <colspec colwidth="8*" align="left"/>
46566 <colspec colwidth="6*" align="center"/>
46567 <colspec colwidth="6*" align="center"/>
46568 <colspec colwidth="6*" align="right"/>
46569 <tbody>
46570 <row>
46571 <entry><option>gethostbyname</option></entry>
46572 <entry>Use: <emphasis>smtp</emphasis></entry>
46573 <entry>Type: <emphasis>boolean</emphasis></entry>
46574 <entry>Default: <emphasis>false</emphasis></entry>
46575 </row>
46576 </tbody>
46577 </tgroup>
46578 </informaltable>
46579 <para>
46580 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
46581 being used, names are looked up using <function>gethostbyname()</function>
46582 (or <function>getipnodebyname()</function> when available)
46583 instead of using the DNS. Of course, that function may in fact use the DNS, but
46584 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
46585 </para>
46586 <para>
46587 <indexterm role="option">
46588 <primary><option>gnutls_compat_mode</option></primary>
46589 </indexterm>
46590 </para>
46591 <informaltable frame="all">
46592 <tgroup cols="4" colsep="0" rowsep="0">
46593 <colspec colwidth="8*" align="left"/>
46594 <colspec colwidth="6*" align="center"/>
46595 <colspec colwidth="6*" align="center"/>
46596 <colspec colwidth="6*" align="right"/>
46597 <tbody>
46598 <row>
46599 <entry><option>gnutls_compat_mode</option></entry>
46600 <entry>Use: <emphasis>smtp</emphasis></entry>
46601 <entry>Type: <emphasis>boolean</emphasis></entry>
46602 <entry>Default: <emphasis>unset</emphasis></entry>
46603 </row>
46604 </tbody>
46605 </tgroup>
46606 </informaltable>
46607 <para>
46608 This option controls whether GnuTLS is used in compatibility mode in an Exim
46609 server. This reduces security slightly, but improves interworking with older
46610 implementations of TLS.
46611 </para>
46612 <para>
46613 <indexterm role="option">
46614 <primary><option>helo_data</option></primary>
46615 </indexterm>
46616 </para>
46617 <informaltable frame="all">
46618 <tgroup cols="4" colsep="0" rowsep="0">
46619 <colspec colwidth="8*" align="left"/>
46620 <colspec colwidth="6*" align="center"/>
46621 <colspec colwidth="6*" align="center"/>
46622 <colspec colwidth="6*" align="right"/>
46623 <tbody>
46624 <row>
46625 <entry><option>helo_data</option></entry>
46626 <entry>Use: <emphasis>smtp</emphasis></entry>
46627 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46628 <entry>Default: <emphasis>see below</emphasis></entry>
46629 </row>
46630 </tbody>
46631 </tgroup>
46632 </informaltable>
46633 <para>
46634 <indexterm role="concept">
46635 <primary>HELO</primary>
46636 <secondary>argument, setting</secondary>
46637 </indexterm>
46638 <indexterm role="concept">
46639 <primary>EHLO</primary>
46640 <secondary>argument, setting</secondary>
46641 </indexterm>
46642 <indexterm role="concept">
46643 <primary>LHLO argument setting</primary>
46644 </indexterm>
46645 The value of this option is expanded after a connection to a another host has
46646 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
46647 command that starts the outgoing SMTP or LMTP session. The default value of the
46648 option is:
46649 </para>
46650 <literallayout class="monospaced">
46651 $primary_hostname
46652 </literallayout>
46653 <para>
46654 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
46655 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
46656 <varname>$sending_port</varname> are set to the local IP address and port number that are being
46657 used. These variables can be used to generate different values for different
46658 servers or different local IP addresses. For example, if you want the string
46659 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
46660 interface address, you could use this:
46661 </para>
46662 <literallayout class="monospaced">
46663 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
46664   {$primary_hostname}}
46665 </literallayout>
46666 <para>
46667 The use of <option>helo_data</option> applies both to sending messages and when doing
46668 callouts.
46669 </para>
46670 <para>
46671 <indexterm role="option">
46672 <primary><option>hosts</option></primary>
46673 </indexterm>
46674 </para>
46675 <informaltable frame="all">
46676 <tgroup cols="4" colsep="0" rowsep="0">
46677 <colspec colwidth="8*" align="left"/>
46678 <colspec colwidth="6*" align="center"/>
46679 <colspec colwidth="6*" align="center"/>
46680 <colspec colwidth="6*" align="right"/>
46681 <tbody>
46682 <row>
46683 <entry><option>hosts</option></entry>
46684 <entry>Use: <emphasis>smtp</emphasis></entry>
46685 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
46686 <entry>Default: <emphasis>unset</emphasis></entry>
46687 </row>
46688 </tbody>
46689 </tgroup>
46690 </informaltable>
46691 <para>
46692 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
46693 finds the hosts by looking up the address domain in the DNS, or by
46694 <command>manualroute</command>, which has lists of hosts in its configuration. However,
46695 email addresses can be passed to the <command>smtp</command> transport by any router, and not
46696 all of them can provide an associated list of hosts.
46697 </para>
46698 <para>
46699 The <option>hosts</option> option specifies a list of hosts to be used if the address being
46700 processed does not have any hosts associated with it. The hosts specified by
46701 <option>hosts</option> are also used, whether or not the address has its own hosts, if
46702 <option>hosts_override</option> is set.
46703 </para>
46704 <para>
46705 The string is first expanded, before being interpreted as a colon-separated
46706 list of host names or IP addresses, possibly including port numbers. The
46707 separator may be changed to something other than colon, as described in section
46708 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
46709 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
46710 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
46711 of the <command>manualroute</command> router is not available here.
46712 </para>
46713 <para>
46714 If the expansion fails, delivery is deferred. Unless the failure was caused by
46715 the inability to complete a lookup, the error is logged to the panic log as
46716 well as the main log. Host names are looked up either by searching directly for
46717 address records in the DNS or by calling <function>gethostbyname()</function> (or
46718 <function>getipnodebyname()</function> when available), depending on the setting of the
46719 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
46720 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
46721 address are used.
46722 </para>
46723 <para>
46724 During delivery, the hosts are tried in order, subject to their retry status,
46725 unless <option>hosts_randomize</option> is set.
46726 </para>
46727 <para>
46728 <indexterm role="option">
46729 <primary><option>hosts_avoid_esmtp</option></primary>
46730 </indexterm>
46731 </para>
46732 <informaltable frame="all">
46733 <tgroup cols="4" colsep="0" rowsep="0">
46734 <colspec colwidth="8*" align="left"/>
46735 <colspec colwidth="6*" align="center"/>
46736 <colspec colwidth="6*" align="center"/>
46737 <colspec colwidth="6*" align="right"/>
46738 <tbody>
46739 <row>
46740 <entry><option>hosts_avoid_esmtp</option></entry>
46741 <entry>Use: <emphasis>smtp</emphasis></entry>
46742 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46743 <entry>Default: <emphasis>unset</emphasis></entry>
46744 </row>
46745 </tbody>
46746 </tgroup>
46747 </informaltable>
46748 <para>
46749 <indexterm role="concept">
46750 <primary>ESMTP, avoiding use of</primary>
46751 </indexterm>
46752 <indexterm role="concept">
46753 <primary>HELO</primary>
46754 <secondary>forcing use of</secondary>
46755 </indexterm>
46756 <indexterm role="concept">
46757 <primary>EHLO</primary>
46758 <secondary>avoiding use of</secondary>
46759 </indexterm>
46760 <indexterm role="concept">
46761 <primary>PIPELINING</primary>
46762 <secondary>avoiding the use of</secondary>
46763 </indexterm>
46764 This option is for use with broken hosts that announce ESMTP facilities (for
46765 example, PIPELINING) and then fail to implement them properly. When a host
46766 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
46767 start of the SMTP session. This means that it cannot use any of the ESMTP
46768 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
46769 </para>
46770 <para>
46771 <indexterm role="option">
46772 <primary><option>hosts_avoid_pipelining</option></primary>
46773 </indexterm>
46774 </para>
46775 <informaltable frame="all">
46776 <tgroup cols="4" colsep="0" rowsep="0">
46777 <colspec colwidth="8*" align="left"/>
46778 <colspec colwidth="6*" align="center"/>
46779 <colspec colwidth="6*" align="center"/>
46780 <colspec colwidth="6*" align="right"/>
46781 <tbody>
46782 <row>
46783 <entry><option>hosts_avoid_pipelining</option></entry>
46784 <entry>Use: <emphasis>smtp</emphasis></entry>
46785 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46786 <entry>Default: <emphasis>unset</emphasis></entry>
46787 </row>
46788 </tbody>
46789 </tgroup>
46790 </informaltable>
46791 <para>
46792 <indexterm role="concept">
46793 <primary>PIPELINING</primary>
46794 <secondary>avoiding the use of</secondary>
46795 </indexterm>
46796 Exim will not use the SMTP PIPELINING extension when delivering to any host
46797 that matches this list, even if the server host advertises PIPELINING support.
46798 </para>
46799 <para>
46800 <indexterm role="option">
46801 <primary><option>hosts_avoid_tls</option></primary>
46802 </indexterm>
46803 </para>
46804 <informaltable frame="all">
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>hosts_avoid_tls</option></entry>
46813 <entry>Use: <emphasis>smtp</emphasis></entry>
46814 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46815 <entry>Default: <emphasis>unset</emphasis></entry>
46816 </row>
46817 </tbody>
46818 </tgroup>
46819 </informaltable>
46820 <para>
46821 <indexterm role="concept">
46822 <primary>TLS</primary>
46823 <secondary>avoiding for certain hosts</secondary>
46824 </indexterm>
46825 Exim will not try to start a TLS session when delivering to any host that
46826 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
46827 </para>
46828 <para>
46829 <indexterm role="option">
46830 <primary><option>hosts_verify_avoid_tls</option></primary>
46831 </indexterm>
46832 </para>
46833 <informaltable frame="all">
46834 <tgroup cols="4" colsep="0" rowsep="0">
46835 <colspec colwidth="8*" align="left"/>
46836 <colspec colwidth="6*" align="center"/>
46837 <colspec colwidth="6*" align="center"/>
46838 <colspec colwidth="6*" align="right"/>
46839 <tbody>
46840 <row>
46841 <entry><option>hosts_verify_avoid_tls</option></entry>
46842 <entry>Use: <emphasis>smtp</emphasis></entry>
46843 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46844 <entry>Default: <emphasis>unset</emphasis></entry>
46845 </row>
46846 </tbody>
46847 </tgroup>
46848 </informaltable>
46849 <para>
46850 <indexterm role="concept">
46851 <primary>TLS</primary>
46852 <secondary>avoiding for certain hosts</secondary>
46853 </indexterm>
46854 Exim will not try to start a TLS session for a verify callout,
46855 or when delivering in cutthrough mode,
46856 to any host that matches this list.
46857 </para>
46858 <para>
46859 <indexterm role="option">
46860 <primary><option>hosts_max_try</option></primary>
46861 </indexterm>
46862 </para>
46863 <informaltable frame="all">
46864 <tgroup cols="4" colsep="0" rowsep="0">
46865 <colspec colwidth="8*" align="left"/>
46866 <colspec colwidth="6*" align="center"/>
46867 <colspec colwidth="6*" align="center"/>
46868 <colspec colwidth="6*" align="right"/>
46869 <tbody>
46870 <row>
46871 <entry><option>hosts_max_try</option></entry>
46872 <entry>Use: <emphasis>smtp</emphasis></entry>
46873 <entry>Type: <emphasis>integer</emphasis></entry>
46874 <entry>Default: <emphasis>5</emphasis></entry>
46875 </row>
46876 </tbody>
46877 </tgroup>
46878 </informaltable>
46879 <para>
46880 <indexterm role="concept">
46881 <primary>host</primary>
46882 <secondary>maximum number to try</secondary>
46883 </indexterm>
46884 <indexterm role="concept">
46885 <primary>limit</primary>
46886 <secondary>number of hosts tried</secondary>
46887 </indexterm>
46888 <indexterm role="concept">
46889 <primary>limit</primary>
46890 <secondary>number of MX tried</secondary>
46891 </indexterm>
46892 <indexterm role="concept">
46893 <primary>MX record</primary>
46894 <secondary>maximum tried</secondary>
46895 </indexterm>
46896 This option limits the number of IP addresses that are tried for any one
46897 delivery in cases where there are temporary delivery errors. Section
46898 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
46899 </para>
46900 <para>
46901 <indexterm role="option">
46902 <primary><option>hosts_max_try_hardlimit</option></primary>
46903 </indexterm>
46904 </para>
46905 <informaltable frame="all">
46906 <tgroup cols="4" colsep="0" rowsep="0">
46907 <colspec colwidth="8*" align="left"/>
46908 <colspec colwidth="6*" align="center"/>
46909 <colspec colwidth="6*" align="center"/>
46910 <colspec colwidth="6*" align="right"/>
46911 <tbody>
46912 <row>
46913 <entry><option>hosts_max_try_hardlimit</option></entry>
46914 <entry>Use: <emphasis>smtp</emphasis></entry>
46915 <entry>Type: <emphasis>integer</emphasis></entry>
46916 <entry>Default: <emphasis>50</emphasis></entry>
46917 </row>
46918 </tbody>
46919 </tgroup>
46920 </informaltable>
46921 <para>
46922 This is an additional check on the maximum number of IP addresses that Exim
46923 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
46924 why it exists.
46925 </para>
46926 <para>
46927 <indexterm role="option">
46928 <primary><option>hosts_nopass_tls</option></primary>
46929 </indexterm>
46930 </para>
46931 <informaltable frame="all">
46932 <tgroup cols="4" colsep="0" rowsep="0">
46933 <colspec colwidth="8*" align="left"/>
46934 <colspec colwidth="6*" align="center"/>
46935 <colspec colwidth="6*" align="center"/>
46936 <colspec colwidth="6*" align="right"/>
46937 <tbody>
46938 <row>
46939 <entry><option>hosts_nopass_tls</option></entry>
46940 <entry>Use: <emphasis>smtp</emphasis></entry>
46941 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
46942 <entry>Default: <emphasis>unset</emphasis></entry>
46943 </row>
46944 </tbody>
46945 </tgroup>
46946 </informaltable>
46947 <para>
46948 <indexterm role="concept">
46949 <primary>TLS</primary>
46950 <secondary>passing connection</secondary>
46951 </indexterm>
46952 <indexterm role="concept">
46953 <primary>multiple SMTP deliveries</primary>
46954 </indexterm>
46955 <indexterm role="concept">
46956 <primary>TLS</primary>
46957 <secondary>multiple message deliveries</secondary>
46958 </indexterm>
46959 For any host that matches this list, a connection on which a TLS session has
46960 been started will not be passed to a new delivery process for sending another
46961 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
46962 explanation of when this might be needed.
46963 </para>
46964 <para>
46965 <indexterm role="option">
46966 <primary><option>hosts_override</option></primary>
46967 </indexterm>
46968 </para>
46969 <informaltable frame="all">
46970 <tgroup cols="4" colsep="0" rowsep="0">
46971 <colspec colwidth="8*" align="left"/>
46972 <colspec colwidth="6*" align="center"/>
46973 <colspec colwidth="6*" align="center"/>
46974 <colspec colwidth="6*" align="right"/>
46975 <tbody>
46976 <row>
46977 <entry><option>hosts_override</option></entry>
46978 <entry>Use: <emphasis>smtp</emphasis></entry>
46979 <entry>Type: <emphasis>boolean</emphasis></entry>
46980 <entry>Default: <emphasis>false</emphasis></entry>
46981 </row>
46982 </tbody>
46983 </tgroup>
46984 </informaltable>
46985 <para>
46986 If this option is set and the <option>hosts</option> option is also set, any hosts that are
46987 attached to the address are ignored, and instead the hosts specified by the
46988 <option>hosts</option> option are always used. This option does not apply to
46989 <option>fallback_hosts</option>.
46990 </para>
46991 <para>
46992 <indexterm role="option">
46993 <primary><option>hosts_randomize</option></primary>
46994 </indexterm>
46995 </para>
46996 <informaltable frame="all">
46997 <tgroup cols="4" colsep="0" rowsep="0">
46998 <colspec colwidth="8*" align="left"/>
46999 <colspec colwidth="6*" align="center"/>
47000 <colspec colwidth="6*" align="center"/>
47001 <colspec colwidth="6*" align="right"/>
47002 <tbody>
47003 <row>
47004 <entry><option>hosts_randomize</option></entry>
47005 <entry>Use: <emphasis>smtp</emphasis></entry>
47006 <entry>Type: <emphasis>boolean</emphasis></entry>
47007 <entry>Default: <emphasis>false</emphasis></entry>
47008 </row>
47009 </tbody>
47010 </tgroup>
47011 </informaltable>
47012 <para>
47013 <indexterm role="concept">
47014 <primary>randomized host list</primary>
47015 </indexterm>
47016 <indexterm role="concept">
47017 <primary>host</primary>
47018 <secondary>list of; randomized</secondary>
47019 </indexterm>
47020 <indexterm role="concept">
47021 <primary>fallback</primary>
47022 <secondary>randomized hosts</secondary>
47023 </indexterm>
47024 If this option is set, and either the list of hosts is taken from the
47025 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
47026 were not obtained from MX records (this includes fallback hosts from the
47027 router), and were not randomized by the router, the order of trying the hosts
47028 is randomized each time the transport runs. Randomizing the order of a host
47029 list can be used to do crude load sharing.
47030 </para>
47031 <para>
47032 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
47033 order is separately randomized. This makes it possible to set up MX-like
47034 behaviour. The boundaries between groups are indicated by an item that is just
47035 <literal>+</literal> in the host list. For example:
47036 </para>
47037 <literallayout class="monospaced">
47038 hosts = host1:host2:host3:+:host4:host5
47039 </literallayout>
47040 <para>
47041 The order of the first three hosts and the order of the last two hosts is
47042 randomized for each use, but the first three always end up before the last two.
47043 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
47044 </para>
47045 <para>
47046 <indexterm role="option">
47047 <primary><option>hosts_require_auth</option></primary>
47048 </indexterm>
47049 </para>
47050 <informaltable frame="all">
47051 <tgroup cols="4" colsep="0" rowsep="0">
47052 <colspec colwidth="8*" align="left"/>
47053 <colspec colwidth="6*" align="center"/>
47054 <colspec colwidth="6*" align="center"/>
47055 <colspec colwidth="6*" align="right"/>
47056 <tbody>
47057 <row>
47058 <entry><option>hosts_require_auth</option></entry>
47059 <entry>Use: <emphasis>smtp</emphasis></entry>
47060 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47061 <entry>Default: <emphasis>unset</emphasis></entry>
47062 </row>
47063 </tbody>
47064 </tgroup>
47065 </informaltable>
47066 <para>
47067 <indexterm role="concept">
47068 <primary>authentication</primary>
47069 <secondary>required by client</secondary>
47070 </indexterm>
47071 This option provides a list of servers for which authentication must succeed
47072 before Exim will try to transfer a message. If authentication fails for
47073 servers which are not in this list, Exim tries to send unauthenticated. If
47074 authentication fails for one of these servers, delivery is deferred. This
47075 temporary error is detectable in the retry rules, so it can be turned into a
47076 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
47077 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
47078 </para>
47079 <para>
47080 <indexterm role="option">
47081 <primary><option>hosts_request_ocsp</option></primary>
47082 </indexterm>
47083 </para>
47084 <informaltable frame="all">
47085 <tgroup cols="4" colsep="0" rowsep="0">
47086 <colspec colwidth="8*" align="left"/>
47087 <colspec colwidth="6*" align="center"/>
47088 <colspec colwidth="6*" align="center"/>
47089 <colspec colwidth="6*" align="right"/>
47090 <tbody>
47091 <row>
47092 <entry><option>hosts_request_ocsp</option></entry>
47093 <entry>Use: <emphasis>smtp</emphasis></entry>
47094 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47095 <entry>Default: <emphasis>*</emphasis></entry>
47096 </row>
47097 </tbody>
47098 </tgroup>
47099 </informaltable>
47100 <para>
47101 <indexterm role="concept">
47102 <primary>TLS</primary>
47103 <secondary>requiring for certain servers</secondary>
47104 </indexterm>
47105 Exim will request a Certificate Status on a
47106 TLS session for any host that matches this list.
47107 <option>tls_verify_certificates</option> should also be set for the transport.
47108 </para>
47109 <para>
47110 <indexterm role="option">
47111 <primary><option>hosts_require_ocsp</option></primary>
47112 </indexterm>
47113 </para>
47114 <informaltable frame="all">
47115 <tgroup cols="4" colsep="0" rowsep="0">
47116 <colspec colwidth="8*" align="left"/>
47117 <colspec colwidth="6*" align="center"/>
47118 <colspec colwidth="6*" align="center"/>
47119 <colspec colwidth="6*" align="right"/>
47120 <tbody>
47121 <row>
47122 <entry><option>hosts_require_ocsp</option></entry>
47123 <entry>Use: <emphasis>smtp</emphasis></entry>
47124 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47125 <entry>Default: <emphasis>unset</emphasis></entry>
47126 </row>
47127 </tbody>
47128 </tgroup>
47129 </informaltable>
47130 <para>
47131 <indexterm role="concept">
47132 <primary>TLS</primary>
47133 <secondary>requiring for certain servers</secondary>
47134 </indexterm>
47135 Exim will request, and check for a valid Certificate Status being given, on a
47136 TLS session for any host that matches this list.
47137 <option>tls_verify_certificates</option> should also be set for the transport.
47138 </para>
47139 <para>
47140 <indexterm role="option">
47141 <primary><option>hosts_require_tls</option></primary>
47142 </indexterm>
47143 </para>
47144 <informaltable frame="all">
47145 <tgroup cols="4" colsep="0" rowsep="0">
47146 <colspec colwidth="8*" align="left"/>
47147 <colspec colwidth="6*" align="center"/>
47148 <colspec colwidth="6*" align="center"/>
47149 <colspec colwidth="6*" align="right"/>
47150 <tbody>
47151 <row>
47152 <entry><option>hosts_require_tls</option></entry>
47153 <entry>Use: <emphasis>smtp</emphasis></entry>
47154 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47155 <entry>Default: <emphasis>unset</emphasis></entry>
47156 </row>
47157 </tbody>
47158 </tgroup>
47159 </informaltable>
47160 <para>
47161 <indexterm role="concept">
47162 <primary>TLS</primary>
47163 <secondary>requiring for certain servers</secondary>
47164 </indexterm>
47165 Exim will insist on using a TLS session when delivering to any host that
47166 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47167 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
47168 incoming messages, use an appropriate ACL.
47169 </para>
47170 <para>
47171 <indexterm role="option">
47172 <primary><option>hosts_try_auth</option></primary>
47173 </indexterm>
47174 </para>
47175 <informaltable frame="all">
47176 <tgroup cols="4" colsep="0" rowsep="0">
47177 <colspec colwidth="8*" align="left"/>
47178 <colspec colwidth="6*" align="center"/>
47179 <colspec colwidth="6*" align="center"/>
47180 <colspec colwidth="6*" align="right"/>
47181 <tbody>
47182 <row>
47183 <entry><option>hosts_try_auth</option></entry>
47184 <entry>Use: <emphasis>smtp</emphasis></entry>
47185 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47186 <entry>Default: <emphasis>unset</emphasis></entry>
47187 </row>
47188 </tbody>
47189 </tgroup>
47190 </informaltable>
47191 <para>
47192 <indexterm role="concept">
47193 <primary>authentication</primary>
47194 <secondary>optional in client</secondary>
47195 </indexterm>
47196 This option provides a list of servers to which, provided they announce
47197 authentication support, Exim will attempt to authenticate as a client when it
47198 connects. If authentication fails, Exim will try to transfer the message
47199 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
47200 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
47201 </para>
47202 <para>
47203 <indexterm role="option">
47204 <primary><option>hosts_try_chunking</option></primary>
47205 </indexterm>
47206 </para>
47207 <informaltable frame="all">
47208 <tgroup cols="4" colsep="0" rowsep="0">
47209 <colspec colwidth="8*" align="left"/>
47210 <colspec colwidth="6*" align="center"/>
47211 <colspec colwidth="6*" align="center"/>
47212 <colspec colwidth="6*" align="right"/>
47213 <tbody>
47214 <row>
47215 <entry><option>hosts_try_chunking</option></entry>
47216 <entry>Use: <emphasis>smtp</emphasis></entry>
47217 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47218 <entry>Default: <emphasis>*</emphasis></entry>
47219 </row>
47220 </tbody>
47221 </tgroup>
47222 </informaltable>
47223 <para>
47224 <indexterm role="concept">
47225 <primary>CHUNKING</primary>
47226 <secondary>enabling, in client</secondary>
47227 </indexterm>
47228 <indexterm role="concept">
47229 <primary>BDAT</primary>
47230 <secondary>SMTP command</secondary>
47231 </indexterm>
47232 <indexterm role="concept">
47233 <primary>RFC 3030</primary>
47234 <secondary>CHUNKING</secondary>
47235 </indexterm>
47236 This option provides a list of servers to which, provided they announce
47237 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
47238 BDAT will not be used in conjunction with a transport filter.
47239 </para>
47240 <para>
47241 <indexterm role="option">
47242 <primary><option>hosts_try_fastopen</option></primary>
47243 </indexterm>
47244 </para>
47245 <informaltable frame="all">
47246 <tgroup cols="4" colsep="0" rowsep="0">
47247 <colspec colwidth="8*" align="left"/>
47248 <colspec colwidth="6*" align="center"/>
47249 <colspec colwidth="6*" align="center"/>
47250 <colspec colwidth="6*" align="right"/>
47251 <tbody>
47252 <row>
47253 <entry><option>hosts_try_fastopen</option></entry>
47254 <entry>Use: <emphasis>smtp</emphasis></entry>
47255 <entry>Type: <emphasis>host list!!</emphasis></entry>
47256 <entry>Default: <emphasis>unset</emphasis></entry>
47257 </row>
47258 </tbody>
47259 </tgroup>
47260 </informaltable>
47261 <para>
47262 <indexterm role="concept">
47263 <primary>fast open, TCP</primary>
47264 <secondary>enabling, in client</secondary>
47265 </indexterm>
47266 <indexterm role="concept">
47267 <primary>TCP Fast Open</primary>
47268 <secondary>enabling, in client</secondary>
47269 </indexterm>
47270 <indexterm role="concept">
47271 <primary>RFC 7413</primary>
47272 <secondary>TCP Fast Open</secondary>
47273 </indexterm>
47274 This option provides a list of servers to which, provided
47275 the facility is supported by this system, Exim will attempt to
47276 perform a TCP Fast Open.
47277 No data is sent on the SYN segment but, if the remote server also
47278 supports the facility, it can send its SMTP banner immediately after
47279 the SYN,ACK segment.  This can save up to one round-trip time.
47280 </para>
47281 <para>
47282 The facility is only active for previously-contacted servers,
47283 as the initiator must present a cookie in the SYN segment.
47284 </para>
47285 <para>
47286 On (at least some) current Linux distributions the facility must be enabled
47287 in the kernel by the sysadmin before the support is usable.
47288 </para>
47289 <para>
47290 <indexterm role="option">
47291 <primary><option>hosts_try_prdr</option></primary>
47292 </indexterm>
47293 </para>
47294 <informaltable frame="all">
47295 <tgroup cols="4" colsep="0" rowsep="0">
47296 <colspec colwidth="8*" align="left"/>
47297 <colspec colwidth="6*" align="center"/>
47298 <colspec colwidth="6*" align="center"/>
47299 <colspec colwidth="6*" align="right"/>
47300 <tbody>
47301 <row>
47302 <entry><option>hosts_try_prdr</option></entry>
47303 <entry>Use: <emphasis>smtp</emphasis></entry>
47304 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47305 <entry>Default: <emphasis>*</emphasis></entry>
47306 </row>
47307 </tbody>
47308 </tgroup>
47309 </informaltable>
47310 <para>
47311 <indexterm role="concept">
47312 <primary>PRDR</primary>
47313 <secondary>enabling, optional in client</secondary>
47314 </indexterm>
47315 This option provides a list of servers to which, provided they announce
47316 PRDR support, Exim will attempt to negotiate PRDR
47317 for multi-recipient messages.
47318 The option can usually be left as default.
47319 </para>
47320 <para>
47321 <indexterm role="option">
47322 <primary><option>interface</option></primary>
47323 </indexterm>
47324 </para>
47325 <informaltable frame="all">
47326 <tgroup cols="4" colsep="0" rowsep="0">
47327 <colspec colwidth="8*" align="left"/>
47328 <colspec colwidth="6*" align="center"/>
47329 <colspec colwidth="6*" align="center"/>
47330 <colspec colwidth="6*" align="right"/>
47331 <tbody>
47332 <row>
47333 <entry><option>interface</option></entry>
47334 <entry>Use: <emphasis>smtp</emphasis></entry>
47335 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
47336 <entry>Default: <emphasis>unset</emphasis></entry>
47337 </row>
47338 </tbody>
47339 </tgroup>
47340 </informaltable>
47341 <para>
47342 <indexterm role="concept">
47343 <primary>bind IP address</primary>
47344 </indexterm>
47345 <indexterm role="concept">
47346 <primary>IP address</primary>
47347 <secondary>binding</secondary>
47348 </indexterm>
47349 <indexterm role="variable">
47350 <primary><varname>$host</varname></primary>
47351 </indexterm>
47352 <indexterm role="variable">
47353 <primary><varname>$host_address</varname></primary>
47354 </indexterm>
47355 This option specifies which interface to bind to when making an outgoing SMTP
47356 call. The value is an IP address, not an interface name such as
47357 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
47358 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
47359 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
47360 outgoing interface address. There is no variable that contains an outgoing
47361 interface address because, unless it is set by this option, its value is
47362 unknown.
47363 </para>
47364 <para>
47365 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
47366 <varname>$host_address</varname> refer to the host to which a connection is about to be made
47367 during the expansion of the string. Forced expansion failure, or an empty
47368 string result causes the option to be ignored. Otherwise, after expansion, the
47369 string must be a list of IP addresses, colon-separated by default, but the
47370 separator can be changed in the usual way. For example:
47371 </para>
47372 <literallayout class="monospaced">
47373 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
47374 </literallayout>
47375 <para>
47376 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
47377 connection. If none of them are the correct type, the option is ignored. If
47378 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
47379 interface to use if the host has more than one.
47380 </para>
47381 <para>
47382 <indexterm role="option">
47383 <primary><option>keepalive</option></primary>
47384 </indexterm>
47385 </para>
47386 <informaltable frame="all">
47387 <tgroup cols="4" colsep="0" rowsep="0">
47388 <colspec colwidth="8*" align="left"/>
47389 <colspec colwidth="6*" align="center"/>
47390 <colspec colwidth="6*" align="center"/>
47391 <colspec colwidth="6*" align="right"/>
47392 <tbody>
47393 <row>
47394 <entry><option>keepalive</option></entry>
47395 <entry>Use: <emphasis>smtp</emphasis></entry>
47396 <entry>Type: <emphasis>boolean</emphasis></entry>
47397 <entry>Default: <emphasis>true</emphasis></entry>
47398 </row>
47399 </tbody>
47400 </tgroup>
47401 </informaltable>
47402 <para>
47403 <indexterm role="concept">
47404 <primary>keepalive</primary>
47405 <secondary>on outgoing connection</secondary>
47406 </indexterm>
47407 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
47408 connections. When set, it causes the kernel to probe idle connections
47409 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
47410 of the connection should send a acknowledgment if the connection is still okay
47411 or a reset if the connection has been aborted. The reason for doing this is
47412 that it has the beneficial effect of freeing up certain types of connection
47413 that can get stuck when the remote host is disconnected without tidying up the
47414 TCP/IP call properly. The keepalive mechanism takes several hours to detect
47415 unreachable hosts.
47416 </para>
47417 <para>
47418 <indexterm role="option">
47419 <primary><option>lmtp_ignore_quota</option></primary>
47420 </indexterm>
47421 </para>
47422 <informaltable frame="all">
47423 <tgroup cols="4" colsep="0" rowsep="0">
47424 <colspec colwidth="8*" align="left"/>
47425 <colspec colwidth="6*" align="center"/>
47426 <colspec colwidth="6*" align="center"/>
47427 <colspec colwidth="6*" align="right"/>
47428 <tbody>
47429 <row>
47430 <entry><option>lmtp_ignore_quota</option></entry>
47431 <entry>Use: <emphasis>smtp</emphasis></entry>
47432 <entry>Type: <emphasis>boolean</emphasis></entry>
47433 <entry>Default: <emphasis>false</emphasis></entry>
47434 </row>
47435 </tbody>
47436 </tgroup>
47437 </informaltable>
47438 <para>
47439 <indexterm role="concept">
47440 <primary>LMTP</primary>
47441 <secondary>ignoring quota errors</secondary>
47442 </indexterm>
47443 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
47444 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
47445 has advertised support for IGNOREQUOTA in its response to the LHLO command.
47446 </para>
47447 <para>
47448 <indexterm role="option">
47449 <primary><option>max_rcpt</option></primary>
47450 </indexterm>
47451 </para>
47452 <informaltable frame="all">
47453 <tgroup cols="4" colsep="0" rowsep="0">
47454 <colspec colwidth="8*" align="left"/>
47455 <colspec colwidth="6*" align="center"/>
47456 <colspec colwidth="6*" align="center"/>
47457 <colspec colwidth="6*" align="right"/>
47458 <tbody>
47459 <row>
47460 <entry><option>max_rcpt</option></entry>
47461 <entry>Use: <emphasis>smtp</emphasis></entry>
47462 <entry>Type: <emphasis>integer</emphasis></entry>
47463 <entry>Default: <emphasis>100</emphasis></entry>
47464 </row>
47465 </tbody>
47466 </tgroup>
47467 </informaltable>
47468 <para>
47469 <indexterm role="concept">
47470 <primary>RCPT</primary>
47471 <secondary>maximum number of outgoing</secondary>
47472 </indexterm>
47473 This option limits the number of RCPT commands that are sent in a single
47474 SMTP message transaction. Each set of addresses is treated independently, and
47475 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
47476 permits this.
47477 </para>
47478 <para>
47479 <indexterm role="option">
47480 <primary><option>multi_domain</option></primary>
47481 </indexterm>
47482 </para>
47483 <informaltable frame="all">
47484 <tgroup cols="4" colsep="0" rowsep="0">
47485 <colspec colwidth="8*" align="left"/>
47486 <colspec colwidth="6*" align="center"/>
47487 <colspec colwidth="6*" align="center"/>
47488 <colspec colwidth="6*" align="right"/>
47489 <tbody>
47490 <row>
47491 <entry><option>multi_domain</option></entry>
47492 <entry>Use: <emphasis>smtp</emphasis></entry>
47493 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
47494 <entry>Default: <emphasis>true</emphasis></entry>
47495 </row>
47496 </tbody>
47497 </tgroup>
47498 </informaltable>
47499 <para>
47500 <indexterm role="variable">
47501 <primary><varname>$domain</varname></primary>
47502 </indexterm>
47503 When this option is set, the <command>smtp</command> transport can handle a number of
47504 addresses containing a mixture of different domains provided they all resolve
47505 to the same list of hosts. Turning the option off restricts the transport to
47506 handling only one domain at a time. This is useful if you want to use
47507 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
47508 is a single domain involved in a remote delivery.
47509 </para>
47510 <para>
47511 It is expanded per-address and can depend on any of
47512 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
47513 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
47514 </para>
47515 <para>
47516 <indexterm role="option">
47517 <primary><option>port</option></primary>
47518 </indexterm>
47519 </para>
47520 <informaltable frame="all">
47521 <tgroup cols="4" colsep="0" rowsep="0">
47522 <colspec colwidth="8*" align="left"/>
47523 <colspec colwidth="6*" align="center"/>
47524 <colspec colwidth="6*" align="center"/>
47525 <colspec colwidth="6*" align="right"/>
47526 <tbody>
47527 <row>
47528 <entry><option>port</option></entry>
47529 <entry>Use: <emphasis>smtp</emphasis></entry>
47530 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47531 <entry>Default: <emphasis>see below</emphasis></entry>
47532 </row>
47533 </tbody>
47534 </tgroup>
47535 </informaltable>
47536 <para>
47537 <indexterm role="concept">
47538 <primary>port</primary>
47539 <secondary>sending TCP/IP</secondary>
47540 </indexterm>
47541 <indexterm role="concept">
47542 <primary>TCP/IP</primary>
47543 <secondary>setting outgoing port</secondary>
47544 </indexterm>
47545 This option specifies the TCP/IP port on the server to which Exim connects.
47546 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
47547 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
47548 The name was changed to minimize confusion with the outgoing port. There is no
47549 variable that contains an outgoing port.
47550 </para>
47551 <para>
47552 If the value of this option begins with a digit it is taken as a port number;
47553 otherwise it is looked up using <function>getservbyname()</function>. The default value is
47554 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
47555 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
47556 is deferred.
47557 </para>
47558 <para>
47559 <indexterm role="option">
47560 <primary><option>protocol</option></primary>
47561 </indexterm>
47562 </para>
47563 <informaltable frame="all">
47564 <tgroup cols="4" colsep="0" rowsep="0">
47565 <colspec colwidth="8*" align="left"/>
47566 <colspec colwidth="6*" align="center"/>
47567 <colspec colwidth="6*" align="center"/>
47568 <colspec colwidth="6*" align="right"/>
47569 <tbody>
47570 <row>
47571 <entry><option>protocol</option></entry>
47572 <entry>Use: <emphasis>smtp</emphasis></entry>
47573 <entry>Type: <emphasis>string</emphasis></entry>
47574 <entry>Default: <emphasis>smtp</emphasis></entry>
47575 </row>
47576 </tbody>
47577 </tgroup>
47578 </informaltable>
47579 <para>
47580 <indexterm role="concept">
47581 <primary>LMTP</primary>
47582 <secondary>over TCP/IP</secondary>
47583 </indexterm>
47584 <indexterm role="concept">
47585 <primary>ssmtp protocol</primary>
47586 <secondary>outbound</secondary>
47587 </indexterm>
47588 <indexterm role="concept">
47589 <primary>TLS</primary>
47590 <secondary>SSL-on-connect outbound</secondary>
47591 </indexterm>
47592 <indexterm role="variable">
47593 <primary><varname>$port</varname></primary>
47594 </indexterm>
47595 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
47596 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
47597 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
47598 deliveries into closed message stores. Exim also has support for running LMTP
47599 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
47600 </para>
47601 <para>
47602 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
47603 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
47604 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
47605 The Internet standards bodies strongly discourage use of this mode.
47606 </para>
47607 <para>
47608 <indexterm role="option">
47609 <primary><option>retry_include_ip_address</option></primary>
47610 </indexterm>
47611 </para>
47612 <informaltable frame="all">
47613 <tgroup cols="4" colsep="0" rowsep="0">
47614 <colspec colwidth="8*" align="left"/>
47615 <colspec colwidth="6*" align="center"/>
47616 <colspec colwidth="6*" align="center"/>
47617 <colspec colwidth="6*" align="right"/>
47618 <tbody>
47619 <row>
47620 <entry><option>retry_include_ip_address</option></entry>
47621 <entry>Use: <emphasis>smtp</emphasis></entry>
47622 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
47623 <entry>Default: <emphasis>true</emphasis></entry>
47624 </row>
47625 </tbody>
47626 </tgroup>
47627 </informaltable>
47628 <para>
47629 Exim normally includes both the host name and the IP address in the key it
47630 constructs for indexing retry data after a temporary delivery failure. This
47631 means that when one of several IP addresses for a host is failing, it gets
47632 tried periodically (controlled by the retry rules), but use of the other IP
47633 addresses is not affected.
47634 </para>
47635 <para>
47636 However, in some dialup environments hosts are assigned a different IP address
47637 each time they connect. In this situation the use of the IP address as part of
47638 the retry key leads to undesirable behaviour. Setting this option false causes
47639 Exim to use only the host name.
47640 Since it is expanded it can be made to depend on the host or domain.
47641 </para>
47642 <para>
47643 <indexterm role="option">
47644 <primary><option>serialize_hosts</option></primary>
47645 </indexterm>
47646 </para>
47647 <informaltable frame="all">
47648 <tgroup cols="4" colsep="0" rowsep="0">
47649 <colspec colwidth="8*" align="left"/>
47650 <colspec colwidth="6*" align="center"/>
47651 <colspec colwidth="6*" align="center"/>
47652 <colspec colwidth="6*" align="right"/>
47653 <tbody>
47654 <row>
47655 <entry><option>serialize_hosts</option></entry>
47656 <entry>Use: <emphasis>smtp</emphasis></entry>
47657 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
47658 <entry>Default: <emphasis>unset</emphasis></entry>
47659 </row>
47660 </tbody>
47661 </tgroup>
47662 </informaltable>
47663 <para>
47664 <indexterm role="concept">
47665 <primary>serializing connections</primary>
47666 </indexterm>
47667 <indexterm role="concept">
47668 <primary>host</primary>
47669 <secondary>serializing connections</secondary>
47670 </indexterm>
47671 Because Exim operates in a distributed manner, if several messages for the same
47672 host arrive at around the same time, more than one simultaneous connection to
47673 the remote host can occur. This is not usually a problem except when there is a
47674 slow link between the hosts. In that situation it may be helpful to restrict
47675 Exim to one connection at a time. This can be done by setting
47676 <option>serialize_hosts</option> to match the relevant hosts.
47677 </para>
47678 <para>
47679 <indexterm role="concept">
47680 <primary>hints database</primary>
47681 <secondary>serializing deliveries to a host</secondary>
47682 </indexterm>
47683 Exim implements serialization by means of a hints database in which a record is
47684 written whenever a process connects to one of the restricted hosts. The record
47685 is deleted when the connection is completed. Obviously there is scope for
47686 records to get left lying around if there is a system or program crash. To
47687 guard against this, Exim ignores any records that are more than six hours old.
47688 </para>
47689 <para>
47690 If you set up this kind of serialization, you should also arrange to delete the
47691 relevant hints database whenever your system reboots. The names of the files
47692 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
47693 may be one or two files, depending on the type of DBM in use. The same files
47694 are used for ETRN serialization.
47695 </para>
47696 <para>
47697 See also the <option>max_parallel</option> generic transport option.
47698 </para>
47699 <para>
47700 <indexterm role="option">
47701 <primary><option>size_addition</option></primary>
47702 </indexterm>
47703 </para>
47704 <informaltable frame="all">
47705 <tgroup cols="4" colsep="0" rowsep="0">
47706 <colspec colwidth="8*" align="left"/>
47707 <colspec colwidth="6*" align="center"/>
47708 <colspec colwidth="6*" align="center"/>
47709 <colspec colwidth="6*" align="right"/>
47710 <tbody>
47711 <row>
47712 <entry><option>size_addition</option></entry>
47713 <entry>Use: <emphasis>smtp</emphasis></entry>
47714 <entry>Type: <emphasis>integer</emphasis></entry>
47715 <entry>Default: <emphasis>1024</emphasis></entry>
47716 </row>
47717 </tbody>
47718 </tgroup>
47719 </informaltable>
47720 <para>
47721 <indexterm role="concept">
47722 <primary>SMTP</primary>
47723 <secondary>SIZE</secondary>
47724 </indexterm>
47725 <indexterm role="concept">
47726 <primary>message</primary>
47727 <secondary>size issue for transport filter</secondary>
47728 </indexterm>
47729 <indexterm role="concept">
47730 <primary>size</primary>
47731 <secondary>of message</secondary>
47732 </indexterm>
47733 <indexterm role="concept">
47734 <primary>transport</primary>
47735 <secondary>filter</secondary>
47736 </indexterm>
47737 <indexterm role="concept">
47738 <primary>filter</primary>
47739 <secondary>transport filter</secondary>
47740 </indexterm>
47741 If a remote SMTP server indicates that it supports the SIZE option of the
47742 MAIL command, Exim uses this to pass over the message size at the start of
47743 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
47744 sends, to allow for headers and other text that may be added during delivery by
47745 configuration options or in a transport filter. It may be necessary to increase
47746 this if a lot of text is added to messages.
47747 </para>
47748 <para>
47749 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
47750 the use of the SIZE option altogether.
47751 </para>
47752 <para>
47753 <indexterm role="option">
47754 <primary><option>socks_proxy</option></primary>
47755 </indexterm>
47756 </para>
47757 <informaltable frame="all">
47758 <tgroup cols="4" colsep="0" rowsep="0">
47759 <colspec colwidth="8*" align="left"/>
47760 <colspec colwidth="6*" align="center"/>
47761 <colspec colwidth="6*" align="center"/>
47762 <colspec colwidth="6*" align="right"/>
47763 <tbody>
47764 <row>
47765 <entry><option>socks_proxy</option></entry>
47766 <entry>Use: <emphasis>smtp</emphasis></entry>
47767 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47768 <entry>Default: <emphasis>unset</emphasis></entry>
47769 </row>
47770 </tbody>
47771 </tgroup>
47772 </informaltable>
47773 <para>
47774 <indexterm role="concept">
47775 <primary>proxy</primary>
47776 <secondary>SOCKS</secondary>
47777 </indexterm>
47778 This option enables use of SOCKS proxies for connections made by the
47779 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
47780 </para>
47781 <para>
47782 <indexterm role="option">
47783 <primary><option>tls_certificate</option></primary>
47784 </indexterm>
47785 </para>
47786 <informaltable frame="all">
47787 <tgroup cols="4" colsep="0" rowsep="0">
47788 <colspec colwidth="8*" align="left"/>
47789 <colspec colwidth="6*" align="center"/>
47790 <colspec colwidth="6*" align="center"/>
47791 <colspec colwidth="6*" align="right"/>
47792 <tbody>
47793 <row>
47794 <entry><option>tls_certificate</option></entry>
47795 <entry>Use: <emphasis>smtp</emphasis></entry>
47796 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47797 <entry>Default: <emphasis>unset</emphasis></entry>
47798 </row>
47799 </tbody>
47800 </tgroup>
47801 </informaltable>
47802 <para>
47803 <indexterm role="concept">
47804 <primary>TLS</primary>
47805 <secondary>client certificate, location of</secondary>
47806 </indexterm>
47807 <indexterm role="concept">
47808 <primary>certificate</primary>
47809 <secondary>client, location of</secondary>
47810 </indexterm>
47811 <indexterm role="variable">
47812 <primary><varname>$host</varname></primary>
47813 </indexterm>
47814 <indexterm role="variable">
47815 <primary><varname>$host_address</varname></primary>
47816 </indexterm>
47817 The value of this option must be the absolute path to a file which contains the
47818 client&#x2019;s certificate, for possible use when sending a message over an encrypted
47819 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
47820 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
47821 details of TLS.
47822 </para>
47823 <para>
47824 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
47825 certificate when sending messages as a client. The global option of the same
47826 name specifies the certificate for Exim as a server; it is not automatically
47827 assumed that the same certificate should be used when Exim is operating as a
47828 client.
47829 </para>
47830 <para>
47831 <indexterm role="option">
47832 <primary><option>tls_crl</option></primary>
47833 </indexterm>
47834 </para>
47835 <informaltable frame="all">
47836 <tgroup cols="4" colsep="0" rowsep="0">
47837 <colspec colwidth="8*" align="left"/>
47838 <colspec colwidth="6*" align="center"/>
47839 <colspec colwidth="6*" align="center"/>
47840 <colspec colwidth="6*" align="right"/>
47841 <tbody>
47842 <row>
47843 <entry><option>tls_crl</option></entry>
47844 <entry>Use: <emphasis>smtp</emphasis></entry>
47845 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47846 <entry>Default: <emphasis>unset</emphasis></entry>
47847 </row>
47848 </tbody>
47849 </tgroup>
47850 </informaltable>
47851 <para>
47852 <indexterm role="concept">
47853 <primary>TLS</primary>
47854 <secondary>client certificate revocation list</secondary>
47855 </indexterm>
47856 <indexterm role="concept">
47857 <primary>certificate</primary>
47858 <secondary>revocation list for client</secondary>
47859 </indexterm>
47860 This option specifies a certificate revocation list. The expanded value must
47861 be the name of a file that contains a CRL in PEM format.
47862 </para>
47863 <para>
47864 <indexterm role="option">
47865 <primary><option>tls_dh_min_bits</option></primary>
47866 </indexterm>
47867 </para>
47868 <informaltable frame="all">
47869 <tgroup cols="4" colsep="0" rowsep="0">
47870 <colspec colwidth="8*" align="left"/>
47871 <colspec colwidth="6*" align="center"/>
47872 <colspec colwidth="6*" align="center"/>
47873 <colspec colwidth="6*" align="right"/>
47874 <tbody>
47875 <row>
47876 <entry><option>tls_dh_min_bits</option></entry>
47877 <entry>Use: <emphasis>smtp</emphasis></entry>
47878 <entry>Type: <emphasis>integer</emphasis></entry>
47879 <entry>Default: <emphasis>1024</emphasis></entry>
47880 </row>
47881 </tbody>
47882 </tgroup>
47883 </informaltable>
47884 <para>
47885 <indexterm role="concept">
47886 <primary>TLS</primary>
47887 <secondary>Diffie-Hellman minimum acceptable size</secondary>
47888 </indexterm>
47889 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
47890 key agreement is negotiated, the server will provide a large prime number
47891 for use.  This option establishes the minimum acceptable size of that number.
47892 If the parameter offered by the server is too small, then the TLS handshake
47893 will fail.
47894 </para>
47895 <para>
47896 Only supported when using GnuTLS.
47897 </para>
47898 <para>
47899 <indexterm role="option">
47900 <primary><option>tls_privatekey</option></primary>
47901 </indexterm>
47902 </para>
47903 <informaltable frame="all">
47904 <tgroup cols="4" colsep="0" rowsep="0">
47905 <colspec colwidth="8*" align="left"/>
47906 <colspec colwidth="6*" align="center"/>
47907 <colspec colwidth="6*" align="center"/>
47908 <colspec colwidth="6*" align="right"/>
47909 <tbody>
47910 <row>
47911 <entry><option>tls_privatekey</option></entry>
47912 <entry>Use: <emphasis>smtp</emphasis></entry>
47913 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47914 <entry>Default: <emphasis>unset</emphasis></entry>
47915 </row>
47916 </tbody>
47917 </tgroup>
47918 </informaltable>
47919 <para>
47920 <indexterm role="concept">
47921 <primary>TLS</primary>
47922 <secondary>client private key, location of</secondary>
47923 </indexterm>
47924 <indexterm role="variable">
47925 <primary><varname>$host</varname></primary>
47926 </indexterm>
47927 <indexterm role="variable">
47928 <primary><varname>$host_address</varname></primary>
47929 </indexterm>
47930 The value of this option must be the absolute path to a file which contains the
47931 client&#x2019;s private key. This is used when sending a message over an encrypted
47932 connection using a client certificate. The values of <varname>$host</varname> and
47933 <varname>$host_address</varname> are set to the name and address of the server during the
47934 expansion. If this option is unset, or the expansion is forced to fail, or the
47935 result is an empty string, the private key is assumed to be in the same file as
47936 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
47937 </para>
47938 <para>
47939 <indexterm role="option">
47940 <primary><option>tls_require_ciphers</option></primary>
47941 </indexterm>
47942 </para>
47943 <informaltable frame="all">
47944 <tgroup cols="4" colsep="0" rowsep="0">
47945 <colspec colwidth="8*" align="left"/>
47946 <colspec colwidth="6*" align="center"/>
47947 <colspec colwidth="6*" align="center"/>
47948 <colspec colwidth="6*" align="right"/>
47949 <tbody>
47950 <row>
47951 <entry><option>tls_require_ciphers</option></entry>
47952 <entry>Use: <emphasis>smtp</emphasis></entry>
47953 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47954 <entry>Default: <emphasis>unset</emphasis></entry>
47955 </row>
47956 </tbody>
47957 </tgroup>
47958 </informaltable>
47959 <para>
47960 <indexterm role="concept">
47961 <primary>TLS</primary>
47962 <secondary>requiring specific ciphers</secondary>
47963 </indexterm>
47964 <indexterm role="concept">
47965 <primary>cipher</primary>
47966 <secondary>requiring specific</secondary>
47967 </indexterm>
47968 <indexterm role="variable">
47969 <primary><varname>$host</varname></primary>
47970 </indexterm>
47971 <indexterm role="variable">
47972 <primary><varname>$host_address</varname></primary>
47973 </indexterm>
47974 The value of this option must be a list of permitted cipher suites, for use
47975 when setting up an outgoing encrypted connection. (There is a global option of
47976 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
47977 <varname>$host_address</varname> are set to the name and address of the server during the
47978 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
47979 is used in different ways by OpenSSL and GnuTLS (see sections
47980 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
47981 ciphers is a preference order.
47982 </para>
47983 <para>
47984 <indexterm role="option">
47985 <primary><option>tls_sni</option></primary>
47986 </indexterm>
47987 </para>
47988 <informaltable frame="all">
47989 <tgroup cols="4" colsep="0" rowsep="0">
47990 <colspec colwidth="8*" align="left"/>
47991 <colspec colwidth="6*" align="center"/>
47992 <colspec colwidth="6*" align="center"/>
47993 <colspec colwidth="6*" align="right"/>
47994 <tbody>
47995 <row>
47996 <entry><option>tls_sni</option></entry>
47997 <entry>Use: <emphasis>smtp</emphasis></entry>
47998 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47999 <entry>Default: <emphasis>unset</emphasis></entry>
48000 </row>
48001 </tbody>
48002 </tgroup>
48003 </informaltable>
48004 <para>
48005 <indexterm role="concept">
48006 <primary>TLS</primary>
48007 <secondary>Server Name Indication</secondary>
48008 </indexterm>
48009 <indexterm role="variable">
48010 <primary><varname>$tls_sni</varname></primary>
48011 </indexterm>
48012 If this option is set then it sets the $tls_out_sni variable and causes any
48013 TLS session to pass this value as the Server Name Indication extension to
48014 the remote side, which can be used by the remote side to select an appropriate
48015 certificate and private key for the session.
48016 </para>
48017 <para>
48018 See <xref linkend="SECTtlssni"/> for more information.
48019 </para>
48020 <para>
48021 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
48022 TLS extensions.
48023 </para>
48024 <para>
48025 <indexterm role="option">
48026 <primary><option>tls_tempfail_tryclear</option></primary>
48027 </indexterm>
48028 </para>
48029 <informaltable frame="all">
48030 <tgroup cols="4" colsep="0" rowsep="0">
48031 <colspec colwidth="8*" align="left"/>
48032 <colspec colwidth="6*" align="center"/>
48033 <colspec colwidth="6*" align="center"/>
48034 <colspec colwidth="6*" align="right"/>
48035 <tbody>
48036 <row>
48037 <entry><option>tls_tempfail_tryclear</option></entry>
48038 <entry>Use: <emphasis>smtp</emphasis></entry>
48039 <entry>Type: <emphasis>boolean</emphasis></entry>
48040 <entry>Default: <emphasis>true</emphasis></entry>
48041 </row>
48042 </tbody>
48043 </tgroup>
48044 </informaltable>
48045 <para>
48046 <indexterm role="concept">
48047 <primary>4<emphasis>xx</emphasis> responses</primary>
48048 <secondary>to STARTTLS</secondary>
48049 </indexterm>
48050 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
48051 setting up a TLS session, this option determines whether or not Exim should try
48052 to deliver the message unencrypted. If it is set false, delivery to the
48053 current host is deferred; if there are other hosts, they are tried. If this
48054 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
48055 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
48056 TLS negotiation fails, Exim closes the current connection (because it is in an
48057 unknown state), opens a new one to the same host, and then tries the delivery
48058 in clear.
48059 </para>
48060 <para>
48061 <indexterm role="option">
48062 <primary><option>tls_try_verify_hosts</option></primary>
48063 </indexterm>
48064 </para>
48065 <informaltable frame="all">
48066 <tgroup cols="4" colsep="0" rowsep="0">
48067 <colspec colwidth="8*" align="left"/>
48068 <colspec colwidth="6*" align="center"/>
48069 <colspec colwidth="6*" align="center"/>
48070 <colspec colwidth="6*" align="right"/>
48071 <tbody>
48072 <row>
48073 <entry><option>tls_try_verify_hosts</option></entry>
48074 <entry>Use: <emphasis>smtp</emphasis></entry>
48075 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48076 <entry>Default: <emphasis>*</emphasis></entry>
48077 </row>
48078 </tbody>
48079 </tgroup>
48080 </informaltable>
48081 <para>
48082 <indexterm role="concept">
48083 <primary>TLS</primary>
48084 <secondary>server certificate verification</secondary>
48085 </indexterm>
48086 <indexterm role="concept">
48087 <primary>certificate</primary>
48088 <secondary>verification of server</secondary>
48089 </indexterm>
48090 This option gives a list of hosts for which, on encrypted connections,
48091 certificate verification will be tried but need not succeed.
48092 The <option>tls_verify_certificates</option> option must also be set.
48093 Note that unless the host is in this list
48094 TLS connections will be denied to hosts using self-signed certificates
48095 when <option>tls_verify_certificates</option> is matched.
48096 The <varname>$tls_out_certificate_verified</varname> variable is set when
48097 certificate verification succeeds.
48098 </para>
48099 <para>
48100 <indexterm role="option">
48101 <primary><option>tls_verify_cert_hostnames</option></primary>
48102 </indexterm>
48103 </para>
48104 <informaltable frame="all">
48105 <tgroup cols="4" colsep="0" rowsep="0">
48106 <colspec colwidth="8*" align="left"/>
48107 <colspec colwidth="6*" align="center"/>
48108 <colspec colwidth="6*" align="center"/>
48109 <colspec colwidth="6*" align="right"/>
48110 <tbody>
48111 <row>
48112 <entry><option>tls_verify_cert_hostnames</option></entry>
48113 <entry>Use: <emphasis>smtp</emphasis></entry>
48114 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48115 <entry>Default: <emphasis>*</emphasis></entry>
48116 </row>
48117 </tbody>
48118 </tgroup>
48119 </informaltable>
48120 <para>
48121 <indexterm role="concept">
48122 <primary>TLS</primary>
48123 <secondary>server certificate hostname verification</secondary>
48124 </indexterm>
48125 <indexterm role="concept">
48126 <primary>certificate</primary>
48127 <secondary>verification of server</secondary>
48128 </indexterm>
48129 This option give a list of hosts for which,
48130 while verifying the server certificate,
48131 checks will be included on the host name
48132 (note that this will generally be the result of a DNS MX lookup)
48133 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
48134 limited to being the initial component of a 3-or-more component FQDN.
48135 </para>
48136 <para>
48137 There is no equivalent checking on client certificates.
48138 </para>
48139 <para>
48140 <indexterm role="option">
48141 <primary><option>tls_verify_certificates</option></primary>
48142 </indexterm>
48143 </para>
48144 <informaltable frame="all">
48145 <tgroup cols="4" colsep="0" rowsep="0">
48146 <colspec colwidth="8*" align="left"/>
48147 <colspec colwidth="6*" align="center"/>
48148 <colspec colwidth="6*" align="center"/>
48149 <colspec colwidth="6*" align="right"/>
48150 <tbody>
48151 <row>
48152 <entry><option>tls_verify_certificates</option></entry>
48153 <entry>Use: <emphasis>smtp</emphasis></entry>
48154 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48155 <entry>Default: <emphasis>system</emphasis></entry>
48156 </row>
48157 </tbody>
48158 </tgroup>
48159 </informaltable>
48160 <para>
48161 <indexterm role="concept">
48162 <primary>TLS</primary>
48163 <secondary>server certificate verification</secondary>
48164 </indexterm>
48165 <indexterm role="concept">
48166 <primary>certificate</primary>
48167 <secondary>verification of server</secondary>
48168 </indexterm>
48169 <indexterm role="variable">
48170 <primary><varname>$host</varname></primary>
48171 </indexterm>
48172 <indexterm role="variable">
48173 <primary><varname>$host_address</varname></primary>
48174 </indexterm>
48175 The value of this option must be either the
48176 word "system"
48177 or the absolute path to
48178 a file or directory containing permitted certificates for servers,
48179 for use when setting up an encrypted connection.
48180 </para>
48181 <para>
48182 The "system" value for the option will use a location compiled into the SSL library.
48183 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
48184 is taken as empty and an explicit location
48185 must be specified.
48186 </para>
48187 <para>
48188 The use of a directory for the option value is not available for GnuTLS versions
48189 preceding 3.3.6 and a single file must be used.
48190 </para>
48191 <para>
48192 With OpenSSL the certificates specified
48193 explicitly
48194 either by file or directory
48195 are added to those given by the system default location.
48196 </para>
48197 <para>
48198 The values of <varname>$host</varname> and
48199 <varname>$host_address</varname> are set to the name and address of the server during the
48200 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
48201 </para>
48202 <para>
48203 For back-compatibility,
48204 if neither tls_verify_hosts nor tls_try_verify_hosts are set
48205 (a single-colon empty list counts as being set)
48206 and certificate verification fails the TLS connection is closed.
48207 </para>
48208 <para>
48209 <indexterm role="option">
48210 <primary><option>tls_verify_hosts</option></primary>
48211 </indexterm>
48212 </para>
48213 <informaltable frame="all">
48214 <tgroup cols="4" colsep="0" rowsep="0">
48215 <colspec colwidth="8*" align="left"/>
48216 <colspec colwidth="6*" align="center"/>
48217 <colspec colwidth="6*" align="center"/>
48218 <colspec colwidth="6*" align="right"/>
48219 <tbody>
48220 <row>
48221 <entry><option>tls_verify_hosts</option></entry>
48222 <entry>Use: <emphasis>smtp</emphasis></entry>
48223 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
48224 <entry>Default: <emphasis>unset</emphasis></entry>
48225 </row>
48226 </tbody>
48227 </tgroup>
48228 </informaltable>
48229 <para>
48230 <indexterm role="concept">
48231 <primary>TLS</primary>
48232 <secondary>server certificate verification</secondary>
48233 </indexterm>
48234 <indexterm role="concept">
48235 <primary>certificate</primary>
48236 <secondary>verification of server</secondary>
48237 </indexterm>
48238 This option gives a list of hosts for which, on encrypted connections,
48239 certificate verification must succeed.
48240 The <option>tls_verify_certificates</option> option must also be set.
48241 If both this option and <option>tls_try_verify_hosts</option> are unset
48242 operation is as if this option selected all hosts.
48243 </para>
48244 </section>
48245 <section id="SECTvalhosmax">
48246 <title>How the limits for the number of hosts to try are used</title>
48247 <para>
48248 <indexterm role="concept">
48249 <primary>host</primary>
48250 <secondary>maximum number to try</secondary>
48251 </indexterm>
48252 <indexterm role="concept">
48253 <primary>limit</primary>
48254 <secondary>hosts; maximum number tried</secondary>
48255 </indexterm>
48256 There are two options that are concerned with the number of hosts that are
48257 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
48258 <option>hosts_max_try_hardlimit</option>.
48259 </para>
48260 <para>
48261 The <option>hosts_max_try</option> option limits the number of hosts that are tried
48262 for a single delivery. However, despite the term <quote>host</quote> in its name, the
48263 option actually applies to each IP address independently. In other words, a
48264 multihomed host is treated as several independent hosts, just as it is for
48265 retrying.
48266 </para>
48267 <para>
48268 Many of the larger ISPs have multiple MX records which often point to
48269 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
48270 created as a result of routing one of these domains.
48271 </para>
48272 <para>
48273 Trying every single IP address on such a long list does not seem sensible; if
48274 several at the top of the list fail, it is reasonable to assume there is some
48275 problem that is likely to affect all of them. Roughly speaking, the value of
48276 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
48277 delivery. However, the logic cannot be quite that simple.
48278 </para>
48279 <para>
48280 Firstly, IP addresses that are skipped because their retry times have not
48281 arrived do not count, and in addition, addresses that are past their retry
48282 limits are also not counted, even when they are tried. This means that when
48283 some IP addresses are past their retry limits, more than the value of
48284 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
48285 that all IP addresses are considered before timing out an email address (but
48286 see below for an exception).
48287 </para>
48288 <para>
48289 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
48290 list to see if there is a subsequent host with a different (higher valued) MX.
48291 If there is, that host is considered next, and the current IP address is used
48292 but not counted. This behaviour helps in the case of a domain with a retry rule
48293 that hardly ever delays any hosts, as is now explained:
48294 </para>
48295 <para>
48296 Consider the case of a long list of hosts with one MX value, and a few with a
48297 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
48298 hosts at the top of the list are tried at first. With the default retry rule,
48299 which specifies increasing retry times, the higher MX hosts are eventually
48300 tried when those at the top of the list are skipped because they have not
48301 reached their retry times.
48302 </para>
48303 <para>
48304 However, it is common practice to put a fixed short retry time on domains for
48305 large ISPs, on the grounds that their servers are rarely down for very long.
48306 Unfortunately, these are exactly the domains that tend to resolve to long lists
48307 of hosts. The short retry time means that the lowest MX hosts are tried every
48308 time. The attempts may be in a different order because of random sorting, but
48309 without the special MX check, the higher MX hosts would never be tried until
48310 all the lower MX hosts had timed out (which might be several days), because
48311 there are always some lower MX hosts that have reached their retry times. With
48312 the special check, Exim considers at least one IP address from each MX value at
48313 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
48314 reached.
48315 </para>
48316 <para>
48317 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
48318 particular, Exim normally eventually tries all the IP addresses before timing
48319 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
48320 reasonable thing to do. Recently, however, some lunatic DNS configurations have
48321 been set up with hundreds of IP addresses for some domains. It can
48322 take a very long time indeed for an address to time out in these cases.
48323 </para>
48324 <para>
48325 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
48326 Exim never tries more than this number of IP addresses; if it hits this limit
48327 and they are all timed out, the email address is bounced, even though not all
48328 possible IP addresses have been tried.
48329 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
48330 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
48331 </para>
48332 </section>
48333 </chapter>
48334
48335 <chapter id="CHAPrewrite">
48336 <title>Address rewriting</title>
48337 <para>
48338 <indexterm role="concept" id="IIDaddrew" class="startofrange">
48339 <primary>rewriting</primary>
48340 <secondary>addresses</secondary>
48341 </indexterm>
48342 There are some circumstances in which Exim automatically rewrites domains in
48343 addresses. The two most common are when an address is given without a domain
48344 (referred to as an <quote>unqualified address</quote>) or when an address contains an
48345 abbreviated domain that is expanded by DNS lookup.
48346 </para>
48347 <para>
48348 Unqualified envelope addresses are accepted only for locally submitted
48349 messages, or for messages that are received from hosts matching
48350 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
48351 appropriate. Unqualified addresses in header lines are qualified if they are in
48352 locally submitted messages, or messages from hosts that are permitted to send
48353 unqualified envelope addresses. Otherwise, unqualified addresses in header
48354 lines are neither qualified nor rewritten.
48355 </para>
48356 <para>
48357 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
48358 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
48359 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
48360 do this. The new RFCs do not contain this suggestion.
48361 </para>
48362 <section id="SECID147">
48363 <title>Explicitly configured address rewriting</title>
48364 <para>
48365 This chapter describes the rewriting rules that can be used in the
48366 main rewrite section of the configuration file, and also in the generic
48367 <option>headers_rewrite</option> option that can be set on any transport.
48368 </para>
48369 <para>
48370 Some people believe that configured address rewriting is a Mortal Sin.
48371 Others believe that life is not possible without it. Exim provides the
48372 facility; you do not have to use it.
48373 </para>
48374 <para>
48375 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
48376 configuration file are applied to addresses in incoming messages, both envelope
48377 addresses and addresses in header lines. Each rule specifies the types of
48378 address to which it applies.
48379 </para>
48380 <para>
48381 Whether or not addresses in header lines are rewritten depends on the origin of
48382 the headers and the type of rewriting. Global rewriting, that is, rewriting
48383 rules from the rewrite section of the configuration file, is applied only to
48384 those headers that were received with the message. Header lines that are added
48385 by ACLs or by a system filter or by individual routers or transports (which
48386 are specific to individual recipient addresses) are not rewritten by the global
48387 rules.
48388 </para>
48389 <para>
48390 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
48391 applies all headers except those added by routers and transports. That is, as
48392 well as the headers that were received with the message, it also applies to
48393 headers that were added by an ACL or a system filter.
48394 </para>
48395 <para>
48396 In general, rewriting addresses from your own system or domain has some
48397 legitimacy. Rewriting other addresses should be done only with great care and
48398 in special circumstances. The author of Exim believes that rewriting should be
48399 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
48400 Although it can sometimes be used as a routing tool, this is very strongly
48401 discouraged.
48402 </para>
48403 <para>
48404 There are two commonly encountered circumstances where rewriting is used, as
48405 illustrated by these examples:
48406 </para>
48407 <itemizedlist>
48408 <listitem>
48409 <para>
48410 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
48411 exchange mail with each other behind a firewall, but there is only a single
48412 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
48413 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
48414 </para>
48415 </listitem>
48416 <listitem>
48417 <para>
48418 A host rewrites the local parts of its own users so that, for example,
48419 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
48420 </para>
48421 </listitem>
48422 </itemizedlist>
48423 </section>
48424 <section id="SECID148">
48425 <title>When does rewriting happen?</title>
48426 <para>
48427 <indexterm role="concept">
48428 <primary>rewriting</primary>
48429 <secondary>timing of</secondary>
48430 </indexterm>
48431 <indexterm role="concept">
48432 <primary>access control lists (ACLs)</primary>
48433 <secondary>rewriting addresses in</secondary>
48434 </indexterm>
48435 Configured address rewriting can take place at several different stages of a
48436 message&#x2019;s processing.
48437 </para>
48438 <para>
48439 <indexterm role="variable">
48440 <primary><varname>$sender_address</varname></primary>
48441 </indexterm>
48442 At the start of an ACL for MAIL, the sender address may have been rewritten
48443 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
48444 ordinary rewrite rules have yet been applied. If, however, the sender address
48445 is verified in the ACL, it is rewritten before verification, and remains
48446 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
48447 rewritten address. This also applies if sender verification happens in a
48448 RCPT ACL. Otherwise, when the sender address is not verified, it is
48449 rewritten as soon as a message&#x2019;s header lines have been received.
48450 </para>
48451 <para>
48452 <indexterm role="variable">
48453 <primary><varname>$domain</varname></primary>
48454 </indexterm>
48455 <indexterm role="variable">
48456 <primary><varname>$local_part</varname></primary>
48457 </indexterm>
48458 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
48459 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
48460 rewrite rules have yet been applied to it. However, the behaviour is different
48461 from the sender address when a recipient is verified. The address is rewritten
48462 for the verification, but the rewriting is not remembered at this stage. The
48463 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
48464 as they were before (that is, they contain the unrewritten &ndash; except for
48465 SMTP-time rewriting &ndash; address).
48466 </para>
48467 <para>
48468 As soon as a message&#x2019;s header lines have been received, all the envelope
48469 recipient addresses are permanently rewritten, and rewriting is also applied to
48470 the addresses in the header lines (if configured). This happens before adding
48471 any header lines that were specified in MAIL or RCPT ACLs, and
48472 <indexterm role="concept">
48473 <primary><function>local_scan()</function> function</primary>
48474 <secondary>address rewriting; timing of</secondary>
48475 </indexterm>
48476 before the DATA ACL and <function>local_scan()</function> functions are run.
48477 </para>
48478 <para>
48479 When an address is being routed, either for delivery or for verification,
48480 rewriting is applied immediately to child addresses that are generated by
48481 redirection, unless <option>no_rewrite</option> is set on the router.
48482 </para>
48483 <para>
48484 <indexterm role="concept">
48485 <primary>envelope sender</primary>
48486 <secondary>rewriting at transport time</secondary>
48487 </indexterm>
48488 <indexterm role="concept">
48489 <primary>rewriting</primary>
48490 <secondary>at transport time</secondary>
48491 </indexterm>
48492 <indexterm role="concept">
48493 <primary>header lines</primary>
48494 <secondary>rewriting at transport time</secondary>
48495 </indexterm>
48496 At transport time, additional rewriting of addresses in header lines can be
48497 specified by setting the generic <option>headers_rewrite</option> option on a transport.
48498 This option contains rules that are identical in form to those in the rewrite
48499 section of the configuration file. They are applied to the original message
48500 header lines and any that were added by ACLs or a system filter. They are not
48501 applied to header lines that are added by routers or the transport.
48502 </para>
48503 <para>
48504 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
48505 transport option. However, it is not possible to rewrite envelope recipients at
48506 transport time.
48507 </para>
48508 </section>
48509 <section id="SECID149">
48510 <title>Testing the rewriting rules that apply on input</title>
48511 <para>
48512 <indexterm role="concept">
48513 <primary>rewriting</primary>
48514 <secondary>testing</secondary>
48515 </indexterm>
48516 <indexterm role="concept">
48517 <primary>testing</primary>
48518 <secondary>rewriting</secondary>
48519 </indexterm>
48520 Exim&#x2019;s input rewriting configuration appears in a part of the run time
48521 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
48522 <option>-brw</option> command line option. This takes an address (which can be a full RFC
48523 2822 address) as its argument. The output is a list of how the address would be
48524 transformed by the rewriting rules for each of the different places it might
48525 appear in an incoming message, that is, for each different header and for the
48526 envelope sender and recipient fields. For example,
48527 </para>
48528 <literallayout class="monospaced">
48529 exim -brw ph10@exim.workshop.example
48530 </literallayout>
48531 <para>
48532 might produce the output
48533 </para>
48534 <literallayout class="monospaced">
48535 sender: Philip.Hazel@exim.workshop.example
48536 from: Philip.Hazel@exim.workshop.example
48537 to: ph10@exim.workshop.example
48538 cc: ph10@exim.workshop.example
48539 bcc: ph10@exim.workshop.example
48540 reply-to: Philip.Hazel@exim.workshop.example
48541 env-from: Philip.Hazel@exim.workshop.example
48542 env-to: ph10@exim.workshop.example
48543 </literallayout>
48544 <para>
48545 which shows that rewriting has been set up for that address when used in any of
48546 the source fields, but not when it appears as a recipient address. At the
48547 present time, there is no equivalent way of testing rewriting rules that are
48548 set for a particular transport.
48549 </para>
48550 </section>
48551 <section id="SECID150">
48552 <title>Rewriting rules</title>
48553 <para>
48554 <indexterm role="concept">
48555 <primary>rewriting</primary>
48556 <secondary>rules</secondary>
48557 </indexterm>
48558 The rewrite section of the configuration file consists of lines of rewriting
48559 rules in the form
48560 </para>
48561 <literallayout>
48562 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
48563 </literallayout>
48564 <para>
48565 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
48566 transport option are given as a colon-separated list. Each item in the list
48567 takes the same form as a line in the main rewriting configuration (except that
48568 any colons must be doubled, of course).
48569 </para>
48570 <para>
48571 The formats of source patterns and replacement strings are described below.
48572 Each is terminated by white space, unless enclosed in double quotes, in which
48573 case normal quoting conventions apply inside the quotes. The flags are single
48574 characters which may appear in any order. Spaces and tabs between them are
48575 ignored.
48576 </para>
48577 <para>
48578 For each address that could potentially be rewritten, the rules are scanned in
48579 order, and replacements for the address from earlier rules can themselves be
48580 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
48581 </para>
48582 <para>
48583 The order in which addresses are rewritten is undefined, may change between
48584 releases, and must not be relied on, with one exception: when a message is
48585 received, the envelope sender is always rewritten first, before any header
48586 lines are rewritten. For example, the replacement string for a rewrite of an
48587 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
48588 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
48589 that the envelope sender has already been rewritten.
48590 </para>
48591 <para>
48592 <indexterm role="variable">
48593 <primary><varname>$domain</varname></primary>
48594 </indexterm>
48595 <indexterm role="variable">
48596 <primary><varname>$local_part</varname></primary>
48597 </indexterm>
48598 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
48599 string to refer to the address that is being rewritten. Note that lookup-driven
48600 rewriting can be done by a rule of the form
48601 </para>
48602 <literallayout class="monospaced">
48603 *@*   ${lookup ...
48604 </literallayout>
48605 <para>
48606 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
48607 refer to the address that is being rewritten.
48608 </para>
48609 </section>
48610 <section id="SECID151">
48611 <title>Rewriting patterns</title>
48612 <para>
48613 <indexterm role="concept">
48614 <primary>rewriting</primary>
48615 <secondary>patterns</secondary>
48616 </indexterm>
48617 <indexterm role="concept">
48618 <primary>address list</primary>
48619 <secondary>in a rewriting pattern</secondary>
48620 </indexterm>
48621 The source pattern in a rewriting rule is any item which may appear in an
48622 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
48623 single-item address list, which means that it is expanded before being tested
48624 against the address. As always, if you use a regular expression as a pattern,
48625 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
48626 facility to suppress string expansion within the regular expression.
48627 </para>
48628 <para>
48629 Domains in patterns should be given in lower case. Local parts in patterns are
48630 case-sensitive. If you want to do case-insensitive matching of local parts, you
48631 can use a regular expression that starts with <literal>^(?i)</literal>.
48632 </para>
48633 <para>
48634 <indexterm role="concept">
48635 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
48636 <secondary>in rewriting rules</secondary>
48637 </indexterm>
48638 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
48639 depending on the type of match which occurred. These can be used in the
48640 replacement string to insert portions of the incoming address. <varname>$0</varname> always
48641 refers to the complete incoming address. When a regular expression is used, the
48642 numerical variables are set from its capturing subexpressions. For other types
48643 of pattern they are set as follows:
48644 </para>
48645 <itemizedlist>
48646 <listitem>
48647 <para>
48648 If a local part or domain starts with an asterisk, the numerical variables
48649 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
48650 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
48651 pattern
48652 </para>
48653 <literallayout class="monospaced">
48654 *queen@*.fict.example
48655 </literallayout>
48656 <para>
48657 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
48658 </para>
48659 <literallayout class="monospaced">
48660 $0 = hearts-queen@wonderland.fict.example
48661 $1 = hearts-
48662 $2 = wonderland
48663 </literallayout>
48664 <para>
48665 Note that if the local part does not start with an asterisk, but the domain
48666 does, it is <varname>$1</varname> that contains the wild part of the domain.
48667 </para>
48668 </listitem>
48669 <listitem>
48670 <para>
48671 If the domain part of the pattern is a partial lookup, the wild and fixed parts
48672 of the domain are placed in the next available numerical variables. Suppose,
48673 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
48674 rewriting rule of the form
48675 </para>
48676 <literallayout>
48677 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
48678 </literallayout>
48679 <para>
48680 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
48681 </para>
48682 <literallayout class="monospaced">
48683 $1 = foo
48684 $2 = bar
48685 $3 = baz.example
48686 </literallayout>
48687 <para>
48688 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
48689 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
48690 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
48691 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
48692 whole domain. For non-partial domain lookups, no numerical variables are set.
48693 </para>
48694 </listitem>
48695 </itemizedlist>
48696 </section>
48697 <section id="SECID152">
48698 <title>Rewriting replacements</title>
48699 <para>
48700 <indexterm role="concept">
48701 <primary>rewriting</primary>
48702 <secondary>replacements</secondary>
48703 </indexterm>
48704 If the replacement string for a rule is a single asterisk, addresses that
48705 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
48706 rewriting rules are scanned. For example,
48707 </para>
48708 <literallayout class="monospaced">
48709 hatta@lookingglass.fict.example  *  f
48710 </literallayout>
48711 <para>
48712 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
48713 <emphasis>From:</emphasis> headers.
48714 </para>
48715 <para>
48716 <indexterm role="variable">
48717 <primary><varname>$domain</varname></primary>
48718 </indexterm>
48719 <indexterm role="variable">
48720 <primary><varname>$local_part</varname></primary>
48721 </indexterm>
48722 If the replacement string is not a single asterisk, it is expanded, and must
48723 yield a fully qualified address. Within the expansion, the variables
48724 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
48725 Any letters they contain retain their original case &ndash; they are not lower
48726 cased. The numerical variables are set up according to the type of pattern that
48727 matched the address, as described above. If the expansion is forced to fail by
48728 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
48729 current rule is abandoned, but subsequent rules may take effect. Any other
48730 expansion failure causes the entire rewriting operation to be abandoned, and an
48731 entry written to the panic log.
48732 </para>
48733 </section>
48734 <section id="SECID153">
48735 <title>Rewriting flags</title>
48736 <para>
48737 There are three different kinds of flag that may appear on rewriting rules:
48738 </para>
48739 <itemizedlist>
48740 <listitem>
48741 <para>
48742 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
48743 c, f, h, r, s, t.
48744 </para>
48745 </listitem>
48746 <listitem>
48747 <para>
48748 A flag that specifies rewriting at SMTP time: S.
48749 </para>
48750 </listitem>
48751 <listitem>
48752 <para>
48753 Flags that control the rewriting process: Q, q, R, w.
48754 </para>
48755 </listitem>
48756 </itemizedlist>
48757 <para>
48758 For rules that are part of the <option>headers_rewrite</option> generic transport option,
48759 E, F, T, and S are not permitted.
48760 </para>
48761 </section>
48762 <section id="SECID154">
48763 <title>Flags specifying which headers and envelope addresses to rewrite</title>
48764 <para>
48765 <indexterm role="concept">
48766 <primary>rewriting</primary>
48767 <secondary>flags</secondary>
48768 </indexterm>
48769 If none of the following flag letters, nor the <quote>S</quote> flag (see section
48770 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
48771 and to both the sender and recipient fields of the envelope, whereas a
48772 transport-time rewriting rule just applies to all headers. Otherwise, the
48773 rewriting rule is skipped unless the relevant addresses are being processed.
48774 </para>
48775 <literallayout>
48776 <literal>E</literal>       rewrite all envelope fields
48777 <literal>F</literal>       rewrite the envelope From field
48778 <literal>T</literal>       rewrite the envelope To field
48779 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
48780 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
48781 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
48782 <literal>h</literal>       rewrite all headers
48783 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
48784 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
48785 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
48786 </literallayout>
48787 <para>
48788 "All headers" means all of the headers listed above that can be selected
48789 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
48790 other headers such as <emphasis>Subject:</emphasis> etc.
48791 </para>
48792 <para>
48793 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
48794 restrict this to special known cases in your own domains.
48795 </para>
48796 </section>
48797 <section id="SECTrewriteS">
48798 <title>The SMTP-time rewriting flag</title>
48799 <para>
48800 <indexterm role="concept">
48801 <primary>SMTP</primary>
48802 <secondary>rewriting malformed addresses</secondary>
48803 </indexterm>
48804 <indexterm role="concept">
48805 <primary>RCPT</primary>
48806 <secondary>rewriting argument of</secondary>
48807 </indexterm>
48808 <indexterm role="concept">
48809 <primary>MAIL</primary>
48810 <secondary>rewriting argument of</secondary>
48811 </indexterm>
48812 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
48813 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
48814 before any other processing; even before syntax checking. The pattern is
48815 required to be a regular expression, and it is matched against the whole of the
48816 data for the command, including any surrounding angle brackets.
48817 </para>
48818 <para>
48819 <indexterm role="variable">
48820 <primary><varname>$domain</varname></primary>
48821 </indexterm>
48822 <indexterm role="variable">
48823 <primary><varname>$local_part</varname></primary>
48824 </indexterm>
48825 This form of rewrite rule allows for the handling of addresses that are not
48826 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
48827 input). Because the input is not required to be a syntactically valid address,
48828 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
48829 expansion of the replacement string. The result of rewriting replaces the
48830 original address in the MAIL or RCPT command.
48831 </para>
48832 </section>
48833 <section id="SECID155">
48834 <title>Flags controlling the rewriting process</title>
48835 <para>
48836 There are four flags which control the way the rewriting process works. These
48837 take effect only when a rule is invoked, that is, when the address is of the
48838 correct type (matches the flags) and matches the pattern:
48839 </para>
48840 <itemizedlist>
48841 <listitem>
48842 <para>
48843 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
48844 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
48845 absence of <quote>Q</quote> the rewritten address must always include a domain.
48846 </para>
48847 </listitem>
48848 <listitem>
48849 <para>
48850 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
48851 even if no rewriting actually takes place because of a <quote>fail</quote> in the
48852 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
48853 (does not match the flags) or does not match the pattern.
48854 </para>
48855 </listitem>
48856 <listitem>
48857 <para>
48858 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
48859 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
48860 rewriting once it fails to match (after at least one successful rewrite).
48861 </para>
48862 </listitem>
48863 <listitem>
48864 <para>
48865 <indexterm role="concept">
48866 <primary>rewriting</primary>
48867 <secondary>whole addresses</secondary>
48868 </indexterm>
48869 When an address in a header is rewritten, the rewriting normally applies only
48870 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
48871 left unchanged. For example, rewriting might change
48872 </para>
48873 <literallayout class="monospaced">
48874 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
48875 </literallayout>
48876 <para>
48877 into
48878 </para>
48879 <literallayout class="monospaced">
48880 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
48881 </literallayout>
48882 <para>
48883 <indexterm role="concept">
48884 <primary>RFC 2047</primary>
48885 </indexterm>
48886 Sometimes there is a need to replace the whole address item, and this can be
48887 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
48888 causes an address in a header line to be rewritten, the entire address is
48889 replaced, not just the working part. The replacement must be a complete RFC
48890 2822 address, including the angle brackets if necessary. If text outside angle
48891 brackets contains a character whose value is greater than 126 or less than 32
48892 (except for tab), the text is encoded according to RFC 2047. The character set
48893 is taken from <option>headers_charset</option>, which gets its default at build time.
48894 </para>
48895 <para>
48896 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
48897 rewritten, all but the working part of the replacement address is discarded.
48898 </para>
48899 </listitem>
48900 </itemizedlist>
48901 </section>
48902 <section id="SECID156">
48903 <title>Rewriting examples</title>
48904 <para>
48905 Here is an example of the two common rewriting paradigms:
48906 </para>
48907 <literallayout class="monospaced">
48908 *@*.hitch.fict.example  $1@hitch.fict.example
48909 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
48910                      {$value}fail}@hitch.fict.example bctfrF
48911 </literallayout>
48912 <para>
48913 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
48914 the string expansion to fail if the lookup does not succeed. In this context it
48915 has the effect of leaving the original address unchanged, but Exim goes on to
48916 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
48917 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
48918 explicitly, which would cause the rewritten address to be the same as before,
48919 at the cost of a small bit of processing. Not supplying either of these is an
48920 error, since the rewritten address would then contain no local part.
48921 </para>
48922 <para>
48923 The first example above replaces the domain with a superior, more general
48924 domain. This may not be desirable for certain local parts. If the rule
48925 </para>
48926 <literallayout class="monospaced">
48927 root@*.hitch.fict.example  *
48928 </literallayout>
48929 <para>
48930 were inserted before the first rule, rewriting would be suppressed for the
48931 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
48932 </para>
48933 <para>
48934 Rewriting can be made conditional on a number of tests, by making use of
48935 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
48936 messages that originate outside the local host:
48937 </para>
48938 <literallayout class="monospaced">
48939 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
48940                          {$1@hitch.fict.example}fail}"
48941 </literallayout>
48942 <para>
48943 The replacement string is quoted in this example because it contains white
48944 space.
48945 </para>
48946 <para>
48947 <indexterm role="concept">
48948 <primary>rewriting</primary>
48949 <secondary>bang paths</secondary>
48950 </indexterm>
48951 <indexterm role="concept">
48952 <primary>bang paths</primary>
48953 <secondary>rewriting</secondary>
48954 </indexterm>
48955 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
48956 an address it treats it as an unqualified local part which it qualifies with
48957 the local qualification domain (if the source of the message is local or if the
48958 remote host is permitted to send unqualified addresses). Rewriting can
48959 sometimes be used to handle simple bang paths with a fixed number of
48960 components. For example, the rule
48961 </para>
48962 <literallayout class="monospaced">
48963 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
48964 </literallayout>
48965 <para>
48966 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
48967 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
48968 a global rewriting rule for envelope addresses. It can provide a backdoor
48969 method for using your system as a relay, because the incoming addresses appear
48970 to be local. If the bang path addresses are received via SMTP, it is safer to
48971 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
48972 can be done on the rewritten addresses.
48973 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
48974 </para>
48975 </section>
48976 </chapter>
48977
48978 <chapter id="CHAPretry">
48979 <title>Retry configuration</title>
48980 <para>
48981 <indexterm role="concept" id="IIDretconf1" class="startofrange">
48982 <primary>retry</primary>
48983 <secondary>configuration, description of</secondary>
48984 </indexterm>
48985 <indexterm role="concept" id="IIDregconf2" class="startofrange">
48986 <primary>configuration file</primary>
48987 <secondary>retry section</secondary>
48988 </indexterm>
48989 The <quote>retry</quote> section of the runtime configuration file contains a list of
48990 retry rules that control how often Exim tries to deliver messages that cannot
48991 be delivered at the first attempt. If there are no retry rules (the section is
48992 empty or not present), there are no retries. In this situation, temporary
48993 errors are treated as permanent. The default configuration contains a single,
48994 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
48995 line option can be used to test which retry rule will be used for a given
48996 address, domain and error.
48997 </para>
48998 <para>
48999 The most common cause of retries is temporary failure to deliver to a remote
49000 host because the host is down, or inaccessible because of a network problem.
49001 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
49002 address) basis, not on a per-message basis. Thus, if one message has recently
49003 been delayed, delivery of a new message to the same host is not immediately
49004 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
49005 log selector is set, the message
49006 <indexterm role="concept">
49007 <primary>retry</primary>
49008 <secondary>time not reached</secondary>
49009 </indexterm>
49010 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
49011 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
49012 the handling of errors during remote deliveries.
49013 </para>
49014 <para>
49015 Retry processing applies to routing as well as to delivering, except as covered
49016 in the next paragraph. The retry rules do not distinguish between these
49017 actions. It is not possible, for example, to specify different behaviour for
49018 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
49019 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
49020 added complication, so did not implement it. However, although they share the
49021 same retry rule, the actual retry times for routing and transporting a given
49022 domain are maintained independently.
49023 </para>
49024 <para>
49025 When a delivery is not part of a queue run (typically an immediate delivery on
49026 receipt of a message), the routers are always run, and local deliveries are
49027 always attempted, even if retry times are set for them. This makes for better
49028 behaviour if one particular message is causing problems (for example, causing
49029 quota overflow, or provoking an error in a filter file). If such a delivery
49030 suffers a temporary failure, the retry data is updated as normal, and
49031 subsequent delivery attempts from queue runs occur only when the retry time for
49032 the local address is reached.
49033 </para>
49034 <section id="SECID157">
49035 <title>Changing retry rules</title>
49036 <para>
49037 If you change the retry rules in your configuration, you should consider
49038 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
49039 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
49040 always safe; that is why they are called <quote>hints</quote>.
49041 </para>
49042 <para>
49043 The hints retry data contains suggested retry times based on the previous
49044 rules. In the case of a long-running problem with a remote host, it might
49045 record the fact that the host has timed out. If your new rules increase the
49046 timeout time for such a host, you should definitely remove the old retry data
49047 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
49048 messages that it should now be retaining.
49049 </para>
49050 </section>
49051 <section id="SECID158">
49052 <title>Format of retry rules</title>
49053 <para>
49054 <indexterm role="concept">
49055 <primary>retry</primary>
49056 <secondary>rules</secondary>
49057 </indexterm>
49058 Each retry rule occupies one line and consists of three or four parts,
49059 separated by white space: a pattern, an error name, an optional list of sender
49060 addresses, and a list of retry parameters. The pattern and sender lists must be
49061 enclosed in double quotes if they contain white space. The rules are searched
49062 in order until one is found where the pattern, error name, and sender list (if
49063 present) match the failing host or address, the error that occurred, and the
49064 message&#x2019;s sender, respectively.
49065 </para>
49066 <para>
49067 The pattern is any single item that may appear in an address list (see section
49068 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
49069 which means that it is expanded before being tested against the address that
49070 has been delayed. A negated address list item is permitted. Address
49071 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
49072 which makes it possible for many retry rules to start with just a domain. For
49073 example,
49074 </para>
49075 <literallayout class="monospaced">
49076 lookingglass.fict.example        *  F,24h,30m;
49077 </literallayout>
49078 <para>
49079 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
49080 whereas
49081 </para>
49082 <literallayout class="monospaced">
49083 alice@lookingglass.fict.example  *  F,24h,30m;
49084 </literallayout>
49085 <para>
49086 applies only to temporary failures involving the local part <option>alice</option>.
49087 In practice, almost all rules start with a domain name pattern without a local
49088 part.
49089 </para>
49090 <para>
49091 <indexterm role="concept">
49092 <primary>regular expressions</primary>
49093 <secondary>in retry rules</secondary>
49094 </indexterm>
49095 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
49096 must match a complete address, not just a domain, because that is how regular
49097 expressions work in address lists.
49098 </para>
49099 <literallayout>
49100 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
49101 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
49102 </literallayout>
49103 </section>
49104 <section id="SECID159">
49105 <title>Choosing which retry rule to use for address errors</title>
49106 <para>
49107 When Exim is looking for a retry rule after a routing attempt has failed (for
49108 example, after a DNS timeout), each line in the retry configuration is tested
49109 against the complete address only if <option>retry_use_local_part</option> is set for the
49110 router. Otherwise, only the domain is used, except when matching against a
49111 regular expression, when the local part of the address is replaced with <quote>*</quote>.
49112 A domain on its own can match a domain pattern, or a pattern that starts with
49113 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
49114 <option>check_local_user</option> is true, and false for other routers.
49115 </para>
49116 <para>
49117 Similarly, when Exim is looking for a retry rule after a local delivery has
49118 failed (for example, after a mailbox full error), each line in the retry
49119 configuration is tested against the complete address only if
49120 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
49121 local transports).
49122 </para>
49123 <para>
49124 <indexterm role="concept">
49125 <primary>4<emphasis>xx</emphasis> responses</primary>
49126 <secondary>retry rules for</secondary>
49127 </indexterm>
49128 However, when Exim is looking for a retry rule after a remote delivery attempt
49129 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
49130 whole address is always used as the key when searching the retry rules. The
49131 rule that is found is used to create a retry time for the combination of the
49132 failing address and the message&#x2019;s sender. It is the combination of sender and
49133 recipient that is delayed in subsequent queue runs until its retry time is
49134 reached. You can delay the recipient without regard to the sender by setting
49135 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
49136 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
49137 commands.
49138 </para>
49139 </section>
49140 <section id="SECID160">
49141 <title>Choosing which retry rule to use for host and message errors</title>
49142 <para>
49143 For a temporary error that is not related to an individual address (for
49144 example, a connection timeout), each line in the retry configuration is checked
49145 twice. First, the name of the remote host is used as a domain name (preceded by
49146 <quote>*@</quote> when matching a regular expression). If this does not match the line,
49147 the domain from the email address is tried in a similar fashion. For example,
49148 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
49149 </para>
49150 <literallayout class="monospaced">
49151 a.b.c.example  MX  5  x.y.z.example
49152                MX  6  p.q.r.example
49153                MX  7  m.n.o.example
49154 </literallayout>
49155 <para>
49156 and the retry rules are
49157 </para>
49158 <literallayout class="monospaced">
49159 p.q.r.example    *      F,24h,30m;
49160 a.b.c.example    *      F,4d,45m;
49161 </literallayout>
49162 <para>
49163 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
49164 first rule matches neither the host nor the domain, so Exim looks at the second
49165 rule. This does not match the host, but it does match the domain, so it is used
49166 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
49167 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
49168 first retry rule is used, because it matches the host.
49169 </para>
49170 <para>
49171 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
49172 first rule to determine retry times, but for all the other hosts for the domain
49173 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
49174 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
49175 </para>
49176 <para>
49177 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
49178 However, if a message is routed directly to an IP address without the use of a
49179 host name, for example, if a <command>manualroute</command> router contains a setting such as:
49180 </para>
49181 <literallayout class="monospaced">
49182 route_list = *.a.example  192.168.34.23
49183 </literallayout>
49184 <para>
49185 then the <quote>host name</quote> that is used when searching for a retry rule is the
49186 textual form of the IP address.
49187 </para>
49188 </section>
49189 <section id="SECID161">
49190 <title>Retry rules for specific errors</title>
49191 <para>
49192 <indexterm role="concept">
49193 <primary>retry</primary>
49194 <secondary>specific errors; specifying</secondary>
49195 </indexterm>
49196 The second field in a retry rule is the name of a particular error, or an
49197 asterisk, which matches any error. The errors that can be tested for are:
49198 </para>
49199 <variablelist>
49200 <varlistentry>
49201 <term><option>auth_failed</option></term>
49202 <listitem>
49203 <para>
49204 Authentication failed when trying to send to a host in the
49205 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
49206 </para>
49207 </listitem></varlistentry>
49208 <varlistentry>
49209 <term><option>data_4xx</option></term>
49210 <listitem>
49211 <para>
49212 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
49213 after the command, or after sending the message&#x2019;s data.
49214 </para>
49215 </listitem></varlistentry>
49216 <varlistentry>
49217 <term><option>mail_4xx</option></term>
49218 <listitem>
49219 <para>
49220 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
49221 </para>
49222 </listitem></varlistentry>
49223 <varlistentry>
49224 <term><option>rcpt_4xx</option></term>
49225 <listitem>
49226 <para>
49227 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
49228 </para>
49229 </listitem></varlistentry>
49230 </variablelist>
49231 <para>
49232 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
49233 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
49234 recognize 452 errors given to RCPT commands for addresses in a certain domain,
49235 and have retries every ten minutes with a one-hour timeout, you could set up a
49236 retry rule of this form:
49237 </para>
49238 <literallayout class="monospaced">
49239 the.domain.name  rcpt_452   F,1h,10m
49240 </literallayout>
49241 <para>
49242 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
49243 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
49244 </para>
49245 <variablelist>
49246 <varlistentry>
49247 <term><option>lost_connection</option></term>
49248 <listitem>
49249 <para>
49250 A server unexpectedly closed the SMTP connection. There may, of course,
49251 legitimate reasons for this (host died, network died), but if it repeats a lot
49252 for the same host, it indicates something odd.
49253 </para>
49254 </listitem></varlistentry>
49255 <varlistentry>
49256 <term><option>lookup</option></term>
49257 <listitem>
49258 <para>
49259 A DNS lookup for a host failed.
49260 Note that a <option>dnslookup</option> router will need to have matched
49261 its <option>fail_defer_domains</option> option for this retry type to be usable.
49262 Also note that a <option>manualroute</option> router will probably need
49263 its <option>host_find_failed</option> option set to <option>defer</option>.
49264 </para>
49265 </listitem></varlistentry>
49266 <varlistentry>
49267 <term><option>refused_MX</option></term>
49268 <listitem>
49269 <para>
49270 A connection to a host obtained from an MX record was refused.
49271 </para>
49272 </listitem></varlistentry>
49273 <varlistentry>
49274 <term><option>refused_A</option></term>
49275 <listitem>
49276 <para>
49277 A connection to a host not obtained from an MX record was refused.
49278 </para>
49279 </listitem></varlistentry>
49280 <varlistentry>
49281 <term><option>refused</option></term>
49282 <listitem>
49283 <para>
49284 A connection was refused.
49285 </para>
49286 </listitem></varlistentry>
49287 <varlistentry>
49288 <term><option>timeout_connect_MX</option></term>
49289 <listitem>
49290 <para>
49291 A connection attempt to a host obtained from an MX record timed out.
49292 </para>
49293 </listitem></varlistentry>
49294 <varlistentry>
49295 <term><option>timeout_connect_A</option></term>
49296 <listitem>
49297 <para>
49298 A connection attempt to a host not obtained from an MX record timed out.
49299 </para>
49300 </listitem></varlistentry>
49301 <varlistentry>
49302 <term><option>timeout_connect</option></term>
49303 <listitem>
49304 <para>
49305 A connection attempt timed out.
49306 </para>
49307 </listitem></varlistentry>
49308 <varlistentry>
49309 <term><option>timeout_MX</option></term>
49310 <listitem>
49311 <para>
49312 There was a timeout while connecting or during an SMTP session with a host
49313 obtained from an MX record.
49314 </para>
49315 </listitem></varlistentry>
49316 <varlistentry>
49317 <term><option>timeout_A</option></term>
49318 <listitem>
49319 <para>
49320 There was a timeout while connecting or during an SMTP session with a host not
49321 obtained from an MX record.
49322 </para>
49323 </listitem></varlistentry>
49324 <varlistentry>
49325 <term><option>timeout</option></term>
49326 <listitem>
49327 <para>
49328 There was a timeout while connecting or during an SMTP session.
49329 </para>
49330 </listitem></varlistentry>
49331 <varlistentry>
49332 <term><option>tls_required</option></term>
49333 <listitem>
49334 <para>
49335 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
49336 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
49337 to STARTTLS, or there was a problem setting up the TLS connection.
49338 </para>
49339 </listitem></varlistentry>
49340 <varlistentry>
49341 <term><option>quota</option></term>
49342 <listitem>
49343 <para>
49344 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
49345 transport.
49346 </para>
49347 </listitem></varlistentry>
49348 <varlistentry>
49349 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
49350 <listitem>
49351 <para>
49352 <indexterm role="concept">
49353 <primary>quota</primary>
49354 <secondary>error testing in retry rule</secondary>
49355 </indexterm>
49356 <indexterm role="concept">
49357 <primary>retry</primary>
49358 <secondary>quota error testing</secondary>
49359 </indexterm>
49360 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
49361 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
49362 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
49363 for four days.
49364 </para>
49365 </listitem></varlistentry>
49366 </variablelist>
49367 <para>
49368 <indexterm role="concept">
49369 <primary>mailbox</primary>
49370 <secondary>time of last read</secondary>
49371 </indexterm>
49372 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
49373 timeouts when the mailbox is full and is not being read by its owner. Ideally,
49374 it should be based on the last time that the user accessed the mailbox.
49375 However, it is not always possible to determine this. Exim uses the following
49376 heuristic rules:
49377 </para>
49378 <itemizedlist>
49379 <listitem>
49380 <para>
49381 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
49382 used. As no new messages are being delivered (because the mailbox is over
49383 quota), Exim does not access the file, so this is the time of last user access.
49384 </para>
49385 </listitem>
49386 <listitem>
49387 <para>
49388 <indexterm role="concept">
49389 <primary>maildir format</primary>
49390 <secondary>time of last read</secondary>
49391 </indexterm>
49392 For a maildir delivery, the time of last modification of the <filename>new</filename>
49393 subdirectory is used. As the mailbox is over quota, no new files are created in
49394 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
49395 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
49396 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
49397 time that is used is therefore the last time that the user read a new message.
49398 </para>
49399 </listitem>
49400 <listitem>
49401 <para>
49402 For other kinds of multi-file mailbox, the time of last access cannot be
49403 obtained, so a retry rule that uses this type of error field is never matched.
49404 </para>
49405 </listitem>
49406 </itemizedlist>
49407 <para>
49408 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
49409 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
49410 when a local delivery is deferred because a partition is full (the ENOSPC
49411 error).
49412 </para>
49413 </section>
49414 <section id="SECID162">
49415 <title>Retry rules for specified senders</title>
49416 <para>
49417 <indexterm role="concept">
49418 <primary>retry</primary>
49419 <secondary>rules; sender-specific</secondary>
49420 </indexterm>
49421 You can specify retry rules that apply only when the failing message has a
49422 specific sender. In particular, this can be used to define retry rules that
49423 apply only to bounce messages. The third item in a retry rule can be of this
49424 form:
49425 </para>
49426 <literallayout>
49427 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
49428 </literallayout>
49429 <para>
49430 The retry timings themselves are then the fourth item. For example:
49431 </para>
49432 <literallayout class="monospaced">
49433 *   rcpt_4xx   senders=:   F,1h,30m
49434 </literallayout>
49435 <para>
49436 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
49437 host. If the address list contains white space, it must be enclosed in quotes.
49438 For example:
49439 </para>
49440 <literallayout class="monospaced">
49441 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
49442 </literallayout>
49443 <para>
49444 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
49445 (which do not depend on the recipient). The reason is that the sender is used
49446 only to match the retry rule. Once the rule has been found for a host error,
49447 its contents are used to set a retry time for the host, and this will apply to
49448 all messages, not just those with specific senders.
49449 </para>
49450 <para>
49451 When testing retry rules using <option>-brt</option>, you can supply a sender using the
49452 <option>-f</option> command line option, like this:
49453 </para>
49454 <literallayout class="monospaced">
49455 exim -f "" -brt user@dom.ain
49456 </literallayout>
49457 <para>
49458 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
49459 list is never matched.
49460 </para>
49461 </section>
49462 <section id="SECID163">
49463 <title>Retry parameters</title>
49464 <para>
49465 <indexterm role="concept">
49466 <primary>retry</primary>
49467 <secondary>parameters in rules</secondary>
49468 </indexterm>
49469 The third (or fourth, if a senders list is present) field in a retry rule is a
49470 sequence of retry parameter sets, separated by semicolons. Each set consists of
49471 </para>
49472 <literallayout>
49473 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
49474 </literallayout>
49475 <para>
49476 The letter identifies the algorithm for computing a new retry time; the cutoff
49477 time is the time beyond which this algorithm no longer applies, and the
49478 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
49479 time that the first failure for the domain (combined with the local part if
49480 relevant) was detected, not from the time the message was received.
49481 </para>
49482 <para>
49483 <indexterm role="concept">
49484 <primary>retry</primary>
49485 <secondary>algorithms</secondary>
49486 </indexterm>
49487 <indexterm role="concept">
49488 <primary>retry</primary>
49489 <secondary>fixed intervals</secondary>
49490 </indexterm>
49491 <indexterm role="concept">
49492 <primary>retry</primary>
49493 <secondary>increasing intervals</secondary>
49494 </indexterm>
49495 <indexterm role="concept">
49496 <primary>retry</primary>
49497 <secondary>random intervals</secondary>
49498 </indexterm>
49499 The available algorithms are:
49500 </para>
49501 <itemizedlist>
49502 <listitem>
49503 <para>
49504 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
49505 the interval.
49506 </para>
49507 </listitem>
49508 <listitem>
49509 <para>
49510 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
49511 specifies a starting value for the interval, and the second a multiplier, which
49512 is used to increase the size of the interval at each retry.
49513 </para>
49514 </listitem>
49515 <listitem>
49516 <para>
49517 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
49518 retry, the previous interval is multiplied by the factor in order to get a
49519 maximum for the next interval. The minimum interval is the first argument of
49520 the parameter, and an actual interval is chosen randomly between them. Such a
49521 rule has been found to be helpful in cluster configurations when all the
49522 members of the cluster restart at once, and may therefore synchronize their
49523 queue processing times.
49524 </para>
49525 </listitem>
49526 </itemizedlist>
49527 <para>
49528 When computing the next retry time, the algorithm definitions are scanned in
49529 order until one whose cutoff time has not yet passed is reached. This is then
49530 used to compute a new retry time that is later than the current time. In the
49531 case of fixed interval retries, this simply means adding the interval to the
49532 current time. For geometrically increasing intervals, retry intervals are
49533 computed from the rule&#x2019;s parameters until one that is greater than the previous
49534 interval is found. The main configuration variable
49535 <indexterm role="concept">
49536 <primary>limit</primary>
49537 <secondary>retry interval</secondary>
49538 </indexterm>
49539 <indexterm role="concept">
49540 <primary>retry</primary>
49541 <secondary>interval, maximum</secondary>
49542 </indexterm>
49543 <indexterm role="option">
49544 <primary><option>retry_interval_max</option></primary>
49545 </indexterm>
49546 <option>retry_interval_max</option> limits the maximum interval between retries. It
49547 cannot be set greater than <literal>24h</literal>, which is its default value.
49548 </para>
49549 <para>
49550 A single remote domain may have a number of hosts associated with it, and each
49551 host may have more than one IP address. Retry algorithms are selected on the
49552 basis of the domain name, but are applied to each IP address independently. If,
49553 for example, a host has two IP addresses and one is unusable, Exim will
49554 generate retry times for it and will not try to use it until its next retry
49555 time comes. Thus the good IP address is likely to be tried first most of the
49556 time.
49557 </para>
49558 <para>
49559 <indexterm role="concept">
49560 <primary>hints database</primary>
49561 <secondary>use for retrying</secondary>
49562 </indexterm>
49563 Retry times are hints rather than promises. Exim does not make any attempt to
49564 run deliveries exactly at the computed times. Instead, a queue runner process
49565 starts delivery processes for delayed messages periodically, and these attempt
49566 new deliveries only for those addresses that have passed their next retry time.
49567 If a new message arrives for a deferred address, an immediate delivery attempt
49568 occurs only if the address has passed its retry time. In the absence of new
49569 messages, the minimum time between retries is the interval between queue runner
49570 processes. There is not much point in setting retry times of five minutes if
49571 your queue runners happen only once an hour, unless there are a significant
49572 number of incoming messages (which might be the case on a system that is
49573 sending everything to a smart host, for example).
49574 </para>
49575 <para>
49576 The data in the retry hints database can be inspected by using the
49577 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
49578 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
49579 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
49580 are for the hosts associated with a particular mail domain, and also for local
49581 deliveries that have been deferred.
49582 </para>
49583 </section>
49584 <section id="SECID164">
49585 <title>Retry rule examples</title>
49586 <para>
49587 Here are some example retry rules:
49588 </para>
49589 <literallayout class="monospaced">
49590 alice@wonderland.fict.example quota_5d  F,7d,3h
49591 wonderland.fict.example       quota_5d
49592 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
49593 lookingglass.fict.example     *         F,24h,30m;
49594 *                 refused_A   F,2h,20m;
49595 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
49596 </literallayout>
49597 <para>
49598 The first rule sets up special handling for mail to
49599 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
49600 mailbox has not been read for at least 5 days. Retries continue every three
49601 hours for 7 days. The second rule handles over-quota errors for all other local
49602 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
49603 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
49604 fail are bounced immediately if the mailbox has not been read for at least 5
49605 days.
49606 </para>
49607 <para>
49608 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
49609 happen every 15 minutes for an hour, then with geometrically increasing
49610 intervals until two days have passed since a delivery first failed. After the
49611 first hour there is a delay of one hour, then two hours, then four hours, and
49612 so on (this is a rather extreme example).
49613 </para>
49614 <para>
49615 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
49616 They happen every 30 minutes for 24 hours only. The remaining two rules handle
49617 all other domains, with special action for connection refusal from hosts that
49618 were not obtained from an MX record.
49619 </para>
49620 <para>
49621 The final rule in a retry configuration should always have asterisks in the
49622 first two fields so as to provide a general catch-all for any addresses that do
49623 not have their own special handling. This example tries every 15 minutes for 2
49624 hours, then with intervals starting at one hour and increasing by a factor of
49625 1.5 up to 16 hours, then every 8 hours up to 5 days.
49626 </para>
49627 </section>
49628 <section id="SECID165">
49629 <title>Timeout of retry data</title>
49630 <para>
49631 <indexterm role="concept">
49632 <primary>timeout</primary>
49633 <secondary>of retry data</secondary>
49634 </indexterm>
49635 <indexterm role="option">
49636 <primary><option>retry_data_expire</option></primary>
49637 </indexterm>
49638 <indexterm role="concept">
49639 <primary>hints database</primary>
49640 <secondary>data expiry</secondary>
49641 </indexterm>
49642 <indexterm role="concept">
49643 <primary>retry</primary>
49644 <secondary>timeout of data</secondary>
49645 </indexterm>
49646 Exim timestamps the data that it writes to its retry hints database. When it
49647 consults the data during a delivery it ignores any that is older than the value
49648 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
49649 been tried for 7 days, Exim will try to deliver to it immediately a message
49650 arrives, and if that fails, it will calculate a retry time as if it were
49651 failing for the first time.
49652 </para>
49653 <para>
49654 This improves the behaviour for messages routed to rarely-used hosts such as MX
49655 backups. If such a host was down at one time, and happens to be down again when
49656 Exim tries a month later, using the old retry data would imply that it had been
49657 down all the time, which is not a justified assumption.
49658 </para>
49659 <para>
49660 If a host really is permanently dead, this behaviour causes a burst of retries
49661 every now and again, but only if messages routed to it are rare. If there is a
49662 message at least once every 7 days the retry data never expires.
49663 </para>
49664 </section>
49665 <section id="SECID166">
49666 <title>Long-term failures</title>
49667 <para>
49668 <indexterm role="concept">
49669 <primary>delivery failure, long-term</primary>
49670 </indexterm>
49671 <indexterm role="concept">
49672 <primary>retry</primary>
49673 <secondary>after long-term failure</secondary>
49674 </indexterm>
49675 Special processing happens when an email address has been failing for so long
49676 that the cutoff time for the last algorithm is reached. For example, using the
49677 default retry rule:
49678 </para>
49679 <literallayout class="monospaced">
49680 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
49681 </literallayout>
49682 <para>
49683 the cutoff time is four days. Reaching the retry cutoff is independent of how
49684 long any specific message has been failing; it is the length of continuous
49685 failure for the recipient address that counts.
49686 </para>
49687 <para>
49688 When the cutoff time is reached for a local delivery, or for all the IP
49689 addresses associated with a remote delivery, a subsequent delivery failure
49690 causes Exim to give up on the address, and a bounce message is generated.
49691 In order to cater for new messages that use the failing address, a next retry
49692 time is still computed from the final algorithm, and is used as follows:
49693 </para>
49694 <para>
49695 For local deliveries, one delivery attempt is always made for any subsequent
49696 messages. If this delivery fails, the address fails immediately. The
49697 post-cutoff retry time is not used.
49698 </para>
49699 <para>
49700 If the delivery is remote, there are two possibilities, controlled by the
49701 <indexterm role="option">
49702 <primary><option>delay_after_cutoff</option></primary>
49703 </indexterm>
49704 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
49705 default. Until the post-cutoff retry time for one of the IP addresses is
49706 reached, the failing email address is bounced immediately, without a delivery
49707 attempt taking place. After that time, one new delivery attempt is made to
49708 those IP addresses that are past their retry times, and if that still fails,
49709 the address is bounced and new retry times are computed.
49710 </para>
49711 <para>
49712 In other words, when all the hosts for a given email address have been failing
49713 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
49714 times is reached. Then it tries once, and bounces if that attempt fails. This
49715 behaviour ensures that few resources are wasted in repeatedly trying to deliver
49716 to a broken destination, but if the host does recover, Exim will eventually
49717 notice.
49718 </para>
49719 <para>
49720 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
49721 addresses are past their final cutoff time, Exim tries to deliver to those IP
49722 addresses that have not been tried since the message arrived. If there are
49723 no suitable IP addresses, or if they all fail, the address is bounced. In other
49724 words, it does not delay when a new message arrives, but tries the expired
49725 addresses immediately, unless they have been tried since the message arrived.
49726 If there is a continuous stream of messages for the failing domains, setting
49727 <option>delay_after_cutoff</option> false means that there will be many more attempts to
49728 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
49729 true.
49730 </para>
49731 </section>
49732 <section id="SECID167">
49733 <title>Deliveries that work intermittently</title>
49734 <para>
49735 <indexterm role="concept">
49736 <primary>retry</primary>
49737 <secondary>intermittently working deliveries</secondary>
49738 </indexterm>
49739 Some additional logic is needed to cope with cases where a host is
49740 intermittently available, or when a message has some attribute that prevents
49741 its delivery when others to the same address get through. In this situation,
49742 because some messages are successfully delivered, the <quote>retry clock</quote> for the
49743 host or address keeps getting reset by the successful deliveries, and so
49744 failing messages remain on the queue for ever because the cutoff time is never
49745 reached.
49746 </para>
49747 <para>
49748 Two exceptional actions are applied to prevent this happening. The first
49749 applies to errors that are related to a message rather than a remote host.
49750 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
49751 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
49752 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
49753 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
49754 is used when scanning the retry rules to decide when to try next and when to
49755 time out the address.
49756 </para>
49757 <para>
49758 The exceptional second action applies in all cases. If a message has been on
49759 the queue for longer than the cutoff time of any applicable retry rule for a
49760 given address, a delivery is attempted for that address, even if it is not yet
49761 time, and if this delivery fails, the address is timed out. A new retry time is
49762 not computed in this case, so that other messages for the same address are
49763 considered immediately.
49764 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
49765 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
49766 </para>
49767 </section>
49768 </chapter>
49769
49770 <chapter id="CHAPSMTPAUTH">
49771 <title>SMTP authentication</title>
49772 <para>
49773 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
49774 <primary>SMTP</primary>
49775 <secondary>authentication configuration</secondary>
49776 </indexterm>
49777 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
49778 <primary>authentication</primary>
49779 </indexterm>
49780 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
49781 with SMTP authentication. This facility is an extension to the SMTP protocol,
49782 described in RFC 2554, which allows a client SMTP host to authenticate itself
49783 to a server. This is a common way for a server to recognize clients that are
49784 permitted to use it as a relay. SMTP authentication is not of relevance to the
49785 transfer of mail between servers that have no managerial connection with each
49786 other.
49787 </para>
49788 <para>
49789 <indexterm role="concept">
49790 <primary>AUTH</primary>
49791 <secondary>description of</secondary>
49792 </indexterm>
49793 Very briefly, the way SMTP authentication works is as follows:
49794 </para>
49795 <itemizedlist>
49796 <listitem>
49797 <para>
49798 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
49799 the client&#x2019;s EHLO command.
49800 </para>
49801 </listitem>
49802 <listitem>
49803 <para>
49804 The client issues an AUTH command, naming a specific mechanism. The command
49805 may, optionally, contain some authentication data.
49806 </para>
49807 </listitem>
49808 <listitem>
49809 <para>
49810 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
49811 appropriate responses. In simple authentication mechanisms, the challenges are
49812 just prompts for user names and passwords. The server does not have to issue
49813 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
49814 with the AUTH command.
49815 </para>
49816 </listitem>
49817 <listitem>
49818 <para>
49819 The server either accepts or denies authentication.
49820 </para>
49821 </listitem>
49822 <listitem>
49823 <para>
49824 If authentication succeeds, the client may optionally make use of the AUTH
49825 option on the MAIL command to pass an authenticated sender in subsequent
49826 mail transactions. Authentication lasts for the remainder of the SMTP
49827 connection.
49828 </para>
49829 </listitem>
49830 <listitem>
49831 <para>
49832 If authentication fails, the client may give up, or it may try a different
49833 authentication mechanism, or it may try transferring mail over the
49834 unauthenticated connection.
49835 </para>
49836 </listitem>
49837 </itemizedlist>
49838 <para>
49839 If you are setting up a client, and want to know which authentication
49840 mechanisms the server supports, you can use Telnet to connect to port 25 (the
49841 SMTP port) on the server, and issue an EHLO command. The response to this
49842 includes the list of supported mechanisms. For example:
49843 </para>
49844 <literallayout>
49845 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
49846 <literal>Trying 192.168.34.25...</literal>
49847 <literal>Connected to server.example.</literal>
49848 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
49849 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
49850 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
49851 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
49852 <literal>250-SIZE 52428800</literal>
49853 <literal>250-PIPELINING</literal>
49854 <literal>250-AUTH PLAIN</literal>
49855 <literal>250 HELP</literal>
49856 </literallayout>
49857 <para>
49858 The second-last line of this example output shows that the server supports
49859 authentication using the PLAIN mechanism. In Exim, the different authentication
49860 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
49861 routers and transports, which authenticators are included in the binary is
49862 controlled by build-time definitions. The following are currently available,
49863 included by setting
49864 </para>
49865 <literallayout class="monospaced">
49866 AUTH_CRAM_MD5=yes
49867 AUTH_CYRUS_SASL=yes
49868 AUTH_DOVECOT=yes
49869 AUTH_GSASL=yes
49870 AUTH_HEIMDAL_GSSAPI=yes
49871 AUTH_PLAINTEXT=yes
49872 AUTH_SPA=yes
49873 AUTH_TLS=yes
49874 </literallayout>
49875 <para>
49876 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
49877 authentication mechanism (RFC 2195), and the second provides an interface to
49878 the Cyrus SASL authentication library.
49879 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
49880 work via a socket interface.
49881 The fourth provides an interface to the GNU SASL authentication library, which
49882 provides mechanisms but typically not data sources.
49883 The fifth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
49884 supporting setting a server keytab.
49885 The sixth can be configured to support
49886 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
49887 not formally documented, but used by several MUAs. The seventh authenticator
49888 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
49889 The eighth is an Exim authenticator but not an SMTP one;
49890 instead it can use information from a TLS negotiation.
49891 </para>
49892 <para>
49893 The authenticators are configured using the same syntax as other drivers (see
49894 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
49895 authentication section need be present in the configuration file. Each
49896 authenticator can in principle have both server and client functions. When Exim
49897 is receiving SMTP mail, it is acting as a server; when it is sending out
49898 messages over SMTP, it is acting as a client. Authenticator configuration
49899 options are provided for use in both these circumstances.
49900 </para>
49901 <para>
49902 To make it clear which options apply to which situation, the prefixes
49903 <option>server_</option> and <option>client_</option> are used on option names that are specific to
49904 either the server or the client function, respectively. Server and client
49905 functions are disabled if none of their options are set. If an authenticator is
49906 to be used for both server and client functions, a single definition, using
49907 both sets of options, is required. For example:
49908 </para>
49909 <literallayout class="monospaced">
49910 cram:
49911   driver = cram_md5
49912   public_name = CRAM-MD5
49913   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
49914   client_name = ph10
49915   client_secret = secret2
49916 </literallayout>
49917 <para>
49918 The <option>server_</option> option is used when Exim is acting as a server, and the
49919 <option>client_</option> options when it is acting as a client.
49920 </para>
49921 <para>
49922 Descriptions of the individual authenticators are given in subsequent chapters.
49923 The remainder of this chapter covers the generic options for the
49924 authenticators, followed by general discussion of the way authentication works
49925 in Exim.
49926 </para>
49927 <para>
49928 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
49929 per-mechanism basis.  Please read carefully to determine which variables hold
49930 account labels such as usercodes and which hold passwords or other
49931 authenticating data.
49932 </para>
49933 <para>
49934 Note that some mechanisms support two different identifiers for accounts: the
49935 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
49936 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
49937 Conceptually, authentication data such as passwords are tied to the identifier
49938 used to authenticate; servers may have rules to permit one user to act as a
49939 second user, so that after login the session is treated as though that second
49940 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
49941 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
49942 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
49943 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
49944 choose to honour.
49945 </para>
49946 <para>
49947 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
49948 to a client to help it select an account and credentials to use.  In some
49949 mechanisms, the client and server provably agree on the realm, but clients
49950 typically can not treat the realm as secure data to be blindly trusted.
49951 </para>
49952 <section id="SECID168">
49953 <title>Generic options for authenticators</title>
49954 <para>
49955 <indexterm role="concept">
49956 <primary>authentication</primary>
49957 <secondary>generic options</secondary>
49958 </indexterm>
49959 <indexterm role="concept">
49960 <primary>options</primary>
49961 <secondary>generic; for authenticators</secondary>
49962 </indexterm>
49963 </para>
49964 <para>
49965 <indexterm role="option">
49966 <primary><option>client_condition</option></primary>
49967 </indexterm>
49968 </para>
49969 <informaltable frame="all">
49970 <tgroup cols="4" colsep="0" rowsep="0">
49971 <colspec colwidth="8*" align="left"/>
49972 <colspec colwidth="6*" align="center"/>
49973 <colspec colwidth="6*" align="center"/>
49974 <colspec colwidth="6*" align="right"/>
49975 <tbody>
49976 <row>
49977 <entry><option>client_condition</option></entry>
49978 <entry>Use: <emphasis>authenticators</emphasis></entry>
49979 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49980 <entry>Default: <emphasis>unset</emphasis></entry>
49981 </row>
49982 </tbody>
49983 </tgroup>
49984 </informaltable>
49985 <para>
49986 When Exim is authenticating as a client, it skips any authenticator whose
49987 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
49988 used, for example, to skip plain text authenticators when the connection is not
49989 encrypted by a setting such as:
49990 </para>
49991 <literallayout class="monospaced">
49992 client_condition = ${if !eq{$tls_out_cipher}{}}
49993 </literallayout>
49994 <para>
49995 <indexterm role="option">
49996 <primary><option>client_set_id</option></primary>
49997 </indexterm>
49998 </para>
49999 <informaltable frame="all">
50000 <tgroup cols="4" colsep="0" rowsep="0">
50001 <colspec colwidth="8*" align="left"/>
50002 <colspec colwidth="6*" align="center"/>
50003 <colspec colwidth="6*" align="center"/>
50004 <colspec colwidth="6*" align="right"/>
50005 <tbody>
50006 <row>
50007 <entry><option>client_set_id</option></entry>
50008 <entry>Use: <emphasis>authenticators</emphasis></entry>
50009 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50010 <entry>Default: <emphasis>unset</emphasis></entry>
50011 </row>
50012 </tbody>
50013 </tgroup>
50014 </informaltable>
50015 <para>
50016 When client authentication succeeds, this condition is expanded; the
50017 result is used in the log lines for outbound messages.
50018 Typically it will be the user name used for authentication.
50019 </para>
50020 <para>
50021 <indexterm role="option">
50022 <primary><option>driver</option></primary>
50023 </indexterm>
50024 </para>
50025 <informaltable frame="all">
50026 <tgroup cols="4" colsep="0" rowsep="0">
50027 <colspec colwidth="8*" align="left"/>
50028 <colspec colwidth="6*" align="center"/>
50029 <colspec colwidth="6*" align="center"/>
50030 <colspec colwidth="6*" align="right"/>
50031 <tbody>
50032 <row>
50033 <entry><option>driver</option></entry>
50034 <entry>Use: <emphasis>authenticators</emphasis></entry>
50035 <entry>Type: <emphasis>string</emphasis></entry>
50036 <entry>Default: <emphasis>unset</emphasis></entry>
50037 </row>
50038 </tbody>
50039 </tgroup>
50040 </informaltable>
50041 <para>
50042 This option must always be set. It specifies which of the available
50043 authenticators is to be used.
50044 </para>
50045 <para>
50046 <indexterm role="option">
50047 <primary><option>public_name</option></primary>
50048 </indexterm>
50049 </para>
50050 <informaltable frame="all">
50051 <tgroup cols="4" colsep="0" rowsep="0">
50052 <colspec colwidth="8*" align="left"/>
50053 <colspec colwidth="6*" align="center"/>
50054 <colspec colwidth="6*" align="center"/>
50055 <colspec colwidth="6*" align="right"/>
50056 <tbody>
50057 <row>
50058 <entry><option>public_name</option></entry>
50059 <entry>Use: <emphasis>authenticators</emphasis></entry>
50060 <entry>Type: <emphasis>string</emphasis></entry>
50061 <entry>Default: <emphasis>unset</emphasis></entry>
50062 </row>
50063 </tbody>
50064 </tgroup>
50065 </informaltable>
50066 <para>
50067 This option specifies the name of the authentication mechanism that the driver
50068 implements, and by which it is known to the outside world. These names should
50069 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
50070 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
50071 defaults to the driver&#x2019;s instance name.
50072 </para>
50073 <para>
50074 <indexterm role="option">
50075 <primary><option>server_advertise_condition</option></primary>
50076 </indexterm>
50077 </para>
50078 <informaltable frame="all">
50079 <tgroup cols="4" colsep="0" rowsep="0">
50080 <colspec colwidth="8*" align="left"/>
50081 <colspec colwidth="6*" align="center"/>
50082 <colspec colwidth="6*" align="center"/>
50083 <colspec colwidth="6*" align="right"/>
50084 <tbody>
50085 <row>
50086 <entry><option>server_advertise_condition</option></entry>
50087 <entry>Use: <emphasis>authenticators</emphasis></entry>
50088 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50089 <entry>Default: <emphasis>unset</emphasis></entry>
50090 </row>
50091 </tbody>
50092 </tgroup>
50093 </informaltable>
50094 <para>
50095 When a server is about to advertise an authentication mechanism, the condition
50096 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
50097 mechanism is not advertised.
50098 If the expansion fails, the mechanism is not advertised. If the failure was not
50099 forced, and was not caused by a lookup defer, the incident is logged.
50100 See section <xref linkend="SECTauthexiser"/> below for further discussion.
50101 </para>
50102 <para>
50103 <indexterm role="option">
50104 <primary><option>server_condition</option></primary>
50105 </indexterm>
50106 </para>
50107 <informaltable frame="all">
50108 <tgroup cols="4" colsep="0" rowsep="0">
50109 <colspec colwidth="8*" align="left"/>
50110 <colspec colwidth="6*" align="center"/>
50111 <colspec colwidth="6*" align="center"/>
50112 <colspec colwidth="6*" align="right"/>
50113 <tbody>
50114 <row>
50115 <entry><option>server_condition</option></entry>
50116 <entry>Use: <emphasis>authenticators</emphasis></entry>
50117 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50118 <entry>Default: <emphasis>unset</emphasis></entry>
50119 </row>
50120 </tbody>
50121 </tgroup>
50122 </informaltable>
50123 <para>
50124 This option must be set for a <option>plaintext</option> server authenticator, where it
50125 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
50126 for details.
50127 </para>
50128 <para>
50129 For the <command>gsasl</command> authenticator, this option is required for various
50130 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
50131 </para>
50132 <para>
50133 For the other authenticators, <option>server_condition</option> can be used as an additional
50134 authentication or authorization mechanism that is applied after the other
50135 authenticator conditions succeed. If it is set, it is expanded when the
50136 authenticator would otherwise return a success code. If the expansion is forced
50137 to fail, authentication fails. Any other expansion failure causes a temporary
50138 error code to be returned. If the result of a successful expansion is an empty
50139 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
50140 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
50141 other result, a temporary error code is returned, with the expanded string as
50142 the error text.
50143 </para>
50144 <para>
50145 <indexterm role="option">
50146 <primary><option>server_debug_print</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_debug_print</option></entry>
50158 <entry>Use: <emphasis>authenticators</emphasis></entry>
50159 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50160 <entry>Default: <emphasis>unset</emphasis></entry>
50161 </row>
50162 </tbody>
50163 </tgroup>
50164 </informaltable>
50165 <para>
50166 If this option is set and authentication debugging is enabled (see the <option>-d</option>
50167 command line option), the string is expanded and included in the debugging
50168 output when the authenticator is run as a server. This can help with checking
50169 out the values of variables.
50170 If expansion of the string fails, the error message is written to the debugging
50171 output, and Exim carries on processing.
50172 </para>
50173 <para>
50174 <indexterm role="option">
50175 <primary><option>server_set_id</option></primary>
50176 </indexterm>
50177 </para>
50178 <informaltable frame="all">
50179 <tgroup cols="4" colsep="0" rowsep="0">
50180 <colspec colwidth="8*" align="left"/>
50181 <colspec colwidth="6*" align="center"/>
50182 <colspec colwidth="6*" align="center"/>
50183 <colspec colwidth="6*" align="right"/>
50184 <tbody>
50185 <row>
50186 <entry><option>server_set_id</option></entry>
50187 <entry>Use: <emphasis>authenticators</emphasis></entry>
50188 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50189 <entry>Default: <emphasis>unset</emphasis></entry>
50190 </row>
50191 </tbody>
50192 </tgroup>
50193 </informaltable>
50194 <para>
50195 <indexterm role="variable">
50196 <primary><varname>$authenticated_id</varname></primary>
50197 </indexterm>
50198 When an Exim server successfully authenticates a client, this string is
50199 expanded using data from the authentication, and preserved for any incoming
50200 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
50201 lines for incoming messages. For example, a user/password authenticator
50202 configuration might preserve the user name that was used to authenticate, and
50203 refer to it subsequently during delivery of the message.
50204 If expansion fails, the option is ignored.
50205 </para>
50206 <para>
50207 <indexterm role="option">
50208 <primary><option>server_mail_auth_condition</option></primary>
50209 </indexterm>
50210 </para>
50211 <informaltable frame="all">
50212 <tgroup cols="4" colsep="0" rowsep="0">
50213 <colspec colwidth="8*" align="left"/>
50214 <colspec colwidth="6*" align="center"/>
50215 <colspec colwidth="6*" align="center"/>
50216 <colspec colwidth="6*" align="right"/>
50217 <tbody>
50218 <row>
50219 <entry><option>server_mail_auth_condition</option></entry>
50220 <entry>Use: <emphasis>authenticators</emphasis></entry>
50221 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50222 <entry>Default: <emphasis>unset</emphasis></entry>
50223 </row>
50224 </tbody>
50225 </tgroup>
50226 </informaltable>
50227 <para>
50228 This option allows a server to discard authenticated sender addresses supplied
50229 as part of MAIL commands in SMTP connections that are authenticated by the
50230 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
50231 as part of the authentication process; instead its (unexpanded) value is
50232 remembered for later use.
50233 How it is used is described in the following section.
50234 </para>
50235 </section>
50236 <section id="SECTauthparamail">
50237 <title>The AUTH parameter on MAIL commands</title>
50238 <para>
50239 <indexterm role="concept">
50240 <primary>authentication</primary>
50241 <secondary>sender; authenticated</secondary>
50242 </indexterm>
50243 <indexterm role="concept">
50244 <primary>AUTH</primary>
50245 <secondary>on MAIL command</secondary>
50246 </indexterm>
50247 When a client supplied an AUTH= item on a MAIL command, Exim applies
50248 the following checks before accepting it as the authenticated sender of the
50249 message:
50250 </para>
50251 <itemizedlist>
50252 <listitem>
50253 <para>
50254 If the connection is not using extended SMTP (that is, HELO was used rather
50255 than EHLO), the use of AUTH= is a syntax error.
50256 </para>
50257 </listitem>
50258 <listitem>
50259 <para>
50260 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
50261 </para>
50262 </listitem>
50263 <listitem>
50264 <para>
50265 <indexterm role="variable">
50266 <primary><varname>$authenticated_sender</varname></primary>
50267 </indexterm>
50268 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
50269 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
50270 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
50271 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
50272 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
50273 given for the MAIL command.
50274 </para>
50275 </listitem>
50276 <listitem>
50277 <para>
50278 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
50279 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
50280 authenticated.
50281 </para>
50282 </listitem>
50283 <listitem>
50284 <para>
50285 If the AUTH= value was accepted by either of the two previous rules, and
50286 the client has authenticated, and the authenticator has a setting for the
50287 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
50288 valued that was saved from the authenticator is expanded. If the expansion
50289 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
50290 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
50291 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
50292 message.
50293 </para>
50294 </listitem>
50295 </itemizedlist>
50296 <para>
50297 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
50298 hosts to which Exim authenticates as a client. Do not confuse this value with
50299 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
50300 process, and which is not usually a complete email address.
50301 </para>
50302 <para>
50303 <indexterm role="variable">
50304 <primary><varname>$sender_address</varname></primary>
50305 </indexterm>
50306 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
50307 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
50308 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
50309 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
50310 ACL is run.
50311 </para>
50312 </section>
50313 <section id="SECTauthexiser">
50314 <title>Authentication on an Exim server</title>
50315 <para>
50316 <indexterm role="concept">
50317 <primary>authentication</primary>
50318 <secondary>on an Exim server</secondary>
50319 </indexterm>
50320 When Exim receives an EHLO command, it advertises the public names of those
50321 authenticators that are configured as servers, subject to the following
50322 conditions:
50323 </para>
50324 <itemizedlist>
50325 <listitem>
50326 <para>
50327 The client host must match <option>auth_advertise_hosts</option> (default *).
50328 </para>
50329 </listitem>
50330 <listitem>
50331 <para>
50332 It the <option>server_advertise_condition</option> option is set, its expansion must not
50333 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
50334 </para>
50335 </listitem>
50336 </itemizedlist>
50337 <para>
50338 The order in which the authenticators are defined controls the order in which
50339 the mechanisms are advertised.
50340 </para>
50341 <para>
50342 Some mail clients (for example, some versions of Netscape) require the user to
50343 provide a name and password for authentication whenever AUTH is advertised,
50344 even though authentication may not in fact be needed (for example, Exim may be
50345 set up to allow unconditional relaying from the client by an IP address check).
50346 You can make such clients more friendly by not advertising AUTH to them.
50347 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
50348 that runs for RCPT) to relay without authentication, you should set
50349 </para>
50350 <literallayout class="monospaced">
50351 auth_advertise_hosts = ! 10.9.8.0/24
50352 </literallayout>
50353 <para>
50354 so that no authentication mechanisms are advertised to them.
50355 </para>
50356 <para>
50357 The <option>server_advertise_condition</option> controls the advertisement of individual
50358 authentication mechanisms. For example, it can be used to restrict the
50359 advertisement of a particular mechanism to encrypted connections, by a setting
50360 such as:
50361 </para>
50362 <literallayout class="monospaced">
50363 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
50364 </literallayout>
50365 <para>
50366 <indexterm role="variable">
50367 <primary><varname>$tls_in_cipher</varname></primary>
50368 </indexterm>
50369 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
50370 yields <quote>yes</quote>, which allows the advertisement to happen.
50371 </para>
50372 <para>
50373 When an Exim server receives an AUTH command from a client, it rejects it
50374 immediately if AUTH was not advertised in response to an earlier EHLO
50375 command. This is the case if
50376 </para>
50377 <itemizedlist>
50378 <listitem>
50379 <para>
50380 The client host does not match <option>auth_advertise_hosts</option>; or
50381 </para>
50382 </listitem>
50383 <listitem>
50384 <para>
50385 No authenticators are configured with server options; or
50386 </para>
50387 </listitem>
50388 <listitem>
50389 <para>
50390 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
50391 server authenticators.
50392 </para>
50393 </listitem>
50394 </itemizedlist>
50395 <para>
50396 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
50397 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
50398 AUTH is accepted from any client host.
50399 </para>
50400 <para>
50401 If AUTH is not rejected by the ACL, Exim searches its configuration for a
50402 server authentication mechanism that was advertised in response to EHLO and
50403 that matches the one named in the AUTH command. If it finds one, it runs
50404 the appropriate authentication protocol, and authentication either succeeds or
50405 fails. If there is no matching advertised mechanism, the AUTH command is
50406 rejected with a 504 error.
50407 </para>
50408 <para>
50409 <indexterm role="variable">
50410 <primary><varname>$received_protocol</varname></primary>
50411 </indexterm>
50412 <indexterm role="variable">
50413 <primary><varname>$sender_host_authenticated</varname></primary>
50414 </indexterm>
50415 When a message is received from an authenticated host, the value of
50416 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
50417 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
50418 public name) of the authenticator driver that successfully authenticated the
50419 client from which the message was received. This variable is empty if there was
50420 no successful authentication.
50421 </para>
50422 </section>
50423 <section id="SECID169">
50424 <title>Testing server authentication</title>
50425 <para>
50426 <indexterm role="concept">
50427 <primary>authentication</primary>
50428 <secondary>testing a server</secondary>
50429 </indexterm>
50430 <indexterm role="concept">
50431 <primary>AUTH</primary>
50432 <secondary>testing a server</secondary>
50433 </indexterm>
50434 <indexterm role="concept">
50435 <primary>base64 encoding</primary>
50436 <secondary>creating authentication test data</secondary>
50437 </indexterm>
50438 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
50439 configurations. The data for the AUTH command has to be sent using base64
50440 encoding. A quick way to produce such data for testing is the following Perl
50441 script:
50442 </para>
50443 <literallayout class="monospaced">
50444 use MIME::Base64;
50445 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
50446 </literallayout>
50447 <para>
50448 <indexterm role="concept">
50449 <primary>binary zero</primary>
50450 <secondary>in authentication data</secondary>
50451 </indexterm>
50452 This interprets its argument as a Perl string, and then encodes it. The
50453 interpretation as a Perl string allows binary zeros, which are required for
50454 some kinds of authentication, to be included in the data. For example, a
50455 command line to run this script on such data might be
50456 </para>
50457 <literallayout class="monospaced">
50458 encode '\0user\0password'
50459 </literallayout>
50460 <para>
50461 Note the use of single quotes to prevent the shell interpreting the
50462 backslashes, so that they can be interpreted by Perl to specify characters
50463 whose code value is zero.
50464 </para>
50465 <para>
50466 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
50467 digit, you must use three zeros instead of one after the leading backslash. If
50468 you do not, the octal digit that starts your string will be incorrectly
50469 interpreted as part of the code for the first character.
50470 </para>
50471 <para>
50472 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
50473 specially, you must use a Perl escape to prevent them being misinterpreted. For
50474 example, a command such as
50475 </para>
50476 <literallayout class="monospaced">
50477 encode '\0user@domain.com\0pas$$word'
50478 </literallayout>
50479 <para>
50480 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
50481 </para>
50482 <para>
50483 If you have the <option>mimencode</option> command installed, another way to do produce
50484 base64-encoded strings is to run the command
50485 </para>
50486 <literallayout class="monospaced">
50487 echo -e -n `\0user\0password' | mimencode
50488 </literallayout>
50489 <para>
50490 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
50491 in the argument, and the <option>-n</option> option specifies no newline at the end of its
50492 output. However, not all versions of <option>echo</option> recognize these options, so you
50493 should check your version before relying on this suggestion.
50494 </para>
50495 </section>
50496 <section id="SECID170">
50497 <title>Authentication by an Exim client</title>
50498 <para>
50499 <indexterm role="concept">
50500 <primary>authentication</primary>
50501 <secondary>on an Exim client</secondary>
50502 </indexterm>
50503 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
50504 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
50505 announces support for authentication, and the host matches an entry in either
50506 of these options, Exim (as a client) tries to authenticate as follows:
50507 </para>
50508 <itemizedlist>
50509 <listitem>
50510 <para>
50511 For each authenticator that is configured as a client, in the order in which
50512 they are defined in the configuration, it searches the authentication
50513 mechanisms announced by the server for one whose name matches the public name
50514 of the authenticator.
50515 </para>
50516 </listitem>
50517 <listitem>
50518 <para>
50519 <indexterm role="variable">
50520 <primary><varname>$host</varname></primary>
50521 </indexterm>
50522 <indexterm role="variable">
50523 <primary><varname>$host_address</varname></primary>
50524 </indexterm>
50525 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
50526 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
50527 that the client might do. They are set to the server&#x2019;s name and IP address. If
50528 any expansion is forced to fail, the authentication attempt is abandoned, and
50529 Exim moves on to the next authenticator. Otherwise an expansion failure causes
50530 delivery to be deferred.
50531 </para>
50532 </listitem>
50533 <listitem>
50534 <para>
50535 If the result of the authentication attempt is a temporary error or a timeout,
50536 Exim abandons trying to send the message to the host for the moment. It will
50537 try again later. If there are any backup hosts available, they are tried in the
50538 usual way.
50539 </para>
50540 </listitem>
50541 <listitem>
50542 <para>
50543 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
50544 carries on searching the list of authenticators and tries another one if
50545 possible. If all authentication attempts give permanent errors, or if there are
50546 no attempts because no mechanisms match (or option expansions force failure),
50547 what happens depends on whether the host matches <option>hosts_require_auth</option> or
50548 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
50549 delivery is deferred. The error can be detected in the retry rules, and thereby
50550 turned into a permanent error if you wish. In the second case, Exim tries to
50551 deliver the message unauthenticated.
50552 </para>
50553 </listitem>
50554 </itemizedlist>
50555 <para revisionflag="changed">
50556 Note that the hostlist test for whether to do authentication can be
50557 confused if name-IP lookups change between the time the peer is decided
50558 on and the transport running.  For example, with a manualroute
50559 router given a host name, and DNS "round-robin" use by that name: if
50560 the local resolver cache times out between the router and the transport
50561 running, the transport may get an IP for the name for its authentication
50562 check which does not match the connection peer IP.
50563 No authentication will then be done, despite the names being identical.
50564 </para>
50565 <para revisionflag="changed">
50566 For such cases use a separate transport which always authenticates.
50567 </para>
50568 <para>
50569 <indexterm role="concept">
50570 <primary>AUTH</primary>
50571 <secondary>on MAIL command</secondary>
50572 </indexterm>
50573 When Exim has authenticated itself to a remote server, it adds the AUTH
50574 parameter to the MAIL commands it sends, if it has an authenticated sender for
50575 the message. If the message came from a remote host, the authenticated sender
50576 is the one that was receiving on an incoming MAIL command, provided that the
50577 incoming connection was authenticated and the <option>server_mail_auth</option> condition
50578 allowed the authenticated sender to be retained. If a local process calls Exim
50579 to send a message, the sender address that is built from the login name and
50580 <option>qualify_domain</option> is treated as authenticated. However, if the
50581 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
50582 the authenticated sender that was received with the message.
50583 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
50584 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
50585 </para>
50586 </section>
50587 </chapter>
50588
50589 <chapter id="CHAPplaintext">
50590 <title>The plaintext authenticator</title>
50591 <para>
50592 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
50593 <primary><command>plaintext</command> authenticator</primary>
50594 </indexterm>
50595 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
50596 <primary>authenticators</primary>
50597 <secondary><command>plaintext</command></secondary>
50598 </indexterm>
50599 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
50600 LOGIN authentication mechanisms, both of which transfer authentication data as
50601 plain (unencrypted) text (though base64 encoded). The use of plain text is a
50602 security risk; you are strongly advised to insist on the use of SMTP encryption
50603 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
50604 use unencrypted plain text, you should not use the same passwords for SMTP
50605 connections as you do for login accounts.
50606 </para>
50607 <section id="SECID171">
50608 <title>Plaintext options</title>
50609 <para>
50610 <indexterm role="concept">
50611 <primary>options</primary>
50612 <secondary><command>plaintext</command> authenticator (server)</secondary>
50613 </indexterm>
50614 When configured as a server, <command>plaintext</command> uses the following options:
50615 </para>
50616 <para>
50617 <indexterm role="option">
50618 <primary><option>server_condition</option></primary>
50619 </indexterm>
50620 </para>
50621 <informaltable frame="all">
50622 <tgroup cols="4" colsep="0" rowsep="0">
50623 <colspec colwidth="8*" align="left"/>
50624 <colspec colwidth="6*" align="center"/>
50625 <colspec colwidth="6*" align="center"/>
50626 <colspec colwidth="6*" align="right"/>
50627 <tbody>
50628 <row>
50629 <entry><option>server_condition</option></entry>
50630 <entry>Use: <emphasis>authenticators</emphasis></entry>
50631 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50632 <entry>Default: <emphasis>unset</emphasis></entry>
50633 </row>
50634 </tbody>
50635 </tgroup>
50636 </informaltable>
50637 <para>
50638 This is actually a global authentication option, but it must be set in order to
50639 configure the <command>plaintext</command> driver as a server. Its use is described below.
50640 </para>
50641 <para>
50642 <indexterm role="option">
50643 <primary><option>server_prompts</option></primary>
50644 </indexterm>
50645 </para>
50646 <informaltable frame="all">
50647 <tgroup cols="4" colsep="0" rowsep="0">
50648 <colspec colwidth="8*" align="left"/>
50649 <colspec colwidth="6*" align="center"/>
50650 <colspec colwidth="6*" align="center"/>
50651 <colspec colwidth="6*" align="right"/>
50652 <tbody>
50653 <row>
50654 <entry><option>server_prompts</option></entry>
50655 <entry>Use: <emphasis>plaintext</emphasis></entry>
50656 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50657 <entry>Default: <emphasis>unset</emphasis></entry>
50658 </row>
50659 </tbody>
50660 </tgroup>
50661 </informaltable>
50662 <para>
50663 The contents of this option, after expansion, must be a colon-separated list of
50664 prompt strings. If expansion fails, a temporary authentication rejection is
50665 given.
50666 </para>
50667 </section>
50668 <section id="SECTplainserver">
50669 <title>Using plaintext in a server</title>
50670 <para>
50671 <indexterm role="concept">
50672 <primary>AUTH</primary>
50673 <secondary>in <command>plaintext</command> authenticator</secondary>
50674 </indexterm>
50675 <indexterm role="concept">
50676 <primary>binary zero</primary>
50677 <secondary>in <command>plaintext</command> authenticator</secondary>
50678 </indexterm>
50679 <indexterm role="concept">
50680 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
50681 <secondary>in <command>plaintext</command> authenticator</secondary>
50682 </indexterm>
50683 <indexterm role="variable">
50684 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
50685 </indexterm>
50686 <indexterm role="concept">
50687 <primary>base64 encoding</primary>
50688 <secondary>in <command>plaintext</command> authenticator</secondary>
50689 </indexterm>
50690 </para>
50691 <para>
50692 When running as a server, <command>plaintext</command> performs the authentication test by
50693 expanding a string. The data sent by the client with the AUTH command, or in
50694 response to subsequent prompts, is base64 encoded, and so may contain any byte
50695 values when decoded. If any data is supplied with the command, it is treated as
50696 a list of strings, separated by NULs (binary zeros), the first three of which
50697 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
50698 (neither LOGIN nor PLAIN uses more than three strings).
50699 </para>
50700 <para>
50701 For compatibility with previous releases of Exim, the values are also placed in
50702 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
50703 variables for this purpose is now deprecated, as it can lead to confusion in
50704 string expansions that also use them for other things.
50705 </para>
50706 <para>
50707 If there are more strings in <option>server_prompts</option> than the number of strings
50708 supplied with the AUTH command, the remaining prompts are used to obtain more
50709 data. Each response from the client may be a list of NUL-separated strings.
50710 </para>
50711 <para>
50712 <indexterm role="variable">
50713 <primary><varname>$authenticated_id</varname></primary>
50714 </indexterm>
50715 Once a sufficient number of data strings have been received,
50716 <option>server_condition</option> is expanded. If the expansion is forced to fail,
50717 authentication fails. Any other expansion failure causes a temporary error code
50718 to be returned. If the result of a successful expansion is an empty string,
50719 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
50720 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
50721 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
50722 For any other result, a temporary error code is returned, with the expanded
50723 string as the error text
50724 </para>
50725 <para>
50726 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
50727 password, be sure to make the authentication fail if the user is unknown.
50728 There are good and bad examples at the end of the next section.
50729 </para>
50730 </section>
50731 <section id="SECID172">
50732 <title>The PLAIN authentication mechanism</title>
50733 <para>
50734 <indexterm role="concept">
50735 <primary>PLAIN authentication mechanism</primary>
50736 </indexterm>
50737 <indexterm role="concept">
50738 <primary>authentication</primary>
50739 <secondary>PLAIN mechanism</secondary>
50740 </indexterm>
50741 <indexterm role="concept">
50742 <primary>binary zero</primary>
50743 <secondary>in <command>plaintext</command> authenticator</secondary>
50744 </indexterm>
50745 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
50746 sent as one item of data (that is, one combined string containing two NUL
50747 separators). The data is sent either as part of the AUTH command, or
50748 subsequently in response to an empty prompt from the server.
50749 </para>
50750 <para>
50751 The second and third strings are a user name and a corresponding password.
50752 Using a single fixed user name and password as an example, this could be
50753 configured as follows:
50754 </para>
50755 <literallayout class="monospaced">
50756 fixed_plain:
50757   driver = plaintext
50758   public_name = PLAIN
50759   server_prompts = :
50760   server_condition = \
50761     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
50762   server_set_id = $auth2
50763 </literallayout>
50764 <para>
50765 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
50766 are exactly what we want here, so they need not be specified. Obviously, if the
50767 password contains expansion-significant characters such as dollar, backslash,
50768 or closing brace, they have to be escaped.
50769 </para>
50770 <para>
50771 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
50772 the end of a string list are ignored). If all the data comes as part of the
50773 AUTH command, as is commonly the case, the prompt is not used. This
50774 authenticator is advertised in the response to EHLO as
50775 </para>
50776 <literallayout class="monospaced">
50777 250-AUTH PLAIN
50778 </literallayout>
50779 <para>
50780 and a client host can authenticate itself by sending the command
50781 </para>
50782 <literallayout class="monospaced">
50783 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
50784 </literallayout>
50785 <para>
50786 As this contains three strings (more than the number of prompts), no further
50787 data is required from the client. Alternatively, the client may just send
50788 </para>
50789 <literallayout class="monospaced">
50790 AUTH PLAIN
50791 </literallayout>
50792 <para>
50793 to initiate authentication, in which case the server replies with an empty
50794 prompt. The client must respond with the combined data string.
50795 </para>
50796 <para>
50797 The data string is base64 encoded, as required by the RFC. This example,
50798 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;
50799 represents a zero byte. This is split up into three strings, the first of which
50800 is empty. The <option>server_condition</option> option in the authenticator checks that the
50801 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
50802 </para>
50803 <para>
50804 Having just one fixed user name and password, as in this example, is not very
50805 realistic, though for a small organization with only a handful of
50806 authenticating clients it could make sense.
50807 </para>
50808 <para>
50809 A more sophisticated instance of this authenticator could use the user name in
50810 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
50811 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
50812 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
50813 This is an incorrect example:
50814 </para>
50815 <literallayout class="monospaced">
50816 server_condition = \
50817   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
50818 </literallayout>
50819 <para>
50820 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
50821 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
50822 incorrect? It works fine for existing users, but consider what happens if a
50823 non-existent user name is given. The lookup fails, but as no success/failure
50824 strings are given for the lookup, it yields an empty string. Thus, to defeat
50825 the authentication, all a client has to do is to supply a non-existent user
50826 name and an empty password. The correct way of writing this test is:
50827 </para>
50828 <literallayout class="monospaced">
50829 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
50830   {${if eq{$value}{$auth3}}} {false}}
50831 </literallayout>
50832 <para>
50833 In this case, if the lookup succeeds, the result is checked; if the lookup
50834 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
50835 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
50836 always fails if its second argument is empty. However, the second way of
50837 writing the test makes the logic clearer.
50838 </para>
50839 </section>
50840 <section id="SECID173">
50841 <title>The LOGIN authentication mechanism</title>
50842 <para>
50843 <indexterm role="concept">
50844 <primary>LOGIN authentication mechanism</primary>
50845 </indexterm>
50846 <indexterm role="concept">
50847 <primary>authentication</primary>
50848 <secondary>LOGIN mechanism</secondary>
50849 </indexterm>
50850 The LOGIN authentication mechanism is not documented in any RFC, but is in use
50851 in a number of programs. No data is sent with the AUTH command. Instead, a
50852 user name and password are supplied separately, in response to prompts. The
50853 plaintext authenticator can be configured to support this as in this example:
50854 </para>
50855 <literallayout class="monospaced">
50856 fixed_login:
50857   driver = plaintext
50858   public_name = LOGIN
50859   server_prompts = User Name : Password
50860   server_condition = \
50861     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
50862   server_set_id = $auth1
50863 </literallayout>
50864 <para>
50865 Because of the way plaintext operates, this authenticator accepts data supplied
50866 with the AUTH command (in contravention of the specification of LOGIN), but
50867 if the client does not supply it (as is the case for LOGIN clients), the prompt
50868 strings are used to obtain two data items.
50869 </para>
50870 <para>
50871 Some clients are very particular about the precise text of the prompts. For
50872 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
50873 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
50874 strings. It uses the <option>ldapauth</option> expansion condition to check the user
50875 name and password by binding to an LDAP server:
50876 </para>
50877 <literallayout class="monospaced">
50878 login:
50879   driver = plaintext
50880   public_name = LOGIN
50881   server_prompts = Username:: : Password::
50882   server_condition = ${if and{{ \
50883     !eq{}{$auth1} }{ \
50884     ldapauth{\
50885       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
50886       pass=${quote:$auth2} \
50887       ldap://ldap.example.org/} }} }
50888   server_set_id = uid=$auth1,ou=people,o=example.org
50889 </literallayout>
50890 <para>
50891 We have to check that the username is not empty before using it, because LDAP
50892 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
50893 operator to correctly quote the DN for authentication. However, the basic
50894 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
50895 correct one to use for the password, because quoting is needed only to make
50896 the password conform to the Exim syntax. At the LDAP level, the password is an
50897 uninterpreted string.
50898 </para>
50899 </section>
50900 <section id="SECID174">
50901 <title>Support for different kinds of authentication</title>
50902 <para>
50903 A number of string expansion features are provided for the purpose of
50904 interfacing to different ways of user authentication. These include checking
50905 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
50906 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
50907 <xref linkend="SECTexpcond"/>.
50908 </para>
50909 </section>
50910 <section id="SECID175">
50911 <title>Using plaintext in a client</title>
50912 <para>
50913 <indexterm role="concept">
50914 <primary>options</primary>
50915 <secondary><command>plaintext</command> authenticator (client)</secondary>
50916 </indexterm>
50917 The <command>plaintext</command> authenticator has two client options:
50918 </para>
50919 <para>
50920 <indexterm role="option">
50921 <primary><option>client_ignore_invalid_base64</option></primary>
50922 </indexterm>
50923 </para>
50924 <informaltable frame="all">
50925 <tgroup cols="4" colsep="0" rowsep="0">
50926 <colspec colwidth="8*" align="left"/>
50927 <colspec colwidth="6*" align="center"/>
50928 <colspec colwidth="6*" align="center"/>
50929 <colspec colwidth="6*" align="right"/>
50930 <tbody>
50931 <row>
50932 <entry><option>client_ignore_invalid_base64</option></entry>
50933 <entry>Use: <emphasis>plaintext</emphasis></entry>
50934 <entry>Type: <emphasis>boolean</emphasis></entry>
50935 <entry>Default: <emphasis>false</emphasis></entry>
50936 </row>
50937 </tbody>
50938 </tgroup>
50939 </informaltable>
50940 <para>
50941 If the client receives a server prompt that is not a valid base64 string,
50942 authentication is abandoned by default. However, if this option is set true,
50943 the error in the challenge is ignored and the client sends the response as
50944 usual.
50945 </para>
50946 <para>
50947 <indexterm role="option">
50948 <primary><option>client_send</option></primary>
50949 </indexterm>
50950 </para>
50951 <informaltable frame="all">
50952 <tgroup cols="4" colsep="0" rowsep="0">
50953 <colspec colwidth="8*" align="left"/>
50954 <colspec colwidth="6*" align="center"/>
50955 <colspec colwidth="6*" align="center"/>
50956 <colspec colwidth="6*" align="right"/>
50957 <tbody>
50958 <row>
50959 <entry><option>client_send</option></entry>
50960 <entry>Use: <emphasis>plaintext</emphasis></entry>
50961 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50962 <entry>Default: <emphasis>unset</emphasis></entry>
50963 </row>
50964 </tbody>
50965 </tgroup>
50966 </informaltable>
50967 <para>
50968 The string is a colon-separated list of authentication data strings. Each
50969 string is independently expanded before being sent to the server. The first
50970 string is sent with the AUTH command; any more strings are sent in response
50971 to prompts from the server. Before each string is expanded, the value of the
50972 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
50973 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
50974 way. Thus, the prompt that is received in response to sending the first string
50975 (with the AUTH command) can be used in the expansion of the second string, and
50976 so on. If an invalid base64 string is received when
50977 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
50978 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
50979 </para>
50980 <para>
50981 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
50982 splitting takes priority and happens first.
50983 </para>
50984 <para>
50985 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
50986 the data, further processing is applied to each string before it is sent. If
50987 there are any single circumflex characters in the string, they are converted to
50988 NULs. Should an actual circumflex be required as data, it must be doubled in
50989 the string.
50990 </para>
50991 <para>
50992 This is an example of a client configuration that implements the PLAIN
50993 authentication mechanism with a fixed user name and password:
50994 </para>
50995 <literallayout class="monospaced">
50996 fixed_plain:
50997   driver = plaintext
50998   public_name = PLAIN
50999   client_send = ^username^mysecret
51000 </literallayout>
51001 <para>
51002 The lack of colons means that the entire text is sent with the AUTH
51003 command, with the circumflex characters converted to NULs. A similar example
51004 that uses the LOGIN mechanism is:
51005 </para>
51006 <literallayout class="monospaced">
51007 fixed_login:
51008   driver = plaintext
51009   public_name = LOGIN
51010   client_send = : username : mysecret
51011 </literallayout>
51012 <para>
51013 The initial colon means that the first string is empty, so no data is sent with
51014 the AUTH command itself. The remaining strings are sent in response to
51015 prompts.
51016 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
51017 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
51018 </para>
51019 </section>
51020 </chapter>
51021
51022 <chapter id="CHID9">
51023 <title>The cram_md5 authenticator</title>
51024 <para>
51025 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
51026 <primary><command>cram_md5</command> authenticator</primary>
51027 </indexterm>
51028 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
51029 <primary>authenticators</primary>
51030 <secondary><command>cram_md5</command></secondary>
51031 </indexterm>
51032 <indexterm role="concept">
51033 <primary>CRAM-MD5 authentication mechanism</primary>
51034 </indexterm>
51035 <indexterm role="concept">
51036 <primary>authentication</primary>
51037 <secondary>CRAM-MD5 mechanism</secondary>
51038 </indexterm>
51039 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
51040 sends a challenge string to the client, and the response consists of a user
51041 name and the CRAM-MD5 digest of the challenge string combined with a secret
51042 string (password) which is known to both server and client. Thus, the secret
51043 is not sent over the network as plain text, which makes this authenticator more
51044 secure than <command>plaintext</command>. However, the downside is that the secret has to be
51045 available in plain text at either end.
51046 </para>
51047 <section id="SECID176">
51048 <title>Using cram_md5 as a server</title>
51049 <para>
51050 <indexterm role="concept">
51051 <primary>options</primary>
51052 <secondary><command>cram_md5</command> authenticator (server)</secondary>
51053 </indexterm>
51054 This authenticator has one server option, which must be set to configure the
51055 authenticator as a server:
51056 </para>
51057 <para>
51058 <indexterm role="option">
51059 <primary><option>server_secret</option></primary>
51060 </indexterm>
51061 </para>
51062 <informaltable frame="all">
51063 <tgroup cols="4" colsep="0" rowsep="0">
51064 <colspec colwidth="8*" align="left"/>
51065 <colspec colwidth="6*" align="center"/>
51066 <colspec colwidth="6*" align="center"/>
51067 <colspec colwidth="6*" align="right"/>
51068 <tbody>
51069 <row>
51070 <entry><option>server_secret</option></entry>
51071 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51072 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51073 <entry>Default: <emphasis>unset</emphasis></entry>
51074 </row>
51075 </tbody>
51076 </tgroup>
51077 </informaltable>
51078 <para>
51079 <indexterm role="concept">
51080 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51081 <secondary>in <command>cram_md5</command> authenticator</secondary>
51082 </indexterm>
51083 When the server receives the client&#x2019;s response, the user name is placed in
51084 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
51085 obtain the password for that user. The server then computes the CRAM-MD5 digest
51086 that the client should have sent, and checks that it received the correct
51087 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
51088 fails. If the expansion fails for some other reason, a temporary error code is
51089 returned to the client.
51090 </para>
51091 <para>
51092 For compatibility with previous releases of Exim, the user name is also placed
51093 in <varname>$1</varname>. However, the use of this variables for this purpose is now
51094 deprecated, as it can lead to confusion in string expansions that also use
51095 numeric variables for other things.
51096 </para>
51097 <para>
51098 For example, the following authenticator checks that the user name given by the
51099 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
51100 user name, authentication fails.
51101 </para>
51102 <literallayout class="monospaced">
51103 fixed_cram:
51104   driver = cram_md5
51105   public_name = CRAM-MD5
51106   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
51107   server_set_id = $auth1
51108 </literallayout>
51109 <para>
51110 <indexterm role="variable">
51111 <primary><varname>$authenticated_id</varname></primary>
51112 </indexterm>
51113 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
51114 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
51115 secret string in a file, using the user name as the key. For example:
51116 </para>
51117 <literallayout class="monospaced">
51118 lookup_cram:
51119   driver = cram_md5
51120   public_name = CRAM-MD5
51121   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
51122                   {$value}fail}
51123   server_set_id = $auth1
51124 </literallayout>
51125 <para>
51126 Note that this expansion explicitly forces failure if the lookup fails
51127 because <varname>$auth1</varname> contains an unknown user name.
51128 </para>
51129 <para>
51130 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
51131 using the relevant libraries, you need to know the realm to specify in the
51132 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
51133 realm, with:
51134 </para>
51135 <literallayout class="monospaced">
51136 cyrusless_crammd5:
51137   driver = cram_md5
51138   public_name = CRAM-MD5
51139   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
51140                   dbmjz{/etc/sasldb2}{$value}fail}
51141   server_set_id = $auth1
51142 </literallayout>
51143 </section>
51144 <section id="SECID177">
51145 <title>Using cram_md5 as a client</title>
51146 <para>
51147 <indexterm role="concept">
51148 <primary>options</primary>
51149 <secondary><command>cram_md5</command> authenticator (client)</secondary>
51150 </indexterm>
51151 When used as a client, the <command>cram_md5</command> authenticator has two options:
51152 </para>
51153 <para>
51154 <indexterm role="option">
51155 <primary><option>client_name</option></primary>
51156 </indexterm>
51157 </para>
51158 <informaltable frame="all">
51159 <tgroup cols="4" colsep="0" rowsep="0">
51160 <colspec colwidth="8*" align="left"/>
51161 <colspec colwidth="6*" align="center"/>
51162 <colspec colwidth="6*" align="center"/>
51163 <colspec colwidth="6*" align="right"/>
51164 <tbody>
51165 <row>
51166 <entry><option>client_name</option></entry>
51167 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51168 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51169 <entry>Default: <emphasis>the primary host name</emphasis></entry>
51170 </row>
51171 </tbody>
51172 </tgroup>
51173 </informaltable>
51174 <para>
51175 This string is expanded, and the result used as the user name data when
51176 computing the response to the server&#x2019;s challenge.
51177 </para>
51178 <para>
51179 <indexterm role="option">
51180 <primary><option>client_secret</option></primary>
51181 </indexterm>
51182 </para>
51183 <informaltable frame="all">
51184 <tgroup cols="4" colsep="0" rowsep="0">
51185 <colspec colwidth="8*" align="left"/>
51186 <colspec colwidth="6*" align="center"/>
51187 <colspec colwidth="6*" align="center"/>
51188 <colspec colwidth="6*" align="right"/>
51189 <tbody>
51190 <row>
51191 <entry><option>client_secret</option></entry>
51192 <entry>Use: <emphasis>cram_md5</emphasis></entry>
51193 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51194 <entry>Default: <emphasis>unset</emphasis></entry>
51195 </row>
51196 </tbody>
51197 </tgroup>
51198 </informaltable>
51199 <para>
51200 This option must be set for the authenticator to work as a client. Its value is
51201 expanded and the result used as the secret string when computing the response.
51202 </para>
51203 <para>
51204 <indexterm role="variable">
51205 <primary><varname>$host</varname></primary>
51206 </indexterm>
51207 <indexterm role="variable">
51208 <primary><varname>$host_address</varname></primary>
51209 </indexterm>
51210 Different user names and secrets can be used for different servers by referring
51211 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
51212 expansion string is treated as an indication that this authenticator is not
51213 prepared to handle this case. Exim moves on to the next configured client
51214 authenticator. Any other expansion failure causes Exim to give up trying to
51215 send the message to the current server.
51216 </para>
51217 <para>
51218 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
51219 strings, is:
51220 </para>
51221 <literallayout class="monospaced">
51222 fixed_cram:
51223   driver = cram_md5
51224   public_name = CRAM-MD5
51225   client_name = ph10
51226   client_secret = secret
51227 </literallayout>
51228 <para>
51229 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
51230 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
51231 </para>
51232 </section>
51233 </chapter>
51234
51235 <chapter id="CHID10">
51236 <title>The cyrus_sasl authenticator</title>
51237 <para>
51238 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
51239 <primary><command>cyrus_sasl</command> authenticator</primary>
51240 </indexterm>
51241 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
51242 <primary>authenticators</primary>
51243 <secondary><command>cyrus_sasl</command></secondary>
51244 </indexterm>
51245 <indexterm role="concept">
51246 <primary>Cyrus</primary>
51247 <secondary>SASL library</secondary>
51248 </indexterm>
51249 <indexterm role="concept">
51250 <primary>Kerberos</primary>
51251 </indexterm>
51252 The code for this authenticator was provided by Matthew Byng-Maddick of A L
51253 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
51254 </para>
51255 <para>
51256 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
51257 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
51258 Layer</quote>). This library supports a number of authentication mechanisms,
51259 including PLAIN and LOGIN, but also several others that Exim does not support
51260 directly. In particular, there is support for Kerberos authentication.
51261 </para>
51262 <para>
51263 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
51264 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
51265 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
51266 name of the driver to determine which mechanism to support.
51267 </para>
51268 <para>
51269 Where access to some kind of secret file is required, for example in GSSAPI
51270 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
51271 user, and that the Cyrus SASL library has no way of escalating privileges
51272 by default. You may also find you need to set environment variables,
51273 depending on the driver you are using.
51274 </para>
51275 <para>
51276 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
51277 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
51278 Kerberos, note that because of limitations in the GSSAPI interface,
51279 changing the server keytab might need to be communicated down to the Kerberos
51280 layer independently. The mechanism for doing so is dependent upon the Kerberos
51281 implementation.
51282 </para>
51283 <para>
51284 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
51285 may be set to point to an alternative keytab file. Exim will pass this
51286 variable through from its own inherited environment when started as root or the
51287 Exim user. The keytab file needs to be readable by the Exim user.
51288 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
51289 environment variable.  In practice, for those releases, the Cyrus authenticator
51290 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
51291 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
51292 </para>
51293 <section id="SECID178">
51294 <title>Using cyrus_sasl as a server</title>
51295 <para>
51296 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
51297 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
51298 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
51299 use of this variable for this purpose is now deprecated, as it can lead to
51300 confusion in string expansions that also use numeric variables for other
51301 things.
51302 </para>
51303 <para>
51304 <indexterm role="option">
51305 <primary><option>server_hostname</option></primary>
51306 </indexterm>
51307 </para>
51308 <informaltable frame="all">
51309 <tgroup cols="4" colsep="0" rowsep="0">
51310 <colspec colwidth="8*" align="left"/>
51311 <colspec colwidth="6*" align="center"/>
51312 <colspec colwidth="6*" align="center"/>
51313 <colspec colwidth="6*" align="right"/>
51314 <tbody>
51315 <row>
51316 <entry><option>server_hostname</option></entry>
51317 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51318 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51319 <entry>Default: <emphasis>see below</emphasis></entry>
51320 </row>
51321 </tbody>
51322 </tgroup>
51323 </informaltable>
51324 <para>
51325 This option selects the hostname that is used when communicating with the
51326 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
51327 SASL plug-in what it does with this data.
51328 </para>
51329 <para>
51330 <indexterm role="option">
51331 <primary><option>server_mech</option></primary>
51332 </indexterm>
51333 </para>
51334 <informaltable frame="all">
51335 <tgroup cols="4" colsep="0" rowsep="0">
51336 <colspec colwidth="8*" align="left"/>
51337 <colspec colwidth="6*" align="center"/>
51338 <colspec colwidth="6*" align="center"/>
51339 <colspec colwidth="6*" align="right"/>
51340 <tbody>
51341 <row>
51342 <entry><option>server_mech</option></entry>
51343 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51344 <entry>Type: <emphasis>string</emphasis></entry>
51345 <entry>Default: <emphasis>see below</emphasis></entry>
51346 </row>
51347 </tbody>
51348 </tgroup>
51349 </informaltable>
51350 <para>
51351 This option selects the authentication mechanism this driver should use. The
51352 default is the value of the generic <option>public_name</option> option. This option allows
51353 you to use a different underlying mechanism from the advertised name. For
51354 example:
51355 </para>
51356 <literallayout class="monospaced">
51357 sasl:
51358   driver = cyrus_sasl
51359   public_name = X-ANYTHING
51360   server_mech = CRAM-MD5
51361   server_set_id = $auth1
51362 </literallayout>
51363 <para>
51364 <indexterm role="option">
51365 <primary><option>server_realm</option></primary>
51366 </indexterm>
51367 </para>
51368 <informaltable frame="all">
51369 <tgroup cols="4" colsep="0" rowsep="0">
51370 <colspec colwidth="8*" align="left"/>
51371 <colspec colwidth="6*" align="center"/>
51372 <colspec colwidth="6*" align="center"/>
51373 <colspec colwidth="6*" align="right"/>
51374 <tbody>
51375 <row>
51376 <entry><option>server_realm</option></entry>
51377 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51379 <entry>Default: <emphasis>unset</emphasis></entry>
51380 </row>
51381 </tbody>
51382 </tgroup>
51383 </informaltable>
51384 <para>
51385 This specifies the SASL realm that the server claims to be in.
51386 </para>
51387 <para>
51388 <indexterm role="option">
51389 <primary><option>server_service</option></primary>
51390 </indexterm>
51391 </para>
51392 <informaltable frame="all">
51393 <tgroup cols="4" colsep="0" rowsep="0">
51394 <colspec colwidth="8*" align="left"/>
51395 <colspec colwidth="6*" align="center"/>
51396 <colspec colwidth="6*" align="center"/>
51397 <colspec colwidth="6*" align="right"/>
51398 <tbody>
51399 <row>
51400 <entry><option>server_service</option></entry>
51401 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
51402 <entry>Type: <emphasis>string</emphasis></entry>
51403 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
51404 </row>
51405 </tbody>
51406 </tgroup>
51407 </informaltable>
51408 <para>
51409 This is the SASL service that the server claims to implement.
51410 </para>
51411 <para>
51412 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
51413 private options. All you need to do is to specify an appropriate mechanism as
51414 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
51415 PLAIN, you could have two authenticators as follows:
51416 </para>
51417 <literallayout class="monospaced">
51418 sasl_cram_md5:
51419   driver = cyrus_sasl
51420   public_name = CRAM-MD5
51421   server_set_id = $auth1
51422
51423 sasl_plain:
51424   driver = cyrus_sasl
51425   public_name = PLAIN
51426   server_set_id = $auth2
51427 </literallayout>
51428 <para>
51429 Cyrus SASL does implement the LOGIN authentication method, even though it is
51430 not a standard method. It is disabled by default in the source distribution,
51431 but it is present in many binary distributions.
51432 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
51433 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
51434 </para>
51435 </section>
51436 </chapter>
51437
51438 <chapter id="CHAPdovecot">
51439 <title>The dovecot authenticator</title>
51440 <para>
51441 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
51442 <primary><command>dovecot</command> authenticator</primary>
51443 </indexterm>
51444 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
51445 <primary>authenticators</primary>
51446 <secondary><command>dovecot</command></secondary>
51447 </indexterm>
51448 This authenticator is an interface to the authentication facility of the
51449 Dovecot POP/IMAP server, which can support a number of authentication methods.
51450 Note that Dovecot must be configured to use auth-client not auth-userdb.
51451 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
51452 to use the same mechanisms for SMTP authentication. This is a server
51453 authenticator only. There is only one option:
51454 </para>
51455 <para>
51456 <indexterm role="option">
51457 <primary><option>server_socket</option></primary>
51458 </indexterm>
51459 </para>
51460 <informaltable frame="all">
51461 <tgroup cols="4" colsep="0" rowsep="0">
51462 <colspec colwidth="8*" align="left"/>
51463 <colspec colwidth="6*" align="center"/>
51464 <colspec colwidth="6*" align="center"/>
51465 <colspec colwidth="6*" align="right"/>
51466 <tbody>
51467 <row>
51468 <entry><option>server_socket</option></entry>
51469 <entry>Use: <emphasis>dovecot</emphasis></entry>
51470 <entry>Type: <emphasis>string</emphasis></entry>
51471 <entry>Default: <emphasis>unset</emphasis></entry>
51472 </row>
51473 </tbody>
51474 </tgroup>
51475 </informaltable>
51476 <para>
51477 This option must specify the socket that is the interface to Dovecot
51478 authentication. The <option>public_name</option> option must specify an authentication
51479 mechanism that Dovecot is configured to support. You can have several
51480 authenticators for different mechanisms. For example:
51481 </para>
51482 <literallayout class="monospaced">
51483 dovecot_plain:
51484   driver = dovecot
51485   public_name = PLAIN
51486   server_socket = /var/run/dovecot/auth-client
51487   server_set_id = $auth1
51488
51489 dovecot_ntlm:
51490   driver = dovecot
51491   public_name = NTLM
51492   server_socket = /var/run/dovecot/auth-client
51493   server_set_id = $auth1
51494 </literallayout>
51495 <para>
51496 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
51497 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
51498 option is passed in the Dovecot authentication command. If, for a TLS
51499 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
51500 option is passed. When authentication succeeds, the identity of the user
51501 who authenticated is placed in <varname>$auth1</varname>.
51502 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
51503 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
51504 </para>
51505 </chapter>
51506
51507 <chapter id="CHAPgsasl">
51508 <title>The gsasl authenticator</title>
51509 <para>
51510 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
51511 <primary><command>gsasl</command> authenticator</primary>
51512 </indexterm>
51513 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
51514 <primary>authenticators</primary>
51515 <secondary><command>gsasl</command></secondary>
51516 </indexterm>
51517 <indexterm role="concept">
51518 <primary>authentication</primary>
51519 <secondary>GNU SASL</secondary>
51520 </indexterm>
51521 <indexterm role="concept">
51522 <primary>authentication</primary>
51523 <secondary>SASL</secondary>
51524 </indexterm>
51525 <indexterm role="concept">
51526 <primary>authentication</primary>
51527 <secondary>EXTERNAL</secondary>
51528 </indexterm>
51529 <indexterm role="concept">
51530 <primary>authentication</primary>
51531 <secondary>ANONYMOUS</secondary>
51532 </indexterm>
51533 <indexterm role="concept">
51534 <primary>authentication</primary>
51535 <secondary>PLAIN</secondary>
51536 </indexterm>
51537 <indexterm role="concept">
51538 <primary>authentication</primary>
51539 <secondary>LOGIN</secondary>
51540 </indexterm>
51541 <indexterm role="concept">
51542 <primary>authentication</primary>
51543 <secondary>DIGEST-MD5</secondary>
51544 </indexterm>
51545 <indexterm role="concept">
51546 <primary>authentication</primary>
51547 <secondary>CRAM-MD5</secondary>
51548 </indexterm>
51549 <indexterm role="concept">
51550 <primary>authentication</primary>
51551 <secondary>SCRAM-SHA-1</secondary>
51552 </indexterm>
51553 The <command>gsasl</command> authenticator provides server integration for the GNU SASL
51554 library and the mechanisms it provides.  This is new as of the 4.80 release
51555 and there are a few areas where the library does not let Exim smoothly
51556 scale to handle future authentication mechanisms, so no guarantee can be
51557 made that any particular new authentication mechanism will be supported
51558 without code changes in Exim.
51559 </para>
51560 <para>
51561 <indexterm role="option">
51562 <primary><option>server_channelbinding</option></primary>
51563 </indexterm>
51564 </para>
51565 <informaltable frame="all">
51566 <tgroup cols="4" colsep="0" rowsep="0">
51567 <colspec colwidth="8*" align="left"/>
51568 <colspec colwidth="6*" align="center"/>
51569 <colspec colwidth="6*" align="center"/>
51570 <colspec colwidth="6*" align="right"/>
51571 <tbody>
51572 <row>
51573 <entry><option>server_channelbinding</option></entry>
51574 <entry>Use: <emphasis>gsasl</emphasis></entry>
51575 <entry>Type: <emphasis>boolean</emphasis></entry>
51576 <entry>Default: <emphasis>false</emphasis></entry>
51577 </row>
51578 </tbody>
51579 </tgroup>
51580 </informaltable>
51581 <para>
51582 Some authentication mechanisms are able to use external context at both ends
51583 of the session to bind the authentication to that context, and fail the
51584 authentication process if that context differs.  Specifically, some TLS
51585 ciphersuites can provide identifying information about the cryptographic
51586 context.
51587 </para>
51588 <para>
51589 This means that certificate identity and verification becomes a non-issue,
51590 as a man-in-the-middle attack will cause the correct client and server to
51591 see different identifiers and authentication will fail.
51592 </para>
51593 <para>
51594 This is currently only supported when using the GnuTLS library.  This is
51595 only usable by mechanisms which support "channel binding"; at time of
51596 writing, that&#x2019;s the SCRAM family.
51597 </para>
51598 <para>
51599 This defaults off to ensure smooth upgrade across Exim releases, in case
51600 this option causes some clients to start failing.  Some future release
51601 of Exim may switch the default to be true.
51602 </para>
51603 <para>
51604 <indexterm role="option">
51605 <primary><option>server_hostname</option></primary>
51606 </indexterm>
51607 </para>
51608 <informaltable frame="all">
51609 <tgroup cols="4" colsep="0" rowsep="0">
51610 <colspec colwidth="8*" align="left"/>
51611 <colspec colwidth="6*" align="center"/>
51612 <colspec colwidth="6*" align="center"/>
51613 <colspec colwidth="6*" align="right"/>
51614 <tbody>
51615 <row>
51616 <entry><option>server_hostname</option></entry>
51617 <entry>Use: <emphasis>gsasl</emphasis></entry>
51618 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51619 <entry>Default: <emphasis>see below</emphasis></entry>
51620 </row>
51621 </tbody>
51622 </tgroup>
51623 </informaltable>
51624 <para>
51625 This option selects the hostname that is used when communicating with the
51626 library. The default value is <literal>$primary_hostname</literal>.
51627 Some mechanisms will use this data.
51628 </para>
51629 <para>
51630 <indexterm role="option">
51631 <primary><option>server_mech</option></primary>
51632 </indexterm>
51633 </para>
51634 <informaltable frame="all">
51635 <tgroup cols="4" colsep="0" rowsep="0">
51636 <colspec colwidth="8*" align="left"/>
51637 <colspec colwidth="6*" align="center"/>
51638 <colspec colwidth="6*" align="center"/>
51639 <colspec colwidth="6*" align="right"/>
51640 <tbody>
51641 <row>
51642 <entry><option>server_mech</option></entry>
51643 <entry>Use: <emphasis>gsasl</emphasis></entry>
51644 <entry>Type: <emphasis>string</emphasis></entry>
51645 <entry>Default: <emphasis>see below</emphasis></entry>
51646 </row>
51647 </tbody>
51648 </tgroup>
51649 </informaltable>
51650 <para>
51651 This option selects the authentication mechanism this driver should use. The
51652 default is the value of the generic <option>public_name</option> option. This option allows
51653 you to use a different underlying mechanism from the advertised name. For
51654 example:
51655 </para>
51656 <literallayout class="monospaced">
51657 sasl:
51658   driver = gsasl
51659   public_name = X-ANYTHING
51660   server_mech = CRAM-MD5
51661   server_set_id = $auth1
51662 </literallayout>
51663 <para>
51664 <indexterm role="option">
51665 <primary><option>server_password</option></primary>
51666 </indexterm>
51667 </para>
51668 <informaltable frame="all">
51669 <tgroup cols="4" colsep="0" rowsep="0">
51670 <colspec colwidth="8*" align="left"/>
51671 <colspec colwidth="6*" align="center"/>
51672 <colspec colwidth="6*" align="center"/>
51673 <colspec colwidth="6*" align="right"/>
51674 <tbody>
51675 <row>
51676 <entry><option>server_password</option></entry>
51677 <entry>Use: <emphasis>gsasl</emphasis></entry>
51678 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51679 <entry>Default: <emphasis>unset</emphasis></entry>
51680 </row>
51681 </tbody>
51682 </tgroup>
51683 </informaltable>
51684 <para>
51685 Various mechanisms need access to the cleartext password on the server, so
51686 that proof-of-possession can be demonstrated on the wire, without sending
51687 the password itself.
51688 </para>
51689 <para>
51690 The data available for lookup varies per mechanism.
51691 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
51692 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
51693 if available, else the empty string.
51694 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
51695 else the empty string.
51696 </para>
51697 <para>
51698 A forced failure will cause authentication to defer.
51699 </para>
51700 <para>
51701 If using this option, it may make sense to set the <option>server_condition</option>
51702 option to be simply "true".
51703 </para>
51704 <para>
51705 <indexterm role="option">
51706 <primary><option>server_realm</option></primary>
51707 </indexterm>
51708 </para>
51709 <informaltable frame="all">
51710 <tgroup cols="4" colsep="0" rowsep="0">
51711 <colspec colwidth="8*" align="left"/>
51712 <colspec colwidth="6*" align="center"/>
51713 <colspec colwidth="6*" align="center"/>
51714 <colspec colwidth="6*" align="right"/>
51715 <tbody>
51716 <row>
51717 <entry><option>server_realm</option></entry>
51718 <entry>Use: <emphasis>gsasl</emphasis></entry>
51719 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51720 <entry>Default: <emphasis>unset</emphasis></entry>
51721 </row>
51722 </tbody>
51723 </tgroup>
51724 </informaltable>
51725 <para>
51726 This specifies the SASL realm that the server claims to be in.
51727 Some mechanisms will use this data.
51728 </para>
51729 <para>
51730 <indexterm role="option">
51731 <primary><option>server_scram_iter</option></primary>
51732 </indexterm>
51733 </para>
51734 <informaltable frame="all">
51735 <tgroup cols="4" colsep="0" rowsep="0">
51736 <colspec colwidth="8*" align="left"/>
51737 <colspec colwidth="6*" align="center"/>
51738 <colspec colwidth="6*" align="center"/>
51739 <colspec colwidth="6*" align="right"/>
51740 <tbody>
51741 <row>
51742 <entry><option>server_scram_iter</option></entry>
51743 <entry>Use: <emphasis>gsasl</emphasis></entry>
51744 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51745 <entry>Default: <emphasis>unset</emphasis></entry>
51746 </row>
51747 </tbody>
51748 </tgroup>
51749 </informaltable>
51750 <para>
51751 This option provides data for the SCRAM family of mechanisms.
51752 <varname>$auth1</varname> is not available at evaluation time.
51753 (This may change, as we receive feedback on use)
51754 </para>
51755 <para>
51756 <indexterm role="option">
51757 <primary><option>server_scram_salt</option></primary>
51758 </indexterm>
51759 </para>
51760 <informaltable frame="all">
51761 <tgroup cols="4" colsep="0" rowsep="0">
51762 <colspec colwidth="8*" align="left"/>
51763 <colspec colwidth="6*" align="center"/>
51764 <colspec colwidth="6*" align="center"/>
51765 <colspec colwidth="6*" align="right"/>
51766 <tbody>
51767 <row>
51768 <entry><option>server_scram_salt</option></entry>
51769 <entry>Use: <emphasis>gsasl</emphasis></entry>
51770 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51771 <entry>Default: <emphasis>unset</emphasis></entry>
51772 </row>
51773 </tbody>
51774 </tgroup>
51775 </informaltable>
51776 <para>
51777 This option provides data for the SCRAM family of mechanisms.
51778 <varname>$auth1</varname> is not available at evaluation time.
51779 (This may change, as we receive feedback on use)
51780 </para>
51781 <para>
51782 <indexterm role="option">
51783 <primary><option>server_service</option></primary>
51784 </indexterm>
51785 </para>
51786 <informaltable frame="all">
51787 <tgroup cols="4" colsep="0" rowsep="0">
51788 <colspec colwidth="8*" align="left"/>
51789 <colspec colwidth="6*" align="center"/>
51790 <colspec colwidth="6*" align="center"/>
51791 <colspec colwidth="6*" align="right"/>
51792 <tbody>
51793 <row>
51794 <entry><option>server_service</option></entry>
51795 <entry>Use: <emphasis>gsasl</emphasis></entry>
51796 <entry>Type: <emphasis>string</emphasis></entry>
51797 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
51798 </row>
51799 </tbody>
51800 </tgroup>
51801 </informaltable>
51802 <para>
51803 This is the SASL service that the server claims to implement.
51804 Some mechanisms will use this data.
51805 </para>
51806 <section id="SECTgsaslauthvar">
51807 <title><command>gsasl</command> auth variables</title>
51808 <para>
51809 <indexterm role="variable">
51810 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
51811 </indexterm>
51812 These may be set when evaluating specific options, as detailed above.
51813 They will also be set when evaluating <option>server_condition</option>.
51814 </para>
51815 <para>
51816 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
51817 meanings for these variables:
51818 </para>
51819 <itemizedlist>
51820 <listitem>
51821 <para>
51822 <indexterm role="variable">
51823 <primary><varname>$auth1</varname></primary>
51824 </indexterm>
51825 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
51826 </para>
51827 </listitem>
51828 <listitem>
51829 <para>
51830 <indexterm role="variable">
51831 <primary><varname>$auth2</varname></primary>
51832 </indexterm>
51833 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
51834 </para>
51835 </listitem>
51836 <listitem>
51837 <para>
51838 <indexterm role="variable">
51839 <primary><varname>$auth3</varname></primary>
51840 </indexterm>
51841 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
51842 </para>
51843 </listitem>
51844 </itemizedlist>
51845 <para>
51846 On a per-mechanism basis:
51847 </para>
51848 <itemizedlist>
51849 <listitem>
51850 <para>
51851 <indexterm role="concept">
51852 <primary>authentication</primary>
51853 <secondary>EXTERNAL</secondary>
51854 </indexterm>
51855 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
51856 the <option>server_condition</option> option must be present.
51857 </para>
51858 </listitem>
51859 <listitem>
51860 <para>
51861 <indexterm role="concept">
51862 <primary>authentication</primary>
51863 <secondary>ANONYMOUS</secondary>
51864 </indexterm>
51865 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
51866 the <option>server_condition</option> option must be present.
51867 </para>
51868 </listitem>
51869 <listitem>
51870 <para>
51871 <indexterm role="concept">
51872 <primary>authentication</primary>
51873 <secondary>GSSAPI</secondary>
51874 </indexterm>
51875 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
51876 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
51877 the <option>server_condition</option> option must be present.
51878 </para>
51879 </listitem>
51880 </itemizedlist>
51881 <para>
51882 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
51883 identifier; this is analogous to FTP anonymous authentication passing an
51884 email address, or software-identifier@, as the "password".
51885 </para>
51886 <para>
51887 An example showing the password having the realm specified in the callback
51888 and demonstrating a Cyrus SASL to GSASL migration approach is:
51889 </para>
51890 <literallayout class="monospaced">
51891 gsasl_cyrusless_crammd5:
51892   driver = gsasl
51893   public_name = CRAM-MD5
51894   server_realm = imap.example.org
51895   server_password = ${lookup{$auth1:$auth3:userPassword}\
51896                     dbmjz{/etc/sasldb2}{$value}fail}
51897   server_set_id = ${quote:$auth1}
51898   server_condition = yes
51899 </literallayout>
51900 </section>
51901 </chapter>
51902
51903 <chapter id="CHAPheimdalgss">
51904 <title>The heimdal_gssapi authenticator</title>
51905 <para>
51906 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
51907 <primary><command>heimdal_gssapi</command> authenticator</primary>
51908 </indexterm>
51909 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
51910 <primary>authenticators</primary>
51911 <secondary><command>heimdal_gssapi</command></secondary>
51912 </indexterm>
51913 <indexterm role="concept">
51914 <primary>authentication</primary>
51915 <secondary>GSSAPI</secondary>
51916 </indexterm>
51917 <indexterm role="concept">
51918 <primary>authentication</primary>
51919 <secondary>Kerberos</secondary>
51920 </indexterm>
51921 The <command>heimdal_gssapi</command> authenticator provides server integration for the
51922 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
51923 reliably.
51924 </para>
51925 <para>
51926 <indexterm role="option">
51927 <primary><option>server_hostname</option></primary>
51928 </indexterm>
51929 </para>
51930 <informaltable frame="all">
51931 <tgroup cols="4" colsep="0" rowsep="0">
51932 <colspec colwidth="8*" align="left"/>
51933 <colspec colwidth="6*" align="center"/>
51934 <colspec colwidth="6*" align="center"/>
51935 <colspec colwidth="6*" align="right"/>
51936 <tbody>
51937 <row>
51938 <entry><option>server_hostname</option></entry>
51939 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51940 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51941 <entry>Default: <emphasis>see below</emphasis></entry>
51942 </row>
51943 </tbody>
51944 </tgroup>
51945 </informaltable>
51946 <para>
51947 This option selects the hostname that is used, with <option>server_service</option>,
51948 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
51949 identifier.  The default value is <literal>$primary_hostname</literal>.
51950 </para>
51951 <para>
51952 <indexterm role="option">
51953 <primary><option>server_keytab</option></primary>
51954 </indexterm>
51955 </para>
51956 <informaltable frame="all">
51957 <tgroup cols="4" colsep="0" rowsep="0">
51958 <colspec colwidth="8*" align="left"/>
51959 <colspec colwidth="6*" align="center"/>
51960 <colspec colwidth="6*" align="center"/>
51961 <colspec colwidth="6*" align="right"/>
51962 <tbody>
51963 <row>
51964 <entry><option>server_keytab</option></entry>
51965 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51966 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51967 <entry>Default: <emphasis>unset</emphasis></entry>
51968 </row>
51969 </tbody>
51970 </tgroup>
51971 </informaltable>
51972 <para>
51973 If set, then Heimdal will not use the system default keytab (typically
51974 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
51975 The value should be a pathname, with no <quote>file:</quote> prefix.
51976 </para>
51977 <para>
51978 <indexterm role="option">
51979 <primary><option>server_service</option></primary>
51980 </indexterm>
51981 </para>
51982 <informaltable frame="all">
51983 <tgroup cols="4" colsep="0" rowsep="0">
51984 <colspec colwidth="8*" align="left"/>
51985 <colspec colwidth="6*" align="center"/>
51986 <colspec colwidth="6*" align="center"/>
51987 <colspec colwidth="6*" align="right"/>
51988 <tbody>
51989 <row>
51990 <entry><option>server_service</option></entry>
51991 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
51992 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51993 <entry>Default: <emphasis>smtp</emphasis></entry>
51994 </row>
51995 </tbody>
51996 </tgroup>
51997 </informaltable>
51998 <para>
51999 This option specifies the service identifier used, in conjunction with
52000 <option>server_hostname</option>, for building the identifier for finding credentials
52001 from the keytab.
52002 </para>
52003 <section id="SECTheimdalgssauthvar">
52004 <title><command>heimdal_gssapi</command> auth variables</title>
52005 <para>
52006 Beware that these variables will typically include a realm, thus will appear
52007 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
52008 not verified, so a malicious client can set it to anything.
52009 </para>
52010 <para>
52011 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
52012 Distribution Center.  Note that these are not quite email addresses.
52013 Each identifier is for a role, and so the left-hand-side may include a
52014 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
52015 </para>
52016 <para>
52017 <indexterm role="variable">
52018 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
52019 </indexterm>
52020 </para>
52021 <itemizedlist>
52022 <listitem>
52023 <para>
52024 <indexterm role="variable">
52025 <primary><varname>$auth1</varname></primary>
52026 </indexterm>
52027 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
52028 </para>
52029 </listitem>
52030 <listitem>
52031 <para>
52032 <indexterm role="variable">
52033 <primary><varname>$auth2</varname></primary>
52034 </indexterm>
52035 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
52036 authentication.  If that was empty, this will also be set to the
52037 GSS Display Name.
52038 </para>
52039 </listitem>
52040 </itemizedlist>
52041 </section>
52042 </chapter>
52043
52044 <chapter id="CHAPspa">
52045 <title>The spa authenticator</title>
52046 <para>
52047 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
52048 <primary><command>spa</command> authenticator</primary>
52049 </indexterm>
52050 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
52051 <primary>authenticators</primary>
52052 <secondary><command>spa</command></secondary>
52053 </indexterm>
52054 <indexterm role="concept">
52055 <primary>authentication</primary>
52056 <secondary>Microsoft Secure Password</secondary>
52057 </indexterm>
52058 <indexterm role="concept">
52059 <primary>authentication</primary>
52060 <secondary>NTLM</secondary>
52061 </indexterm>
52062 <indexterm role="concept">
52063 <primary>Microsoft Secure Password Authentication</primary>
52064 </indexterm>
52065 <indexterm role="concept">
52066 <primary>NTLM authentication</primary>
52067 </indexterm>
52068 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
52069 Password Authentication</emphasis> mechanism,
52070 which is also sometimes known as NTLM (NT LanMan). The code for client side of
52071 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
52072 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
52073 server side was subsequently contributed by Tom Kistner. The mechanism works as
52074 follows:
52075 </para>
52076 <itemizedlist>
52077 <listitem>
52078 <para>
52079 After the AUTH command has been accepted, the client sends an SPA
52080 authentication request based on the user name and optional domain.
52081 </para>
52082 </listitem>
52083 <listitem>
52084 <para>
52085 The server sends back a challenge.
52086 </para>
52087 </listitem>
52088 <listitem>
52089 <para>
52090 The client builds a challenge response which makes use of the user&#x2019;s password
52091 and sends it to the server, which then accepts or rejects it.
52092 </para>
52093 </listitem>
52094 </itemizedlist>
52095 <para>
52096 Encryption is used to protect the password in transit.
52097 </para>
52098 <section id="SECID179">
52099 <title>Using spa as a server</title>
52100 <para>
52101 <indexterm role="concept">
52102 <primary>options</primary>
52103 <secondary><command>spa</command> authenticator (server)</secondary>
52104 </indexterm>
52105 The <command>spa</command> authenticator has just one server option:
52106 </para>
52107 <para>
52108 <indexterm role="option">
52109 <primary><option>server_password</option></primary>
52110 </indexterm>
52111 </para>
52112 <informaltable frame="all">
52113 <tgroup cols="4" colsep="0" rowsep="0">
52114 <colspec colwidth="8*" align="left"/>
52115 <colspec colwidth="6*" align="center"/>
52116 <colspec colwidth="6*" align="center"/>
52117 <colspec colwidth="6*" align="right"/>
52118 <tbody>
52119 <row>
52120 <entry><option>server_password</option></entry>
52121 <entry>Use: <emphasis>spa</emphasis></entry>
52122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52123 <entry>Default: <emphasis>unset</emphasis></entry>
52124 </row>
52125 </tbody>
52126 </tgroup>
52127 </informaltable>
52128 <para>
52129 <indexterm role="concept">
52130 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52131 <secondary>in <command>spa</command> authenticator</secondary>
52132 </indexterm>
52133 This option is expanded, and the result must be the cleartext password for the
52134 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
52135 compatibility with previous releases of Exim, the user name is also placed in
52136 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
52137 it can lead to confusion in string expansions that also use numeric variables
52138 for other things. For example:
52139 </para>
52140 <literallayout class="monospaced">
52141 spa:
52142   driver = spa
52143   public_name = NTLM
52144   server_password = \
52145     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
52146 </literallayout>
52147 <para>
52148 If the expansion is forced to fail, authentication fails. Any other expansion
52149 failure causes a temporary error code to be returned.
52150 </para>
52151 </section>
52152 <section id="SECID180">
52153 <title>Using spa as a client</title>
52154 <para>
52155 <indexterm role="concept">
52156 <primary>options</primary>
52157 <secondary><command>spa</command> authenticator (client)</secondary>
52158 </indexterm>
52159 The <command>spa</command> authenticator has the following client options:
52160 </para>
52161 <para>
52162 <indexterm role="option">
52163 <primary><option>client_domain</option></primary>
52164 </indexterm>
52165 </para>
52166 <informaltable frame="all">
52167 <tgroup cols="4" colsep="0" rowsep="0">
52168 <colspec colwidth="8*" align="left"/>
52169 <colspec colwidth="6*" align="center"/>
52170 <colspec colwidth="6*" align="center"/>
52171 <colspec colwidth="6*" align="right"/>
52172 <tbody>
52173 <row>
52174 <entry><option>client_domain</option></entry>
52175 <entry>Use: <emphasis>spa</emphasis></entry>
52176 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52177 <entry>Default: <emphasis>unset</emphasis></entry>
52178 </row>
52179 </tbody>
52180 </tgroup>
52181 </informaltable>
52182 <para>
52183 This option specifies an optional domain for the authentication.
52184 </para>
52185 <para>
52186 <indexterm role="option">
52187 <primary><option>client_password</option></primary>
52188 </indexterm>
52189 </para>
52190 <informaltable frame="all">
52191 <tgroup cols="4" colsep="0" rowsep="0">
52192 <colspec colwidth="8*" align="left"/>
52193 <colspec colwidth="6*" align="center"/>
52194 <colspec colwidth="6*" align="center"/>
52195 <colspec colwidth="6*" align="right"/>
52196 <tbody>
52197 <row>
52198 <entry><option>client_password</option></entry>
52199 <entry>Use: <emphasis>spa</emphasis></entry>
52200 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52201 <entry>Default: <emphasis>unset</emphasis></entry>
52202 </row>
52203 </tbody>
52204 </tgroup>
52205 </informaltable>
52206 <para>
52207 This option specifies the user&#x2019;s password, and must be set.
52208 </para>
52209 <para>
52210 <indexterm role="option">
52211 <primary><option>client_username</option></primary>
52212 </indexterm>
52213 </para>
52214 <informaltable frame="all">
52215 <tgroup cols="4" colsep="0" rowsep="0">
52216 <colspec colwidth="8*" align="left"/>
52217 <colspec colwidth="6*" align="center"/>
52218 <colspec colwidth="6*" align="center"/>
52219 <colspec colwidth="6*" align="right"/>
52220 <tbody>
52221 <row>
52222 <entry><option>client_username</option></entry>
52223 <entry>Use: <emphasis>spa</emphasis></entry>
52224 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52225 <entry>Default: <emphasis>unset</emphasis></entry>
52226 </row>
52227 </tbody>
52228 </tgroup>
52229 </informaltable>
52230 <para>
52231 This option specifies the user name, and must be set. Here is an example of a
52232 configuration of this authenticator for use with the mail servers at
52233 <emphasis>msn.com</emphasis>:
52234 </para>
52235 <literallayout class="monospaced">
52236 msn:
52237   driver = spa
52238   public_name = MSN
52239   client_username = msn/msn_username
52240   client_password = msn_plaintext_password
52241   client_domain = DOMAIN_OR_UNSET
52242 </literallayout>
52243 <para>
52244 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
52245 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
52246 </para>
52247 </section>
52248 </chapter>
52249
52250 <chapter id="CHAPtlsauth">
52251 <title>The tls authenticator</title>
52252 <para>
52253 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
52254 <primary><command>tls</command> authenticator</primary>
52255 </indexterm>
52256 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
52257 <primary>authenticators</primary>
52258 <secondary><command>tls</command></secondary>
52259 </indexterm>
52260 <indexterm role="concept">
52261 <primary>authentication</primary>
52262 <secondary>Client Certificate</secondary>
52263 </indexterm>
52264 <indexterm role="concept">
52265 <primary>authentication</primary>
52266 <secondary>X509</secondary>
52267 </indexterm>
52268 <indexterm role="concept">
52269 <primary>Certificate-based authentication</primary>
52270 </indexterm>
52271 The <command>tls</command> authenticator provides server support for
52272 authentication based on client certificates.
52273 </para>
52274 <para>
52275 It is not an SMTP authentication mechanism and is not
52276 advertised by the server as part of the SMTP EHLO response.
52277 It is an Exim authenticator in the sense that it affects
52278 the protocol element of the log line, can be tested for
52279 by the <option>authenticated</option> ACL condition, and can set
52280 the <varname>$authenticated_id</varname> variable.
52281 </para>
52282 <para>
52283 The client must present a verifiable certificate,
52284 for which it must have been requested via the
52285 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
52286 (see <xref linkend="CHAPTLS"/>).
52287 </para>
52288 <para>
52289 If an authenticator of this type is configured it is
52290 run before any SMTP-level communication is done,
52291 and can authenticate the connection.
52292 If it does, SMTP authentication is not offered.
52293 </para>
52294 <para>
52295 A maximum of one authenticator of this type may be present.
52296 </para>
52297 <para>
52298 <indexterm role="concept">
52299 <primary>options</primary>
52300 <secondary><command>tls</command> authenticator (server)</secondary>
52301 </indexterm>
52302 The <command>tls</command> authenticator has three server options:
52303 </para>
52304 <para>
52305 <indexterm role="option">
52306 <primary><option>server_param1</option></primary>
52307 </indexterm>
52308 </para>
52309 <informaltable frame="all">
52310 <tgroup cols="4" colsep="0" rowsep="0">
52311 <colspec colwidth="8*" align="left"/>
52312 <colspec colwidth="6*" align="center"/>
52313 <colspec colwidth="6*" align="center"/>
52314 <colspec colwidth="6*" align="right"/>
52315 <tbody>
52316 <row>
52317 <entry><option>server_param1</option></entry>
52318 <entry>Use: <emphasis>tls</emphasis></entry>
52319 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52320 <entry>Default: <emphasis>unset</emphasis></entry>
52321 </row>
52322 </tbody>
52323 </tgroup>
52324 </informaltable>
52325 <para>
52326 <indexterm role="concept">
52327 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
52328 <secondary>in <command>tls</command> authenticator</secondary>
52329 </indexterm>
52330 This option is expanded after the TLS negotiation and
52331 the result is placed in <varname>$auth1</varname>.
52332 If the expansion is forced to fail, authentication fails. Any other expansion
52333 failure causes a temporary error code to be returned.
52334 </para>
52335 <para>
52336 <indexterm role="option">
52337 <primary><option>server_param2</option></primary>
52338 </indexterm>
52339 </para>
52340 <informaltable frame="all">
52341 <tgroup cols="4" colsep="0" rowsep="0">
52342 <colspec colwidth="8*" align="left"/>
52343 <colspec colwidth="6*" align="center"/>
52344 <colspec colwidth="6*" align="center"/>
52345 <colspec colwidth="6*" align="right"/>
52346 <tbody>
52347 <row>
52348 <entry><option>server_param2</option></entry>
52349 <entry>Use: <emphasis>tls</emphasis></entry>
52350 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52351 <entry>Default: <emphasis>unset</emphasis></entry>
52352 </row>
52353 </tbody>
52354 </tgroup>
52355 </informaltable>
52356 <para>
52357 <indexterm role="option">
52358 <primary><option>server_param3</option></primary>
52359 </indexterm>
52360 </para>
52361 <informaltable frame="all">
52362 <tgroup cols="4" colsep="0" rowsep="0">
52363 <colspec colwidth="8*" align="left"/>
52364 <colspec colwidth="6*" align="center"/>
52365 <colspec colwidth="6*" align="center"/>
52366 <colspec colwidth="6*" align="right"/>
52367 <tbody>
52368 <row>
52369 <entry><option>server_param3</option></entry>
52370 <entry>Use: <emphasis>tls</emphasis></entry>
52371 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52372 <entry>Default: <emphasis>unset</emphasis></entry>
52373 </row>
52374 </tbody>
52375 </tgroup>
52376 </informaltable>
52377 <para>
52378 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
52379 </para>
52380 <para>
52381 <option>server_param1</option> may also be spelled <option>server_param</option>.
52382 </para>
52383 <para>
52384 Example:
52385 </para>
52386 <literallayout class="monospaced">
52387 tls:
52388   driver = tls
52389   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
52390                                     {$tls_in_peercert}}
52391   server_condition =  ${if forany {$auth1} \
52392                             {!= {0} \
52393                                 {${lookup ldap{ldap:///\
52394                          mailname=${quote_ldap_dn:${lc:$item}},\
52395                          ou=users,LDAP_DC?mailid} {$value}{0} \
52396                        }    }   } }
52397   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
52398 </literallayout>
52399 <para>
52400 This accepts a client certificate that is verifiable against any
52401 of your configured trust-anchors
52402 (which usually means the full set of public CAs)
52403 and which has a SAN with a good account name.
52404 Note that the client cert is on the wire in-clear, including the SAN,
52405 whereas a plaintext SMTP AUTH done inside TLS is not.
52406 </para>
52407 <para>
52408 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
52409 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
52410 </para>
52411 <para>
52412 Note that because authentication is traditionally an SMTP operation,
52413 the <option>authenticated</option> ACL condition cannot be used in
52414 a connect- or helo-ACL.
52415 </para>
52416 </chapter>
52417
52418 <chapter id="CHAPTLS">
52419 <title>Encrypted SMTP connections using TLS/SSL</title>
52420 <titleabbrev>Encrypted SMTP connections</titleabbrev>
52421 <para>
52422 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
52423 <primary>encryption</primary>
52424 <secondary>on SMTP connection</secondary>
52425 </indexterm>
52426 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
52427 <primary>SMTP</primary>
52428 <secondary>encryption</secondary>
52429 </indexterm>
52430 <indexterm role="concept">
52431 <primary>TLS</primary>
52432 <secondary>on SMTP connection</secondary>
52433 </indexterm>
52434 <indexterm role="concept">
52435 <primary>OpenSSL</primary>
52436 </indexterm>
52437 <indexterm role="concept">
52438 <primary>GnuTLS</primary>
52439 </indexterm>
52440 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
52441 Sockets Layer), is implemented by making use of the OpenSSL library or the
52442 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
52443 cryptographic code in the Exim distribution itself for implementing TLS. In
52444 order to use this feature you must install OpenSSL or GnuTLS, and then build a
52445 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
52446 You also need to understand the basic concepts of encryption at a managerial
52447 level, and in particular, the way that public keys, private keys, and
52448 certificates are used.
52449 </para>
52450 <para>
52451 RFC 3207 defines how SMTP connections can make use of encryption. Once a
52452 connection is established, the client issues a STARTTLS command. If the
52453 server accepts this, the client and the server negotiate an encryption
52454 mechanism. If the negotiation succeeds, the data that subsequently passes
52455 between them is encrypted.
52456 </para>
52457 <para>
52458 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
52459 and if so, what cipher suite is in use, whether the client supplied a
52460 certificate, and whether or not that certificate was verified. This makes it
52461 possible for an Exim server to deny or accept certain commands based on the
52462 encryption state.
52463 </para>
52464 <para>
52465 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
52466 disrupt TLS connections. You need to turn off SMTP scanning for these products
52467 in order to get TLS to work.
52468 </para>
52469 <section id="SECID284">
52470 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
52471 <para>
52472 <indexterm role="concept">
52473 <primary>ssmtp protocol</primary>
52474 </indexterm>
52475 <indexterm role="concept">
52476 <primary>smtps protocol</primary>
52477 </indexterm>
52478 <indexterm role="concept">
52479 <primary>SMTP</primary>
52480 <secondary>ssmtp protocol</secondary>
52481 </indexterm>
52482 <indexterm role="concept">
52483 <primary>SMTP</primary>
52484 <secondary>smtps protocol</secondary>
52485 </indexterm>
52486 Early implementations of encrypted SMTP used a different TCP port from normal
52487 SMTP, and expected an encryption negotiation to start immediately, instead of
52488 waiting for a STARTTLS command from the client using the standard SMTP
52489 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
52490 allocated for this purpose.
52491 </para>
52492 <para>
52493 This approach was abandoned when encrypted SMTP was standardized, but there are
52494 still some legacy clients that use it. Exim supports these clients by means of
52495 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
52496 numbers; the most common use is expected to be:
52497 </para>
52498 <literallayout class="monospaced">
52499 tls_on_connect_ports = 465
52500 </literallayout>
52501 <para>
52502 The port numbers specified by this option apply to all SMTP connections, both
52503 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
52504 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
52505 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
52506 an extra port &ndash; rather, it specifies different behaviour on a port that is
52507 defined elsewhere.
52508 </para>
52509 <para>
52510 There is also a <option>-tls-on-connect</option> command line option. This overrides
52511 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
52512 </para>
52513 </section>
52514 <section id="SECTopenvsgnu">
52515 <title>OpenSSL vs GnuTLS</title>
52516 <para>
52517 <indexterm role="concept">
52518 <primary>TLS</primary>
52519 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
52520 </indexterm>
52521 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
52522 followed later, when the first versions of GnuTLS were released. To build Exim
52523 to use GnuTLS, you need to set
52524 </para>
52525 <literallayout class="monospaced">
52526 USE_GNUTLS=yes
52527 </literallayout>
52528 <para>
52529 in Local/Makefile, in addition to
52530 </para>
52531 <literallayout class="monospaced">
52532 SUPPORT_TLS=yes
52533 </literallayout>
52534 <para>
52535 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
52536 include files and libraries for GnuTLS can be found.
52537 </para>
52538 <para>
52539 There are some differences in usage when using GnuTLS instead of OpenSSL:
52540 </para>
52541 <itemizedlist>
52542 <listitem>
52543 <para>
52544 The <option>tls_verify_certificates</option> option
52545 cannot be the path of a directory
52546 for GnuTLS versions before 3.3.6
52547 (for later versions, or OpenSSL, it can be either).
52548 </para>
52549 </listitem>
52550 <listitem>
52551 <para>
52552 The default value for <option>tls_dhparam</option> differs for historical reasons.
52553 </para>
52554 </listitem>
52555 <listitem>
52556 <para>
52557 <indexterm role="variable">
52558 <primary><varname>$tls_in_peerdn</varname></primary>
52559 </indexterm>
52560 <indexterm role="variable">
52561 <primary><varname>$tls_out_peerdn</varname></primary>
52562 </indexterm>
52563 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
52564 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
52565 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
52566 </para>
52567 </listitem>
52568 <listitem>
52569 <para>
52570 OpenSSL identifies cipher suites using hyphens as separators, for example:
52571 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
52572 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
52573 in a cipher list. To make life simpler, Exim changes underscores to hyphens
52574 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
52575 to handle its own older variants) when processing lists of cipher suites in the
52576 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
52577 option).
52578 </para>
52579 </listitem>
52580 <listitem>
52581 <para>
52582 The <option>tls_require_ciphers</option> options operate differently, as described in the
52583 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
52584 </para>
52585 </listitem>
52586 <listitem>
52587 <para>
52588 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
52589 When using OpenSSL, this option is ignored.
52590 (If an API is found to let OpenSSL be configured in this way,
52591 let the Exim Maintainers know and we&#x2019;ll likely use it).
52592 </para>
52593 </listitem>
52594 <listitem>
52595 <para>
52596 Some other recently added features may only be available in one or the other.
52597 This should be documented with the feature.  If the documentation does not
52598 explicitly state that the feature is infeasible in the other TLS
52599 implementation, then patches are welcome.
52600 </para>
52601 </listitem>
52602 </itemizedlist>
52603 </section>
52604 <section id="SECTgnutlsparam">
52605 <title>GnuTLS parameter computation</title>
52606 <para>
52607 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
52608 an explicit path; if the latter, then the text about generation still applies,
52609 but not the chosen filename.
52610 By default, as of Exim 4.80 a hard-coded D-H prime is used.
52611 See the documentation of <option>tls_dhparam</option> for more information.
52612 </para>
52613 <para>
52614 GnuTLS uses D-H parameters that may take a substantial amount of time
52615 to compute. It is unreasonable to re-compute them for every TLS session.
52616 Therefore, Exim keeps this data in a file in its spool directory, called
52617 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
52618 of bits requested.
52619 The file is owned by the Exim user and is readable only by
52620 its owner. Every Exim process that start up GnuTLS reads the D-H
52621 parameters from this file. If the file does not exist, the first Exim process
52622 that needs it computes the data and writes it to a temporary file which is
52623 renamed once it is complete. It does not matter if several Exim processes do
52624 this simultaneously (apart from wasting a few resources). Once a file is in
52625 place, new Exim processes immediately start using it.
52626 </para>
52627 <para>
52628 For maximum security, the parameters that are stored in this file should be
52629 recalculated periodically, the frequency depending on your paranoia level.
52630 If you are avoiding using the fixed D-H primes published in RFCs, then you
52631 are concerned about some advanced attacks and will wish to do this; if you do
52632 not regenerate then you might as well stick to the standard primes.
52633 </para>
52634 <para>
52635 Arranging this is easy in principle; just delete the file when you want new
52636 values to be computed. However, there may be a problem. The calculation of new
52637 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
52638 If the system is not very active, <filename>/dev/random</filename> may delay returning data
52639 until enough randomness (entropy) is available. This may cause Exim to hang for
52640 a substantial amount of time, causing timeouts on incoming connections.
52641 </para>
52642 <para>
52643 The solution is to generate the parameters externally to Exim. They are stored
52644 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
52645 generated externally using the <command>certtool</command> command that is part of GnuTLS.
52646 </para>
52647 <para>
52648 To replace the parameters with new ones, instead of deleting the file
52649 and letting Exim re-create it, you can generate new parameters using
52650 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
52651 renaming. The relevant commands are something like this:
52652 </para>
52653 <literallayout class="monospaced">
52654 # ls
52655 [ look for file; assume gnutls-params-2236 is the most recent ]
52656 # rm -f new-params
52657 # touch new-params
52658 # chown exim:exim new-params
52659 # chmod 0600 new-params
52660 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
52661 # openssl dhparam -noout -text -in new-params | head
52662 [ check the first line, make sure it's not more than 2236;
52663   if it is, then go back to the start ("rm") and repeat
52664   until the size generated is at most the size requested ]
52665 # chmod 0400 new-params
52666 # mv new-params gnutls-params-2236
52667 </literallayout>
52668 <para>
52669 If Exim never has to generate the parameters itself, the possibility of
52670 stalling is removed.
52671 </para>
52672 <para>
52673 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
52674 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
52675 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
52676 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
52677 and Exim does so.  This attempt to remove Exim from TLS policy decisions
52678 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
52679 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
52680 which applies to all D-H usage, client or server.  If the value returned by
52681 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
52682 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
52683 limit, which is still much higher than Exim historically used.
52684 </para>
52685 <para>
52686 The filename and bits used will change as the GnuTLS maintainers change the
52687 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
52688 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
52689 2432 bits, while NSS is limited to 2236 bits.
52690 </para>
52691 <para>
52692 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
52693 increase the chance of the generated prime actually being within acceptable
52694 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
52695 procedure above.  There is no sane procedure available to Exim to double-check
52696 the size of the generated prime, so it might still be too large.
52697 </para>
52698 </section>
52699 <section id="SECTreqciphssl">
52700 <title>Requiring specific ciphers in OpenSSL</title>
52701 <para>
52702 <indexterm role="concept">
52703 <primary>TLS</primary>
52704 <secondary>requiring specific ciphers (OpenSSL)</secondary>
52705 </indexterm>
52706 <indexterm role="option">
52707 <primary><option>tls_require_ciphers</option></primary>
52708 <secondary>OpenSSL</secondary>
52709 </indexterm>
52710 There is a function in the OpenSSL library that can be passed a list of cipher
52711 suites before the cipher negotiation takes place. This specifies which ciphers
52712 are acceptable. The list is colon separated and may contain names like
52713 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
52714 directly to this function call.
52715 Many systems will install the OpenSSL manual-pages, so you may have
52716 <emphasis>ciphers(1)</emphasis> available to you.
52717 The following quotation from the OpenSSL
52718 documentation specifies what forms of item are allowed in the cipher string:
52719 </para>
52720 <itemizedlist>
52721 <listitem>
52722 <para>
52723 It can consist of a single cipher suite such as RC4-SHA.
52724 </para>
52725 </listitem>
52726 <listitem>
52727 <para>
52728 It can represent a list of cipher suites containing a certain algorithm,
52729 or cipher suites of a certain type. For example SHA1 represents all
52730 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
52731 SSL v3 algorithms.
52732 </para>
52733 </listitem>
52734 <listitem>
52735 <para>
52736 Lists of cipher suites can be combined in a single cipher string using
52737 the + character. This is used as a logical and operation. For example
52738 SHA1+DES represents all cipher suites containing the SHA1 and the DES
52739 algorithms.
52740 </para>
52741 </listitem>
52742 </itemizedlist>
52743 <para>
52744 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
52745 <literal>-</literal> or <literal>+</literal>.
52746 </para>
52747 <itemizedlist>
52748 <listitem>
52749 <para>
52750 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
52751 ciphers deleted can never reappear in the list even if they are explicitly
52752 stated.
52753 </para>
52754 </listitem>
52755 <listitem>
52756 <para>
52757 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
52758 of the ciphers can be added again by later options.
52759 </para>
52760 </listitem>
52761 <listitem>
52762 <para>
52763 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
52764 option does not add any new ciphers; it just moves matching existing ones.
52765 </para>
52766 </listitem>
52767 </itemizedlist>
52768 <para>
52769 If none of these characters is present, the string is interpreted as
52770 a list of ciphers to be appended to the current preference list. If the list
52771 includes any ciphers already present they will be ignored: that is, they will
52772 not be moved to the end of the list.
52773 </para>
52774 <para>
52775 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
52776 string:
52777 </para>
52778 <literallayout class="monospaced">
52779 # note single-quotes to get ! past any shell history expansion
52780 $ openssl ciphers 'HIGH:!MD5:!SHA1'
52781 </literallayout>
52782 <para>
52783 This example will let the library defaults be permitted on the MX port, where
52784 there&#x2019;s probably no identity verification anyway, but ups the ante on the
52785 submission ports where the administrator might have some influence on the
52786 choice of clients used:
52787 </para>
52788 <literallayout class="monospaced">
52789 # OpenSSL variant; see man ciphers(1)
52790 tls_require_ciphers = ${if =={$received_port}{25}\
52791                            {DEFAULT}\
52792                            {HIGH:!MD5:!SHA1}}
52793 </literallayout>
52794 </section>
52795 <section id="SECTreqciphgnu">
52796 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
52797 <para>
52798 <indexterm role="concept">
52799 <primary>GnuTLS</primary>
52800 <secondary>specifying parameters for</secondary>
52801 </indexterm>
52802 <indexterm role="concept">
52803 <primary>TLS</primary>
52804 <secondary>specifying ciphers (GnuTLS)</secondary>
52805 </indexterm>
52806 <indexterm role="concept">
52807 <primary>TLS</primary>
52808 <secondary>specifying key exchange methods (GnuTLS)</secondary>
52809 </indexterm>
52810 <indexterm role="concept">
52811 <primary>TLS</primary>
52812 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
52813 </indexterm>
52814 <indexterm role="concept">
52815 <primary>TLS</primary>
52816 <secondary>specifying protocols (GnuTLS)</secondary>
52817 </indexterm>
52818 <indexterm role="concept">
52819 <primary>TLS</primary>
52820 <secondary>specifying priority string (GnuTLS)</secondary>
52821 </indexterm>
52822 <indexterm role="option">
52823 <primary><option>tls_require_ciphers</option></primary>
52824 <secondary>GnuTLS</secondary>
52825 </indexterm>
52826 The GnuTLS library allows the caller to provide a "priority string", documented
52827 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
52828 ciphersuite specification in OpenSSL.
52829 </para>
52830 <para>
52831 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
52832 and controls both protocols and ciphers.
52833 </para>
52834 <para>
52835 The <option>tls_require_ciphers</option> option is available both as an global option,
52836 controlling how Exim behaves as a server, and also as an option of the
52837 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
52838 the value is string expanded.  The resulting string is not an Exim list and
52839 the string is given to the GnuTLS library, so that Exim does not need to be
52840 aware of future feature enhancements of GnuTLS.
52841 </para>
52842 <para>
52843 Documentation of the strings accepted may be found in the GnuTLS manual, under
52844 "Priority strings".  This is online as
52845 <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>,
52846 but beware that this relates to GnuTLS 3, which may be newer than the version
52847 installed on your system.  If you are using GnuTLS 3,
52848 then the example code
52849 <emphasis role="bold"><ulink url="http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string">http://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string</ulink></emphasis>
52850 on that site can be used to test a given string.
52851 </para>
52852 <para>
52853 For example:
52854 </para>
52855 <literallayout class="monospaced">
52856 # Disable older versions of protocols
52857 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
52858 </literallayout>
52859 <para>
52860 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
52861 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
52862 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
52863 </para>
52864 <para>
52865 This example will let the library defaults be permitted on the MX port, where
52866 there&#x2019;s probably no identity verification anyway, and lowers security further
52867 by increasing compatibility; but this ups the ante on the submission ports
52868 where the administrator might have some influence on the choice of clients
52869 used:
52870 </para>
52871 <literallayout class="monospaced">
52872 # GnuTLS variant
52873 tls_require_ciphers = ${if =={$received_port}{25}\
52874                            {NORMAL:%COMPAT}\
52875                            {SECURE128}}
52876 </literallayout>
52877 </section>
52878 <section id="SECID182">
52879 <title>Configuring an Exim server to use TLS</title>
52880 <para>
52881 <indexterm role="concept">
52882 <primary>TLS</primary>
52883 <secondary>configuring an Exim server</secondary>
52884 </indexterm>
52885 When Exim has been built with TLS support, it advertises the availability of
52886 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
52887 but not to any others. The default value of this option is unset, which means
52888 that STARTTLS is not advertised at all. This default is chosen because you
52889 need to set some other options in order to make TLS available, and also it is
52890 sensible for systems that want to use TLS only as a client.
52891 </para>
52892 <para>
52893 If a client issues a STARTTLS command and there is some configuration
52894 problem in the server, the command is rejected with a 454 error. If the client
52895 persists in trying to issue SMTP commands, all except QUIT are rejected
52896 with the error
52897 </para>
52898 <literallayout class="monospaced">
52899 554 Security failure
52900 </literallayout>
52901 <para>
52902 If a STARTTLS command is issued within an existing TLS session, it is
52903 rejected with a 554 error code.
52904 </para>
52905 <para>
52906 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
52907 must be set to match some hosts. The default is * which matches all hosts.
52908 </para>
52909 <para>
52910 If this is all you do, TLS encryption will be enabled but not authentication -
52911 meaning that the peer has no assurance it is actually you he is talking to.
52912 You gain protection from a passive sniffer listening on the wire but not
52913 from someone able to intercept the communication.
52914 </para>
52915 <para>
52916 Further protection requires some further configuration at the server end.
52917 </para>
52918 <para>
52919 It is rumoured that all existing clients that support TLS/SSL use RSA
52920 encryption. To make this work you need to set, in the server,
52921 </para>
52922 <literallayout class="monospaced">
52923 tls_certificate = /some/file/name
52924 tls_privatekey = /some/file/name
52925 </literallayout>
52926 <para>
52927 These options are, in fact, expanded strings, so you can make them depend on
52928 the identity of the client that is connected if you wish. The first file
52929 contains the server&#x2019;s X509 certificate, and the second contains the private key
52930 that goes with it. These files need to be
52931 PEM format and readable by the Exim user, and must
52932 always be given as full path names.
52933 The key must not be password-protected.
52934 They can be the same file if both the
52935 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
52936 set, or if its expansion is forced to fail or results in an empty string, this
52937 is assumed to be the case. The certificate file may also contain intermediate
52938 certificates that need to be sent to the client to enable it to authenticate
52939 the server&#x2019;s certificate.
52940 </para>
52941 <para>
52942 If you do not understand about certificates and keys, please try to find a
52943 source of this background information, which is not Exim-specific. (There are a
52944 few comments below in section <xref linkend="SECTcerandall"/>.)
52945 </para>
52946 <para>
52947 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
52948 they apply only in the case of a server. If you need to use a certificate in an
52949 Exim client, you must set the options of the same names in an <command>smtp</command>
52950 transport.
52951 </para>
52952 <para>
52953 With just these options, an Exim server will be able to use TLS. It does not
52954 require the client to have a certificate (but see below for how to insist on
52955 this). There is one other option that may be needed in other situations. If
52956 </para>
52957 <literallayout class="monospaced">
52958 tls_dhparam = /some/file/name
52959 </literallayout>
52960 <para>
52961 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
52962 with the parameters contained in the file.
52963 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
52964 available:
52965 </para>
52966 <literallayout class="monospaced">
52967 tls_dhparam = none
52968 </literallayout>
52969 <para>
52970 This may also be set to a string identifying a standard prime to be used for
52971 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
52972 used is <literal>ike23</literal>.  There are a few standard primes available, see the
52973 documentation for <option>tls_dhparam</option> for the complete list.
52974 </para>
52975 <para>
52976 See the command
52977 </para>
52978 <literallayout class="monospaced">
52979 openssl dhparam
52980 </literallayout>
52981 <para>
52982 for a way of generating file data.
52983 </para>
52984 <para>
52985 The strings supplied for these three options are expanded every time a client
52986 host connects. It is therefore possible to use different certificates and keys
52987 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
52988 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
52989 forced to fail, Exim behaves as if the option is not set.
52990 </para>
52991 <para>
52992 <indexterm role="concept">
52993 <primary>cipher</primary>
52994 <secondary>logging</secondary>
52995 </indexterm>
52996 <indexterm role="concept">
52997 <primary>log</primary>
52998 <secondary>TLS cipher</secondary>
52999 </indexterm>
53000 <indexterm role="variable">
53001 <primary><varname>$tls_in_cipher</varname></primary>
53002 </indexterm>
53003 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
53004 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
53005 incoming message (by default &ndash; you can, of course, change this), and it is
53006 also included in the log line that records a message&#x2019;s arrival, keyed by
53007 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
53008 condition can be used to test for specific cipher suites in ACLs.
53009 </para>
53010 <para>
53011 Once TLS has been established, the ACLs that run for subsequent SMTP commands
53012 can check the name of the cipher suite and vary their actions accordingly. The
53013 cipher suite names vary, depending on which TLS library is being used. For
53014 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
53015 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
53016 documentation for more details.
53017 </para>
53018 <para>
53019 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
53020 (again depending on the <option>tls_cipher</option> log selector).
53021 </para>
53022 </section>
53023 <section id="SECID183">
53024 <title>Requesting and verifying client certificates</title>
53025 <para>
53026 <indexterm role="concept">
53027 <primary>certificate</primary>
53028 <secondary>verification of client</secondary>
53029 </indexterm>
53030 <indexterm role="concept">
53031 <primary>TLS</primary>
53032 <secondary>client certificate verification</secondary>
53033 </indexterm>
53034 If you want an Exim server to request a certificate when negotiating a TLS
53035 session with a client, you must set either <option>tls_verify_hosts</option> or
53036 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
53037 apply to all TLS connections. For any host that matches one of these options,
53038 Exim requests a certificate as part of the setup of the TLS session. The
53039 contents of the certificate are verified by comparing it with a list of
53040 expected certificates.
53041 These may be the system default set (depending on library version),
53042 an explicit file or,
53043 depending on library version, a directory, identified by
53044 <option>tls_verify_certificates</option>.
53045 </para>
53046 <para>
53047 A file can contain multiple certificates, concatenated end to end. If a
53048 directory is used
53049 (OpenSSL only),
53050 each certificate must be in a separate file, with a name (or a symbolic link)
53051 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
53052 certificate. You can compute the relevant hash by running the command
53053 </para>
53054 <literallayout class="monospaced">
53055 openssl x509 -hash -noout -in /cert/file
53056 </literallayout>
53057 <para>
53058 where <filename>/cert/file</filename> contains a single certificate.
53059 </para>
53060 <para>
53061 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
53062 what happens if the client does not supply a certificate, or if the certificate
53063 does not match any of the certificates in the collection named by
53064 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
53065 attempt to set up a TLS session is aborted, and the incoming connection is
53066 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
53067 session continues. ACLs that run for subsequent SMTP commands can detect the
53068 fact that no certificate was verified, and vary their actions accordingly. For
53069 example, you can insist on a certificate before accepting a message for
53070 relaying, but not when the message is destined for local delivery.
53071 </para>
53072 <para>
53073 <indexterm role="variable">
53074 <primary><varname>$tls_in_peerdn</varname></primary>
53075 </indexterm>
53076 When a client supplies a certificate (whether it verifies or not), the value of
53077 the Distinguished Name of the certificate is made available in the variable
53078 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
53079 </para>
53080 <para>
53081 <indexterm role="concept">
53082 <primary>log</primary>
53083 <secondary>distinguished name</secondary>
53084 </indexterm>
53085 Because it is often a long text string, it is not included in the log line or
53086 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
53087 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
53088 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
53089 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
53090 </para>
53091 </section>
53092 <section id="SECID184">
53093 <title>Revoked certificates</title>
53094 <para>
53095 <indexterm role="concept">
53096 <primary>TLS</primary>
53097 <secondary>revoked certificates</secondary>
53098 </indexterm>
53099 <indexterm role="concept">
53100 <primary>revocation list</primary>
53101 </indexterm>
53102 <indexterm role="concept">
53103 <primary>certificate</primary>
53104 <secondary>revocation list</secondary>
53105 </indexterm>
53106 <indexterm role="concept">
53107 <primary>OCSP</primary>
53108 <secondary>stapling</secondary>
53109 </indexterm>
53110 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
53111 certificates are revoked. If you have such a list, you can pass it to an Exim
53112 server using the global option called <option>tls_crl</option> and to an Exim client using
53113 an identically named option for the <command>smtp</command> transport. In each case, the value
53114 of the option is expanded and must then be the name of a file that contains a
53115 CRL in PEM format.
53116 The downside is that clients have to periodically re-download a potentially huge
53117 file from every certificate authority they know of.
53118 </para>
53119 <para>
53120 The way with most moving parts at query time is Online Certificate
53121 Status Protocol (OCSP), where the client verifies the certificate
53122 against an OCSP server run by the CA.  This lets the CA track all
53123 usage of the certs.  It requires running software with access to the
53124 private key of the CA, to sign the responses to the OCSP queries.  OCSP
53125 is based on HTTP and can be proxied accordingly.
53126 </para>
53127 <para>
53128 The only widespread OCSP server implementation (known to this writer)
53129 comes as part of OpenSSL and aborts on an invalid request, such as
53130 connecting to the port and then disconnecting.  This requires
53131 re-entering the passphrase each time some random client does this.
53132 </para>
53133 <para>
53134 The third way is OCSP Stapling; in this, the server using a certificate
53135 issued by the CA periodically requests an OCSP proof of validity from
53136 the OCSP server, then serves it up inline as part of the TLS
53137 negotiation.   This approach adds no extra round trips, does not let the
53138 CA track users, scales well with number of certs issued by the CA and is
53139 resilient to temporary OCSP server failures, as long as the server
53140 starts retrying to fetch an OCSP proof some time before its current
53141 proof expires.  The downside is that it requires server support.
53142 </para>
53143 <para>
53144 Unless Exim is built with the support disabled,
53145 or with GnuTLS earlier than version 3.3.16 / 3.4.8
53146 support for OCSP stapling is included.
53147 </para>
53148 <para>
53149 There is a global option called <option>tls_ocsp_file</option>.
53150 The file specified therein is expected to be in DER format, and contain
53151 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
53152 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
53153 contains <literal>tls_in_sni</literal>, as per other TLS options.
53154 </para>
53155 <para>
53156 Exim does not at this time implement any support for fetching a new OCSP
53157 proof.  The burden is on the administrator to handle this, outside of
53158 Exim.  The file specified should be replaced atomically, so that the
53159 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
53160 on each connection, so a new file will be handled transparently on the
53161 next connection.
53162 </para>
53163 <para>
53164 When built with OpenSSL Exim will check for a valid next update timestamp
53165 in the OCSP proof; if not present, or if the proof has expired, it will be
53166 ignored.
53167 </para>
53168 <para>
53169 For the client to be able to verify the stapled OCSP the server must
53170 also supply, in its stapled information, any intermediate
53171 certificates for the chain leading to the OCSP proof from the signer
53172 of the server certificate.  There may be zero or one such. These
53173 intermediate certificates should be added to the server OCSP stapling
53174 file named by <option>tls_ocsp_file</option>.
53175 </para>
53176 <para>
53177 Note that the proof only covers the terminal server certificate,
53178 not any of the chain from CA to it.
53179 </para>
53180 <para>
53181 There is no current way to staple a proof for a client certificate.
53182 </para>
53183 <literallayout class="monospaced">
53184   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
53185   OCSP server is supplied.  The server URL may be included in the
53186   server certificate, if the CA is helpful.
53187
53188   One failure mode seen was the OCSP Signer cert expiring before the end
53189   of validity of the OCSP proof. The checking done by Exim/OpenSSL
53190   noted this as invalid overall, but the re-fetch script did not.
53191 </literallayout>
53192 </section>
53193 <section id="SECID185">
53194 <title>Configuring an Exim client to use TLS</title>
53195 <para>
53196 <indexterm role="concept">
53197 <primary>cipher</primary>
53198 <secondary>logging</secondary>
53199 </indexterm>
53200 <indexterm role="concept">
53201 <primary>log</primary>
53202 <secondary>TLS cipher</secondary>
53203 </indexterm>
53204 <indexterm role="concept">
53205 <primary>log</primary>
53206 <secondary>distinguished name</secondary>
53207 </indexterm>
53208 <indexterm role="concept">
53209 <primary>TLS</primary>
53210 <secondary>configuring an Exim client</secondary>
53211 </indexterm>
53212 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
53213 deliveries as well as to incoming, the latter one causing logging of the
53214 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
53215 within the <command>smtp</command> transport.
53216 </para>
53217 <para>
53218 It is not necessary to set any options to have TLS work in the <command>smtp</command>
53219 transport. If Exim is built with TLS support, and TLS is advertised by a
53220 server, the <command>smtp</command> transport always tries to start a TLS session. However,
53221 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
53222 transport) to a list of server hosts for which TLS should not be used.
53223 </para>
53224 <para>
53225 If you do not want Exim to attempt to send messages unencrypted when an attempt
53226 to set up an encrypted connection fails in any way, you can set
53227 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
53228 those hosts, delivery is always deferred if an encrypted connection cannot be
53229 set up. If there are any other hosts for the address, they are tried in the
53230 usual way.
53231 </para>
53232 <para>
53233 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
53234 the message unencrypted. It always does this if the response to STARTTLS is
53235 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
53236 session after a success response code, what happens is controlled by the
53237 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
53238 delivery to this host is deferred, and other hosts (if available) are tried. If
53239 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
53240 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
53241 negotiation fails, Exim closes the current connection (because it is in an
53242 unknown state), opens a new one to the same host, and then tries the delivery
53243 unencrypted.
53244 </para>
53245 <para>
53246 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
53247 transport provide the client with a certificate, which is passed to the server
53248 if it requests it. If the server is Exim, it will request a certificate only if
53249 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
53250 </para>
53251 <para>
53252 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
53253 specifies a collection of expected server certificates.
53254 These may be the system default set (depending on library version),
53255 a file or,
53256 depending on library version, a directory,
53257 must name a file or,
53258 for OpenSSL only (not GnuTLS), a directory.
53259 The client verifies the server&#x2019;s certificate
53260 against this collection, taking into account any revoked certificates that are
53261 in the list defined by <option>tls_crl</option>.
53262 Failure to verify fails the TLS connection unless either of the
53263 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
53264 </para>
53265 <para>
53266 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
53267 certificate verification to the listed servers.  Verification either must
53268 or need not succeed respectively.
53269 </para>
53270 <para>
53271 The <command>smtp</command> transport has two OCSP-related options:
53272 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
53273 is requested and required for the connection to proceed.  The default
53274 value is empty.
53275 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
53276 a Certificate Status is requested (but not necessarily verified).  The default
53277 value is "*" meaning that requests are made unless configured
53278 otherwise.
53279 </para>
53280 <para>
53281 The host(s) should also be in <option>hosts_require_tls</option>, and
53282 <option>tls_verify_certificates</option> configured for the transport,
53283 for OCSP to be relevant.
53284 </para>
53285 <para>
53286 If
53287 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
53288 list of permitted cipher suites. If either of these checks fails, delivery to
53289 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
53290 alternative hosts, if any.
53291 </para>
53292 <para>
53293  <emphasis role="bold">Note</emphasis>:
53294 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
53295 is operating as a client. Exim does not assume that a server certificate (set
53296 by the global options of the same name) should also be used when operating as a
53297 client.
53298 </para>
53299 <para>
53300 <indexterm role="variable">
53301 <primary><varname>$host</varname></primary>
53302 </indexterm>
53303 <indexterm role="variable">
53304 <primary><varname>$host_address</varname></primary>
53305 </indexterm>
53306 All the TLS options in the <command>smtp</command> transport are expanded before use, with
53307 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
53308 which the client is connected. Forced failure of an expansion causes Exim to
53309 behave as if the relevant option were unset.
53310 </para>
53311 <para>
53312 <indexterm role="variable">
53313 <primary><varname>$tls_out_bits</varname></primary>
53314 </indexterm>
53315 <indexterm role="variable">
53316 <primary><varname>$tls_out_cipher</varname></primary>
53317 </indexterm>
53318 <indexterm role="variable">
53319 <primary><varname>$tls_out_peerdn</varname></primary>
53320 </indexterm>
53321 <indexterm role="variable">
53322 <primary><varname>$tls_out_sni</varname></primary>
53323 </indexterm>
53324 Before an SMTP connection is established, the
53325 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
53326 variables are emptied. (Until the first connection, they contain the values
53327 that were set when the message was received.) If STARTTLS is subsequently
53328 successfully obeyed, these variables are set to the relevant values for the
53329 outgoing connection.
53330 </para>
53331 </section>
53332 <section id="SECTtlssni">
53333 <title>Use of TLS Server Name Indication</title>
53334 <para>
53335 <indexterm role="concept">
53336 <primary>TLS</primary>
53337 <secondary>Server Name Indication</secondary>
53338 </indexterm>
53339 <indexterm role="variable">
53340 <primary><varname>$tls_in_sni</varname></primary>
53341 </indexterm>
53342 <indexterm role="option">
53343 <primary><option>tls_in_sni</option></primary>
53344 </indexterm>
53345 With TLS1.0 or above, there is an extension mechanism by which extra
53346 information can be included at various points in the protocol.  One of these
53347 extensions, documented in RFC 6066 (and before that RFC 4366) is
53348 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
53349 client in the initial handshake, so that the server can examine the servername
53350 within and possibly choose to use different certificates and keys (and more)
53351 for this session.
53352 </para>
53353 <para>
53354 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
53355 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
53356 address.
53357 </para>
53358 <para>
53359 With SMTP to MX, there are the same problems here as in choosing the identity
53360 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
53361 provide the identity which you then cryptographically verify.  So this will
53362 be of limited use in that environment.
53363 </para>
53364 <para>
53365 With SMTP to Submission, there is a well-defined hostname which clients are
53366 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
53367 choose to include this information in the TLS negotiation.  If this becomes
53368 wide-spread, then hosters can choose to present different certificates to
53369 different clients.  Or even negotiate different cipher suites.
53370 </para>
53371 <para>
53372 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
53373 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
53374 nothing more to it.  Choosing a sensible value not derived insecurely is the
53375 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
53376 for the lifetime of the client connection (including during authentication).
53377 </para>
53378 <para>
53379 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
53380 received from a client.
53381 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
53382 </para>
53383 <para>
53384 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
53385 option (prior to expansion) then the following options will be re-expanded
53386 during TLS session handshake, to permit alternative values to be chosen:
53387 </para>
53388 <itemizedlist>
53389 <listitem>
53390 <para>
53391 <indexterm role="variable">
53392 <primary><option>tls_certificate</option></primary>
53393 </indexterm>
53394 <option>tls_certificate</option>
53395 </para>
53396 </listitem>
53397 <listitem>
53398 <para>
53399 <indexterm role="variable">
53400 <primary><option>tls_crl</option></primary>
53401 </indexterm>
53402 <option>tls_crl</option>
53403 </para>
53404 </listitem>
53405 <listitem>
53406 <para>
53407 <indexterm role="variable">
53408 <primary><option>tls_privatekey</option></primary>
53409 </indexterm>
53410 <option>tls_privatekey</option>
53411 </para>
53412 </listitem>
53413 <listitem>
53414 <para>
53415 <indexterm role="variable">
53416 <primary><option>tls_verify_certificates</option></primary>
53417 </indexterm>
53418 <option>tls_verify_certificates</option>
53419 </para>
53420 </listitem>
53421 <listitem>
53422 <para>
53423 <indexterm role="variable">
53424 <primary><option>tls_ocsp_file</option></primary>
53425 </indexterm>
53426 <option>tls_ocsp_file</option>
53427 </para>
53428 </listitem>
53429 </itemizedlist>
53430 <para>
53431 Great care should be taken to deal with matters of case, various injection
53432 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
53433 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
53434 arbitrary unverified data provided prior to authentication.
53435 Further, the initial certificate is loaded before SNI is arrived, so
53436 an expansion for <option>tls_certificate</option> must have a default which is used
53437 when <varname>$tls_in_sni</varname> is empty.
53438 </para>
53439 <para>
53440 The Exim developers are proceeding cautiously and so far no other TLS options
53441 are re-expanded.
53442 </para>
53443 <para>
53444 When Exim is built against OpenSSL, OpenSSL must have been built with support
53445 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
53446 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
53447 see <literal>-servername</literal> in the output, then OpenSSL has support.
53448 </para>
53449 <para>
53450 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
53451 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
53452 built, then you have SNI support).
53453 </para>
53454 </section>
53455 <section id="SECTmulmessam">
53456 <title>Multiple messages on the same encrypted TCP/IP connection</title>
53457 <para>
53458 <indexterm role="concept">
53459 <primary>multiple SMTP deliveries with TLS</primary>
53460 </indexterm>
53461 <indexterm role="concept">
53462 <primary>TLS</primary>
53463 <secondary>multiple message deliveries</secondary>
53464 </indexterm>
53465 Exim sends multiple messages down the same TCP/IP connection by starting up
53466 an entirely new delivery process for each message, passing the socket from
53467 one process to the next. This implementation does not fit well with the use
53468 of TLS, because there is quite a lot of state information associated with a TLS
53469 connection, not just a socket identification. Passing all the state information
53470 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
53471 session before passing the socket to a new process. The new process may then
53472 try to start a new TLS session, and if successful, may try to re-authenticate
53473 if AUTH is in use, before sending the next message.
53474 </para>
53475 <para>
53476 The RFC is not clear as to whether or not an SMTP session continues in clear
53477 after TLS has been shut down, or whether TLS may be restarted again later, as
53478 just described. However, if the server is Exim, this shutdown and
53479 reinitialization works. It is not known which (if any) other servers operate
53480 successfully if the client closes a TLS session and continues with unencrypted
53481 SMTP, but there are certainly some that do not work. For such servers, Exim
53482 should not pass the socket to another process, because the failure of the
53483 subsequent attempt to use it would cause Exim to record a temporary host error,
53484 and delay other deliveries to that host.
53485 </para>
53486 <para>
53487 To test for this case, Exim sends an EHLO command to the server after
53488 closing down the TLS session. If this fails in any way, the connection is
53489 closed instead of being passed to a new delivery process, but no retry
53490 information is recorded.
53491 </para>
53492 <para>
53493 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
53494 <command>smtp</command> transport to match those hosts for which Exim should not pass
53495 connections to new processes if TLS has been used.
53496 </para>
53497 </section>
53498 <section id="SECTcerandall">
53499 <title>Certificates and all that</title>
53500 <para>
53501 <indexterm role="concept">
53502 <primary>certificate</primary>
53503 <secondary>references to discussion</secondary>
53504 </indexterm>
53505 In order to understand fully how TLS works, you need to know about
53506 certificates, certificate signing, and certificate authorities. This is not the
53507 place to give a tutorial, especially as I do not know very much about it
53508 myself. Some helpful introduction can be found in the FAQ for the SSL addition
53509 to Apache, currently at
53510 </para>
53511 <literallayout>
53512 <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>
53513 </literallayout>
53514 <para>
53515 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
53516 links to further files.
53517 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
53518 0-201-61598-3), contains both introductory and more in-depth descriptions.
53519 Some sample programs taken from the book are available from
53520 </para>
53521 <literallayout>
53522 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
53523 </literallayout>
53524 </section>
53525 <section id="SECID186">
53526 <title>Certificate chains</title>
53527 <para>
53528 The file named by <option>tls_certificate</option> may contain more than one
53529 certificate. This is useful in the case where the certificate that is being
53530 sent is validated by an intermediate certificate which the other end does
53531 not have. Multiple certificates must be in the correct order in the file.
53532 First the host&#x2019;s certificate itself, then the first intermediate
53533 certificate to validate the issuer of the host certificate, then the next
53534 intermediate certificate to validate the issuer of the first intermediate
53535 certificate, and so on, until finally (optionally) the root certificate.
53536 The root certificate must already be trusted by the recipient for
53537 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
53538 root certificate along with the rest makes it available for the user to
53539 install if the receiving end is a client MUA that can interact with a user.
53540 </para>
53541 <para>
53542 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
53543 even if your libraries allow loading them for use in Exim when acting as a
53544 server, increasingly clients will not accept such certificates.  The error
53545 diagnostics in such a case can be frustratingly vague.
53546 </para>
53547 </section>
53548 <section id="SECID187">
53549 <title>Self-signed certificates</title>
53550 <para>
53551 <indexterm role="concept">
53552 <primary>certificate</primary>
53553 <secondary>self-signed</secondary>
53554 </indexterm>
53555 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
53556 with OpenSSL, like this:
53557 </para>
53558 <literallayout class="monospaced">
53559 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
53560             -days 9999 -nodes
53561 </literallayout>
53562 <para>
53563 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
53564 delimited and so can be identified independently. The <option>-days</option> option
53565 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
53566 important: if you do not set it, the key is encrypted with a passphrase
53567 that you are prompted for, and any use that is made of the key causes more
53568 prompting for the passphrase. This is not helpful if you are going to use
53569 this certificate and key in an MTA, where prompting is not possible.
53570 </para>
53571 <para>
53572 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
53573 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
53574 the above command might produce a date in the past.  Think carefully about
53575 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
53576 of the certificate or reconsider your platform deployment.  (At time of
53577 writing, reducing the duration is the most likely choice, but the inexorable
53578 progression of time takes us steadily towards an era where this will not
53579 be a sensible resolution).
53580 </para>
53581 <para>
53582 A self-signed certificate made in this way is sufficient for testing, and
53583 may be adequate for all your requirements if you are mainly interested in
53584 encrypting transfers, and not in secure identification.
53585 </para>
53586 <para>
53587 However, many clients require that the certificate presented by the server be a
53588 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
53589 certificate. In this situation, the self-signed certificate described above
53590 must be installed on the client host as a trusted root <emphasis>certification
53591 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
53592 signed with that self-signed certificate.
53593 </para>
53594 <para>
53595 For information on creating self-signed CA certificates and using them to sign
53596 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
53597 Open-source PKI book, available online at
53598 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
53599 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
53600 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
53601 </para>
53602 </section>
53603 </chapter>
53604
53605 <chapter id="CHAPACL">
53606 <title>Access control lists</title>
53607 <para>
53608 <indexterm role="concept" id="IIDacl" class="startofrange">
53609 <primary>access control lists (ACLs)</primary>
53610 <secondary>description</secondary>
53611 </indexterm>
53612 <indexterm role="concept">
53613 <primary>control of incoming mail</primary>
53614 </indexterm>
53615 <indexterm role="concept">
53616 <primary>message</primary>
53617 <secondary>controlling incoming</secondary>
53618 </indexterm>
53619 <indexterm role="concept">
53620 <primary>policy control</primary>
53621 <secondary>access control lists</secondary>
53622 </indexterm>
53623 Access Control Lists (ACLs) are defined in a separate section of the run time
53624 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
53625 name, terminated by a colon. Here is a complete ACL section that contains just
53626 one very small ACL:
53627 </para>
53628 <literallayout class="monospaced">
53629 begin acl
53630 small_acl:
53631   accept   hosts = one.host.only
53632 </literallayout>
53633 <para>
53634 You can have as many lists as you like in the ACL section, and the order in
53635 which they appear does not matter. The lists are self-terminating.
53636 </para>
53637 <para>
53638 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
53639 certain SMTP commands. This applies both to incoming TCP/IP connections, and
53640 when a local process submits a message using SMTP by specifying the <option>-bs</option>
53641 option. The most common use is for controlling which recipients are accepted
53642 in incoming messages. In addition, you can define an ACL that is used to check
53643 local non-SMTP messages. The default configuration file contains an example of
53644 a realistic ACL for checking RCPT commands. This is discussed in chapter
53645 <xref linkend="CHAPdefconfil"/>.
53646 </para>
53647 <section id="SECID188">
53648 <title>Testing ACLs</title>
53649 <para>
53650 The <option>-bh</option> command line option provides a way of testing your ACL
53651 configuration locally by running a fake SMTP session with which you interact.
53652 </para>
53653 </section>
53654 <section id="SECID189">
53655 <title>Specifying when ACLs are used</title>
53656 <para>
53657 <indexterm role="concept">
53658 <primary>access control lists (ACLs)</primary>
53659 <secondary>options for specifying</secondary>
53660 </indexterm>
53661 In order to cause an ACL to be used, you have to name it in one of the relevant
53662 options in the main part of the configuration. These options are:
53663 <indexterm role="concept">
53664 <primary>AUTH</primary>
53665 <secondary>ACL for</secondary>
53666 </indexterm>
53667 <indexterm role="concept">
53668 <primary>DATA</primary>
53669 <secondary>ACLs for</secondary>
53670 </indexterm>
53671 <indexterm role="concept">
53672 <primary>ETRN</primary>
53673 <secondary>ACL for</secondary>
53674 </indexterm>
53675 <indexterm role="concept">
53676 <primary>EXPN</primary>
53677 <secondary>ACL for</secondary>
53678 </indexterm>
53679 <indexterm role="concept">
53680 <primary>HELO</primary>
53681 <secondary>ACL for</secondary>
53682 </indexterm>
53683 <indexterm role="concept">
53684 <primary>EHLO</primary>
53685 <secondary>ACL for</secondary>
53686 </indexterm>
53687 <indexterm role="concept">
53688 <primary>DKIM</primary>
53689 <secondary>ACL for</secondary>
53690 </indexterm>
53691 <indexterm role="concept">
53692 <primary>MAIL</primary>
53693 <secondary>ACL for</secondary>
53694 </indexterm>
53695 <indexterm role="concept">
53696 <primary>QUIT, ACL for</primary>
53697 </indexterm>
53698 <indexterm role="concept">
53699 <primary>RCPT</primary>
53700 <secondary>ACL for</secondary>
53701 </indexterm>
53702 <indexterm role="concept">
53703 <primary>STARTTLS, ACL for</primary>
53704 </indexterm>
53705 <indexterm role="concept">
53706 <primary>VRFY</primary>
53707 <secondary>ACL for</secondary>
53708 </indexterm>
53709 <indexterm role="concept">
53710 <primary>SMTP</primary>
53711 <secondary>connection, ACL for</secondary>
53712 </indexterm>
53713 <indexterm role="concept">
53714 <primary>non-SMTP messages</primary>
53715 <secondary>ACLs for</secondary>
53716 </indexterm>
53717 <indexterm role="concept">
53718 <primary>MIME content scanning</primary>
53719 <secondary>ACL for</secondary>
53720 </indexterm>
53721 <indexterm role="concept">
53722 <primary>PRDR</primary>
53723 <secondary>ACL for</secondary>
53724 </indexterm>
53725 </para>
53726 <informaltable frame="none">
53727 <tgroup cols="2" colsep="0" rowsep="0">
53728 <colspec colwidth="140pt" align="left"/>
53729 <colspec colwidth="254pt" align="left"/>
53730 <tbody>
53731 <row>
53732 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
53733 <entry>ACL for non-SMTP messages</entry>
53734 </row>
53735 <row>
53736 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
53737 <entry>ACL for non-SMTP MIME parts</entry>
53738 </row>
53739 <row>
53740 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
53741 <entry>ACL at start of non-SMTP message</entry>
53742 </row>
53743 <row>
53744 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
53745 <entry>ACL for AUTH</entry>
53746 </row>
53747 <row>
53748 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
53749 <entry>ACL for start of SMTP connection</entry>
53750 </row>
53751 <row>
53752 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
53753 <entry>ACL after DATA is complete</entry>
53754 </row>
53755 <row>
53756 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
53757 <entry>ACL for each recipient, after DATA is complete</entry>
53758 </row>
53759 <row>
53760 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
53761 <entry>ACL for each DKIM signer</entry>
53762 </row>
53763 <row>
53764 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
53765 <entry>ACL for ETRN</entry>
53766 </row>
53767 <row>
53768 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
53769 <entry>ACL for EXPN</entry>
53770 </row>
53771 <row>
53772 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
53773 <entry>ACL for HELO or EHLO</entry>
53774 </row>
53775 <row>
53776 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
53777 <entry>ACL for MAIL</entry>
53778 </row>
53779 <row>
53780 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
53781 <entry>ACL for the AUTH parameter of MAIL</entry>
53782 </row>
53783 <row>
53784 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
53785 <entry>ACL for content-scanning MIME parts</entry>
53786 </row>
53787 <row>
53788 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
53789 <entry>ACL for non-QUIT terminations</entry>
53790 </row>
53791 <row>
53792 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
53793 <entry>ACL at start of DATA command</entry>
53794 </row>
53795 <row>
53796 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
53797 <entry>ACL for QUIT</entry>
53798 </row>
53799 <row>
53800 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
53801 <entry>ACL for RCPT</entry>
53802 </row>
53803 <row>
53804 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
53805 <entry>ACL for STARTTLS</entry>
53806 </row>
53807 <row>
53808 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
53809 <entry>ACL for VRFY</entry>
53810 </row>
53811 </tbody>
53812 </tgroup>
53813 </informaltable>
53814 <para>
53815 For example, if you set
53816 </para>
53817 <literallayout class="monospaced">
53818 acl_smtp_rcpt = small_acl
53819 </literallayout>
53820 <para>
53821 the little ACL defined above is used whenever Exim receives a RCPT command
53822 in an SMTP dialogue. The majority of policy tests on incoming messages can be
53823 done when RCPT commands arrive. A rejection of RCPT should cause the
53824 sending MTA to give up on the recipient address contained in the RCPT
53825 command, whereas rejection at other times may cause the client MTA to keep on
53826 trying to deliver the message. It is therefore recommended that you do as much
53827 testing as possible at RCPT time.
53828 </para>
53829 </section>
53830 <section id="SECID190">
53831 <title>The non-SMTP ACLs</title>
53832 <para>
53833 <indexterm role="concept">
53834 <primary>non-SMTP messages</primary>
53835 <secondary>ACLs for</secondary>
53836 </indexterm>
53837 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
53838 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
53839 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
53840 the state of the SMTP connection such as encryption and authentication) are not
53841 relevant and are forbidden in these ACLs. However, the sender and recipients
53842 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
53843 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
53844 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
53845 in any of these ACLs.
53846 </para>
53847 <para>
53848 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
53849 non-SMTP message, before any of the message has been read. (This is the
53850 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
53851 batched SMTP input, it runs after the DATA command has been reached. The
53852 result of this ACL is ignored; it cannot be used to reject a message. If you
53853 really need to, you could set a value in an ACL variable here and reject based
53854 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
53855 controls, and in particular, it can be used to set
53856 </para>
53857 <literallayout class="monospaced">
53858 control = suppress_local_fixups
53859 </literallayout>
53860 <para>
53861 This cannot be used in the other non-SMTP ACLs because by the time they are
53862 run, it is too late.
53863 </para>
53864 <para>
53865 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
53866 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
53867 </para>
53868 <para>
53869 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
53870 kind of rejection is treated as permanent, because there is no way of sending a
53871 temporary error for these kinds of message.
53872 </para>
53873 </section>
53874 <section id="SECID191">
53875 <title>The SMTP connect ACL</title>
53876 <para>
53877 <indexterm role="concept">
53878 <primary>SMTP</primary>
53879 <secondary>connection, ACL for</secondary>
53880 </indexterm>
53881 <indexterm role="option">
53882 <primary><option>smtp_banner</option></primary>
53883 </indexterm>
53884 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
53885 session, after the test specified by <option>host_reject_connection</option> (which is now
53886 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
53887 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
53888 the message override the banner message that is otherwise specified by the
53889 <option>smtp_banner</option> option.
53890 </para>
53891 </section>
53892 <section id="SECID192">
53893 <title>The EHLO/HELO ACL</title>
53894 <para>
53895 <indexterm role="concept">
53896 <primary>EHLO</primary>
53897 <secondary>ACL for</secondary>
53898 </indexterm>
53899 <indexterm role="concept">
53900 <primary>HELO</primary>
53901 <secondary>ACL for</secondary>
53902 </indexterm>
53903 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
53904 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
53905 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
53906 Note that a client may issue more than one EHLO or HELO command in an SMTP
53907 session, and indeed is required to issue a new EHLO or HELO after successfully
53908 setting up encryption following a STARTTLS command.
53909 </para>
53910 <para>
53911 Note also that a deny neither forces the client to go away nor means that
53912 mail will be refused on the connection.  Consider checking for
53913 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
53914 </para>
53915 <para>
53916 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
53917 modifier, the message may not contain more than one line (it will be truncated
53918 at the first newline and a panic logged if it does). Such a message cannot
53919 affect the EHLO options that are listed on the second and subsequent lines of
53920 an EHLO response.
53921 </para>
53922 </section>
53923 <section id="SECID193">
53924 <title>The DATA ACLs</title>
53925 <para>
53926 <indexterm role="concept">
53927 <primary>DATA</primary>
53928 <secondary>ACLs for</secondary>
53929 </indexterm>
53930 Two ACLs are associated with the DATA command, because it is two-stage
53931 command, with two responses being sent to the client.
53932 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
53933 is obeyed. This gives you control after all the RCPT commands, but before
53934 the message itself is received. It offers the opportunity to give a negative
53935 response to the DATA command before the data is transmitted. Header lines
53936 added by MAIL or RCPT ACLs are not visible at this time, but any that
53937 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
53938 </para>
53939 <para>
53940 You cannot test the contents of the message, for example, to verify addresses
53941 in the headers, at RCPT time or when the DATA command is received. Such
53942 tests have to appear in the ACL that is run after the message itself has been
53943 received, before the final response to the DATA command is sent. This is
53944 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
53945 associated with the DATA command.
53946 </para>
53947 <para>
53948 <indexterm role="concept">
53949 <primary>CHUNKING</primary>
53950 <secondary>BDAT command</secondary>
53951 </indexterm>
53952 <indexterm role="concept">
53953 <primary>BDAT</primary>
53954 <secondary>SMTP command</secondary>
53955 </indexterm>
53956 <indexterm role="concept">
53957 <primary>RFC 3030</primary>
53958 <secondary>CHUNKING</secondary>
53959 </indexterm>
53960 If CHUNKING was advertised and a BDAT command sequence is received,
53961 the <option>acl_smtp_predata</option> ACL is not run.
53962 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
53963 the data specified is received.
53964 </para>
53965 <para>
53966 For both of these ACLs, it is not possible to reject individual recipients. An
53967 error response rejects the entire message. Unfortunately, it is known that some
53968 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
53969 before or after the data) correctly &ndash; they keep the message on their queues
53970 and try again later, but that is their problem, though it does waste some of
53971 your resources.
53972 </para>
53973 <para>
53974 The <option>acl_smtp_data</option> ACL is run after
53975 the <option>acl_smtp_data_prdr</option>,
53976 the <option>acl_smtp_dkim</option>
53977 and the <option>acl_smtp_mime</option> ACLs.
53978 </para>
53979 </section>
53980 <section id="SECTDKIMACL">
53981 <title>The SMTP DKIM ACL</title>
53982 <para>
53983 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
53984 enabled (which is the default).
53985 </para>
53986 <para>
53987 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
53988 received, and is executed for each DKIM signature found in a message.  If not
53989 otherwise specified, the default action is to accept.
53990 </para>
53991 <para>
53992 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
53993 </para>
53994 <para>
53995 For details on the operation of DKIM, see chapter <xref linkend="CHAPdkim"/>.
53996 </para>
53997 </section>
53998 <section id="SECID194">
53999 <title>The SMTP MIME ACL</title>
54000 <para>
54001 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
54002 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
54003 </para>
54004 <para>
54005 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
54006 </para>
54007 </section>
54008 <section id="SECTPRDRACL">
54009 <title>The SMTP PRDR ACL</title>
54010 <para>
54011 <indexterm role="concept">
54012 <primary>PRDR</primary>
54013 <secondary>ACL for</secondary>
54014 </indexterm>
54015 <indexterm role="option">
54016 <primary><option>prdr_enable</option></primary>
54017 </indexterm>
54018 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
54019 with PRDR support enabled (which is the default).
54020 It becomes active only when the PRDR feature is negotiated between
54021 client and server for a message, and more than one recipient
54022 has been accepted.
54023 </para>
54024 <para>
54025 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
54026 has been received, and is executed once for each recipient of the message
54027 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
54028 The test may accept, defer or deny for individual recipients.
54029 The <option>acl_smtp_data</option> will still be called after this ACL and
54030 can reject the message overall, even if this ACL has accepted it
54031 for some or all recipients.
54032 </para>
54033 <para>
54034 PRDR may be used to support per-user content filtering.  Without it
54035 one must defer any recipient after the first that has a different
54036 content-filter configuration.  With PRDR, the RCPT-time check
54037 <indexterm role="concept">
54038 <primary>PRDR</primary>
54039 <secondary>variable for</secondary>
54040 </indexterm>
54041 for this can be disabled when the variable <varname>$prdr_requested</varname>
54042 is <quote>yes</quote>.
54043 Any required difference in behaviour of the main DATA-time
54044 ACL should however depend on the PRDR-time ACL having run, as Exim
54045 will avoid doing so in some situations (e.g.  single-recipient mails).
54046 </para>
54047 <para>
54048 See also the <option>prdr_enable</option> global option
54049 and the <option>hosts_try_prdr</option> smtp transport option.
54050 </para>
54051 <para>
54052 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
54053 If the ACL is not defined, processing completes as if
54054 the feature was not requested by the client.
54055 </para>
54056 </section>
54057 <section id="SECTQUITACL">
54058 <title>The QUIT ACL</title>
54059 <para>
54060 <indexterm role="concept">
54061 <primary>QUIT, ACL for</primary>
54062 </indexterm>
54063 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
54064 does not affect the response code to QUIT, which is always 221. Thus, the ACL
54065 does not in fact control any access.
54066 For this reason, it may only accept
54067 or warn as its final result.
54068 </para>
54069 <para>
54070 This ACL can be used for tasks such as custom logging at the end of an SMTP
54071 session. For example, you can use ACL variables in other ACLs to count
54072 messages, recipients, etc., and log the totals at QUIT time using one or
54073 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
54074 </para>
54075 <para>
54076 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
54077 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
54078 </para>
54079 <para>
54080 You do not need to have a final <option>accept</option>, but if you do, you can use a
54081 <option>message</option> modifier to specify custom text that is sent as part of the 221
54082 response to QUIT.
54083 </para>
54084 <para>
54085 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
54086 failure (for example, failure to open a log file, or when Exim is bombing out
54087 because it has detected an unrecoverable error), all SMTP commands from the
54088 client are given temporary error responses until QUIT is received or the
54089 connection is closed. In these special cases, the QUIT ACL does not run.
54090 </para>
54091 </section>
54092 <section id="SECTNOTQUITACL">
54093 <title>The not-QUIT ACL</title>
54094 <para>
54095 <indexterm role="variable">
54096 <primary><varname>$acl_smtp_notquit</varname></primary>
54097 </indexterm>
54098 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
54099 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
54100 trouble, such as being unable to write to its log files, this ACL is not run,
54101 because it might try to do things (such as write to log files) that make the
54102 situation even worse.
54103 </para>
54104 <para>
54105 Like the QUIT ACL, this ACL is provided to make it possible to do customized
54106 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
54107 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
54108 and <option>warn</option>.
54109 </para>
54110 <para>
54111 <indexterm role="variable">
54112 <primary><varname>$smtp_notquit_reason</varname></primary>
54113 </indexterm>
54114 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
54115 to a string that indicates the reason for the termination of the SMTP
54116 connection. The possible values are:
54117 </para>
54118 <informaltable frame="none">
54119 <tgroup cols="2" colsep="0" rowsep="0">
54120 <colspec colwidth="196pt" align="left"/>
54121 <colspec colwidth="254pt" align="left"/>
54122 <tbody>
54123 <row>
54124 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
54125 <entry>Another ACL issued a <option>drop</option> command</entry>
54126 </row>
54127 <row>
54128 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
54129 <entry>Too many unknown or non-mail commands</entry>
54130 </row>
54131 <row>
54132 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
54133 <entry>Timeout while reading SMTP commands</entry>
54134 </row>
54135 <row>
54136 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
54137 <entry>The SMTP connection has been lost</entry>
54138 </row>
54139 <row>
54140 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
54141 <entry>Timeout while reading message data</entry>
54142 </row>
54143 <row>
54144 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
54145 <entry>The <function>local_scan()</function> function crashed</entry>
54146 </row>
54147 <row>
54148 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
54149 <entry>The <function>local_scan()</function> function timed out</entry>
54150 </row>
54151 <row>
54152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
54153 <entry>SIGTERM or SIGINT</entry>
54154 </row>
54155 <row>
54156 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
54157 <entry>SMTP synchronization error</entry>
54158 </row>
54159 <row>
54160 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
54161 <entry>TLS failed to start</entry>
54162 </row>
54163 </tbody>
54164 </tgroup>
54165 </informaltable>
54166 <para>
54167 In most cases when an SMTP connection is closed without having received QUIT,
54168 Exim sends an SMTP response message before actually closing the connection.
54169 With the exception of the <literal>acl-drop</literal> case, the default message can be
54170 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
54171 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
54172 used.
54173 </para>
54174 </section>
54175 <section id="SECID195">
54176 <title>Finding an ACL to use</title>
54177 <para>
54178 <indexterm role="concept">
54179 <primary>access control lists (ACLs)</primary>
54180 <secondary>finding which to use</secondary>
54181 </indexterm>
54182 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
54183 you can use different ACLs in different circumstances. For example,
54184 </para>
54185 <literallayout class="monospaced">
54186 acl_smtp_rcpt = ${if ={25}{$interface_port} \
54187                      {acl_check_rcpt} {acl_check_rcpt_submit} }
54188 </literallayout>
54189 <para>
54190 In the default configuration file there are some example settings for
54191 providing an RFC 4409 message submission service on port 587 and a
54192 non-standard <quote>smtps</quote> service on port 465. You can use a string
54193 expansion like this to choose an ACL for MUAs on these ports which is
54194 more appropriate for this purpose than the default ACL on port 25.
54195 </para>
54196 <para>
54197 The expanded string does not have to be the name of an ACL in the
54198 configuration file; there are other possibilities. Having expanded the
54199 string, Exim searches for an ACL as follows:
54200 </para>
54201 <itemizedlist>
54202 <listitem>
54203 <para>
54204 If the string begins with a slash, Exim uses it as a file name, and reads its
54205 contents as an ACL. The lines are processed in the same way as lines in the
54206 Exim configuration file. In particular, continuation lines are supported, blank
54207 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
54208 If the file does not exist or cannot be read, an error occurs (typically
54209 causing a temporary failure of whatever caused the ACL to be run). For example:
54210 </para>
54211 <literallayout class="monospaced">
54212 acl_smtp_data = /etc/acls/\
54213   ${lookup{$sender_host_address}lsearch\
54214   {/etc/acllist}{$value}{default}}
54215 </literallayout>
54216 <para>
54217 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
54218 back to a default if the lookup fails. If an ACL is successfully read from a
54219 file, it is retained in memory for the duration of the Exim process, so that it
54220 can be re-used without having to re-read the file.
54221 </para>
54222 </listitem>
54223 <listitem>
54224 <para>
54225 If the string does not start with a slash, and does not contain any spaces,
54226 Exim searches the ACL section of the configuration for an ACL whose name
54227 matches the string.
54228 </para>
54229 </listitem>
54230 <listitem>
54231 <para>
54232 If no named ACL is found, or if the string contains spaces, Exim parses
54233 the string as an inline ACL. This can save typing in cases where you just
54234 want to have something like
54235 </para>
54236 <literallayout class="monospaced">
54237 acl_smtp_vrfy = accept
54238 </literallayout>
54239 <para>
54240 in order to allow free use of the VRFY command. Such a string may contain
54241 newlines; it is processed in the same way as an ACL that is read from a file.
54242 </para>
54243 </listitem>
54244 </itemizedlist>
54245 </section>
54246 <section id="SECID196">
54247 <title>ACL return codes</title>
54248 <para>
54249 <indexterm role="concept">
54250 <primary>access control lists (ACLs)</primary>
54251 <secondary>return codes</secondary>
54252 </indexterm>
54253 Except for the QUIT ACL, which does not affect the SMTP return code (see
54254 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
54255 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
54256 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
54257 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
54258 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
54259 This also causes a 4<emphasis>xx</emphasis> return code.
54260 </para>
54261 <para>
54262 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
54263 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
54264 submitters of non-SMTP messages.
54265 </para>
54266 <para>
54267 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
54268 has the effect of <quote>accept</quote>, but causes either the entire message or an
54269 individual recipient address to be discarded. In other words, it is a
54270 blackholing facility. Use it with care.
54271 </para>
54272 <para>
54273 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
54274 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
54275 RCPT ACL is to discard just the one recipient address. If there are no
54276 recipients left when the message&#x2019;s data is received, the DATA ACL is not
54277 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
54278 remaining recipients. The <quote>discard</quote> return is not permitted for the
54279 <option>acl_smtp_predata</option> ACL.
54280 </para>
54281 <para revisionflag="changed">
54282 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
54283 is done on the address and the result determines the SMTP response.
54284 </para>
54285 <para>
54286 <indexterm role="concept">
54287 <primary><function>local_scan()</function> function</primary>
54288 <secondary>when all recipients discarded</secondary>
54289 </indexterm>
54290 The <function>local_scan()</function> function is always run, even if there are no remaining
54291 recipients; it may create new recipients.
54292 </para>
54293 </section>
54294 <section id="SECID197">
54295 <title>Unset ACL options</title>
54296 <para>
54297 <indexterm role="concept">
54298 <primary>access control lists (ACLs)</primary>
54299 <secondary>unset options</secondary>
54300 </indexterm>
54301 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
54302 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
54303 not defined at all. For any defined ACL, the default action when control
54304 reaches the end of the ACL statements is <quote>deny</quote>.
54305 </para>
54306 <para>
54307 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
54308 these two are ACLs that are used only for their side effects. They cannot be
54309 used to accept or reject anything.
54310 </para>
54311 <para>
54312 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
54313 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
54314 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
54315 when the ACL is not defined is <quote>accept</quote>.
54316 </para>
54317 <para>
54318 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
54319 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
54320 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
54321 messages over an SMTP connection. For an example, see the ACL in the default
54322 configuration file.
54323 </para>
54324 </section>
54325 <section id="SECID198">
54326 <title>Data for message ACLs</title>
54327 <para>
54328 <indexterm role="concept">
54329 <primary>access control lists (ACLs)</primary>
54330 <secondary>data for message ACL</secondary>
54331 </indexterm>
54332 <indexterm role="variable">
54333 <primary><varname>$domain</varname></primary>
54334 </indexterm>
54335 <indexterm role="variable">
54336 <primary><varname>$local_part</varname></primary>
54337 </indexterm>
54338 <indexterm role="variable">
54339 <primary><varname>$sender_address</varname></primary>
54340 </indexterm>
54341 <indexterm role="variable">
54342 <primary><varname>$sender_host_address</varname></primary>
54343 </indexterm>
54344 <indexterm role="variable">
54345 <primary><varname>$smtp_command</varname></primary>
54346 </indexterm>
54347 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
54348 that contain information about the host and the message&#x2019;s sender (for example,
54349 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
54350 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
54351 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
54352 is available in <varname>$smtp_command</varname>.
54353 </para>
54354 <para>
54355 When an ACL for the AUTH parameter of MAIL is running, the variables that
54356 contain information about the host are set, but <varname>$sender_address</varname> is not yet
54357 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
54358 how it is used.
54359 </para>
54360 <para>
54361 <indexterm role="variable">
54362 <primary><varname>$message_size</varname></primary>
54363 </indexterm>
54364 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
54365 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
54366 that parameter is not given. The value is updated to the true message size by
54367 the time the final DATA ACL is run (after the message data has been
54368 received).
54369 </para>
54370 <para>
54371 <indexterm role="variable">
54372 <primary><varname>$rcpt_count</varname></primary>
54373 </indexterm>
54374 <indexterm role="variable">
54375 <primary><varname>$recipients_count</varname></primary>
54376 </indexterm>
54377 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
54378 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
54379 accepted, so while an ACL for RCPT is being processed, it contains the number
54380 of previously accepted recipients. At DATA time (for both the DATA ACLs),
54381 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
54382 <varname>$recipients_count</varname> contains the total number of accepted recipients.
54383 </para>
54384 </section>
54385 <section id="SECTdatfornon">
54386 <title>Data for non-message ACLs</title>
54387 <para>
54388 <indexterm role="concept">
54389 <primary>access control lists (ACLs)</primary>
54390 <secondary>data for non-message ACL</secondary>
54391 </indexterm>
54392 <indexterm role="variable">
54393 <primary><varname>$smtp_command_argument</varname></primary>
54394 </indexterm>
54395 <indexterm role="variable">
54396 <primary><varname>$smtp_command</varname></primary>
54397 </indexterm>
54398 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
54399 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
54400 and the entire SMTP command is available in <varname>$smtp_command</varname>.
54401 These variables can be tested using a <option>condition</option> condition. For example,
54402 here is an ACL for use with AUTH, which insists that either the session is
54403 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
54404 does not permit authentication methods that use cleartext passwords on
54405 unencrypted connections.
54406 </para>
54407 <literallayout class="monospaced">
54408 acl_check_auth:
54409   accept encrypted = *
54410   accept condition = ${if eq{${uc:$smtp_command_argument}}\
54411                      {CRAM-MD5}}
54412   deny   message   = TLS encryption or CRAM-MD5 required
54413 </literallayout>
54414 <para>
54415 (Another way of applying this restriction is to arrange for the authenticators
54416 that use cleartext passwords not to be advertised when the connection is not
54417 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
54418 option to do this.)
54419 </para>
54420 </section>
54421 <section id="SECID199">
54422 <title>Format of an ACL</title>
54423 <para>
54424 <indexterm role="concept">
54425 <primary>access control lists (ACLs)</primary>
54426 <secondary>format of</secondary>
54427 </indexterm>
54428 <indexterm role="concept">
54429 <primary>access control lists (ACLs)</primary>
54430 <secondary>verbs, definition of</secondary>
54431 </indexterm>
54432 An individual ACL consists of a number of statements. Each statement starts
54433 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
54434 Modifiers can change the way the verb operates, define error and log messages,
54435 set variables, insert delays, and vary the processing of accepted messages.
54436 </para>
54437 <para>
54438 If all the conditions are met, the verb is obeyed. The same condition may be
54439 used (with different arguments) more than once in the same statement. This
54440 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
54441 example:
54442 </para>
54443 <literallayout class="monospaced">
54444 deny  dnslists = list1.example
54445       dnslists = list2.example
54446 </literallayout>
54447 <para>
54448 If there are no conditions, the verb is always obeyed. Exim stops evaluating
54449 the conditions and modifiers when it reaches a condition that fails. What
54450 happens then depends on the verb (and in one case, on a special modifier). Not
54451 all the conditions make sense at every testing point. For example, you cannot
54452 test a sender address in the ACL that is run for a VRFY command.
54453 </para>
54454 </section>
54455 <section id="SECID200">
54456 <title>ACL verbs</title>
54457 <para>
54458 The ACL verbs are as follows:
54459 </para>
54460 <itemizedlist>
54461 <listitem>
54462 <para>
54463 <indexterm role="concept">
54464 <primary><option>accept</option> ACL verb</primary>
54465 </indexterm>
54466 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
54467 of the conditions are not met, what happens depends on whether <option>endpass</option>
54468 appears among the conditions (for syntax see below). If the failing condition
54469 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
54470 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
54471 check a RCPT command:
54472 </para>
54473 <literallayout class="monospaced">
54474 accept domains = +local_domains
54475        endpass
54476        verify = recipient
54477 </literallayout>
54478 <para>
54479 If the recipient domain does not match the <option>domains</option> condition, control
54480 passes to the next statement. If it does match, the recipient is verified, and
54481 the command is accepted if verification succeeds. However, if verification
54482 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
54483 <option>endpass</option>.
54484 </para>
54485 <para>
54486 The <option>endpass</option> feature has turned out to be confusing to many people, so its
54487 use is not recommended nowadays. It is always possible to rewrite an ACL so
54488 that <option>endpass</option> is not needed, and it is no longer used in the default
54489 configuration.
54490 </para>
54491 <para>
54492 <indexterm role="concept">
54493 <primary><option>message</option> ACL modifier</primary>
54494 <secondary>with <option>accept</option></secondary>
54495 </indexterm>
54496 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
54497 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
54498 (when an <option>accept</option> verb either accepts or passes control to the next
54499 statement), <option>message</option> can be used to vary the message that is sent when an
54500 SMTP command is accepted. For example, in a RCPT ACL you could have:
54501 </para>
54502 <literallayout>
54503 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
54504 <literal>        message = OK, I will allow you through today</literal>
54505 </literallayout>
54506 <para>
54507 You can specify an SMTP response code, optionally followed by an <quote>extended
54508 response code</quote> at the start of the message, but the first digit must be the
54509 same as would be sent by default, which is 2 for an <option>accept</option> verb.
54510 </para>
54511 <para>
54512 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
54513 an error message that is used when access is denied. This behaviour is retained
54514 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
54515 of <option>endpass</option>.
54516 </para>
54517 </listitem>
54518 <listitem>
54519 <para>
54520 <indexterm role="concept">
54521 <primary><option>defer</option> ACL verb</primary>
54522 </indexterm>
54523 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
54524 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
54525 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
54526 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
54527 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
54528 be used in any ACL, and even for a recipient it might be a simpler approach.
54529 </para>
54530 </listitem>
54531 <listitem>
54532 <para>
54533 <indexterm role="concept">
54534 <primary><option>deny</option> ACL verb</primary>
54535 </indexterm>
54536 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
54537 the conditions are not met, control is passed to the next ACL statement. For
54538 example,
54539 </para>
54540 <literallayout class="monospaced">
54541 deny dnslists = blackholes.mail-abuse.org
54542 </literallayout>
54543 <para>
54544 rejects commands from hosts that are on a DNS black list.
54545 </para>
54546 </listitem>
54547 <listitem>
54548 <para>
54549 <indexterm role="concept">
54550 <primary><option>discard</option> ACL verb</primary>
54551 </indexterm>
54552 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
54553 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
54554 that are concerned with receiving messages. When all the conditions are true,
54555 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
54556 recipients to be discarded. If it is used in an ACL for RCPT, just the one
54557 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
54558 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
54559 do not appear in the log line when the <option>received_recipients</option> log selector is set.
54560 </para>
54561 <para>
54562 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
54563 its contents are added to the line that is automatically written to the log.
54564 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
54565 </para>
54566 </listitem>
54567 <listitem>
54568 <para>
54569 <indexterm role="concept">
54570 <primary><option>drop</option> ACL verb</primary>
54571 </indexterm>
54572 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
54573 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
54574 </para>
54575 <literallayout class="monospaced">
54576 drop   message   = I don't take more than 20 RCPTs
54577        condition = ${if &gt; {$rcpt_count}{20}}
54578 </literallayout>
54579 <para>
54580 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
54581 The connection is always dropped after sending a 550 response.
54582 </para>
54583 </listitem>
54584 <listitem>
54585 <para>
54586 <indexterm role="concept">
54587 <primary><option>require</option> ACL verb</primary>
54588 </indexterm>
54589 <option>require</option>: If all the conditions are met, control is passed to the next ACL
54590 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
54591 example, when checking a RCPT command,
54592 </para>
54593 <literallayout class="monospaced">
54594 require message = Sender did not verify
54595         verify  = sender
54596 </literallayout>
54597 <para>
54598 passes control to subsequent statements only if the message&#x2019;s sender can be
54599 verified. Otherwise, it rejects the command. Note the positioning of the
54600 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
54601 discussed in section <xref linkend="SECTcondmodproc"/>.
54602 </para>
54603 </listitem>
54604 <listitem>
54605 <para>
54606 <indexterm role="concept">
54607 <primary><option>warn</option> ACL verb</primary>
54608 </indexterm>
54609 <option>warn</option>: If all the conditions are true, a line specified by the
54610 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
54611 to the next ACL statement. If any condition is false, the log line is not
54612 written. If an identical log line is requested several times in the same
54613 message, only one copy is actually written to the log. If you want to force
54614 duplicates to be written, use the <option>logwrite</option> modifier instead.
54615 </para>
54616 <para>
54617 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
54618 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
54619 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
54620 first failing condition. There is more about adding header lines in section
54621 <xref linkend="SECTaddheadacl"/>.
54622 </para>
54623 <para>
54624 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
54625 some sort of defer), the log line specified by <option>log_message</option> is not written.
54626 This does not include the case of a forced failure from a lookup, which
54627 is considered to be a successful completion. After a defer, no further
54628 conditions or modifiers in the <option>warn</option> statement are processed. The incident
54629 is logged, and the ACL continues to be processed, from the next statement
54630 onwards.
54631 </para>
54632 <para>
54633 <indexterm role="variable">
54634 <primary><varname>$acl_verify_message</varname></primary>
54635 </indexterm>
54636 When one of the <option>warn</option> conditions is an address verification that fails, the
54637 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
54638 want this logged, you must set it up explicitly. For example:
54639 </para>
54640 <literallayout class="monospaced">
54641 warn   !verify = sender
54642        log_message = sender verify failed: $acl_verify_message
54643 </literallayout>
54644 </listitem>
54645 </itemizedlist>
54646 <para>
54647 At the end of each ACL there is an implicit unconditional <option>deny</option>.
54648 </para>
54649 <para>
54650 As you can see from the examples above, the conditions and modifiers are
54651 written one to a line, with the first one on the same line as the verb, and
54652 subsequent ones on following lines. If you have a very long condition, you can
54653 continue it onto several physical lines by the usual backslash continuation
54654 mechanism. It is conventional to align the conditions vertically.
54655 </para>
54656 </section>
54657 <section id="SECTaclvariables">
54658 <title>ACL variables</title>
54659 <para>
54660 <indexterm role="concept">
54661 <primary>access control lists (ACLs)</primary>
54662 <secondary>variables</secondary>
54663 </indexterm>
54664 There are some special variables that can be set during ACL processing. They
54665 can be used to pass information between different ACLs, different invocations
54666 of the same ACL in the same SMTP connection, and between ACLs and the routers,
54667 transports, and filters that are used to deliver a message. The names of these
54668 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
54669 an underscore, but the remainder of the name can be any sequence of
54670 alphanumeric characters and underscores that you choose. There is no limit on
54671 the number of ACL variables. The two sets act as follows:
54672 </para>
54673 <itemizedlist>
54674 <listitem>
54675 <para>
54676 The values of those variables whose names begin with <varname>$acl_c</varname> persist
54677 throughout an SMTP connection. They are never reset. Thus, a value that is set
54678 while receiving one message is still available when receiving the next message
54679 on the same SMTP connection.
54680 </para>
54681 </listitem>
54682 <listitem>
54683 <para>
54684 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
54685 while a message is being received. They are reset afterwards. They are also
54686 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
54687 </para>
54688 </listitem>
54689 </itemizedlist>
54690 <para>
54691 When a message is accepted, the current values of all the ACL variables are
54692 preserved with the message and are subsequently made available at delivery
54693 time. The ACL variables are set by a modifier called <option>set</option>. For example:
54694 </para>
54695 <literallayout class="monospaced">
54696 accept hosts = whatever
54697        set acl_m4 = some value
54698 accept authenticated = *
54699        set acl_c_auth = yes
54700 </literallayout>
54701 <para>
54702 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
54703 be set. If you want to set a variable without taking any action, you can use a
54704 <option>warn</option> verb without any other modifiers or conditions.
54705 </para>
54706 <para>
54707 <indexterm role="option">
54708 <primary><option>strict_acl_vars</option></primary>
54709 </indexterm>
54710 What happens if a syntactically valid but undefined ACL variable is
54711 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
54712 false (the default), an empty string is substituted; if it is true, an
54713 error is generated.
54714 </para>
54715 <para>
54716 Versions of Exim before 4.64 have a limited set of numbered variables, but
54717 their names are compatible, so there is no problem with upgrading.
54718 </para>
54719 </section>
54720 <section id="SECTcondmodproc">
54721 <title>Condition and modifier processing</title>
54722 <para>
54723 <indexterm role="concept">
54724 <primary>access control lists (ACLs)</primary>
54725 <secondary>conditions; processing</secondary>
54726 </indexterm>
54727 <indexterm role="concept">
54728 <primary>access control lists (ACLs)</primary>
54729 <secondary>modifiers; processing</secondary>
54730 </indexterm>
54731 An exclamation mark preceding a condition negates its result. For example:
54732 </para>
54733 <literallayout class="monospaced">
54734 deny   domains = *.dom.example
54735       !verify  = recipient
54736 </literallayout>
54737 <para>
54738 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
54739 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
54740 negation can be used on the right-hand side of a condition. For example, these
54741 two statements are equivalent:
54742 </para>
54743 <literallayout class="monospaced">
54744 deny  hosts = !192.168.3.4
54745 deny !hosts =  192.168.3.4
54746 </literallayout>
54747 <para>
54748 However, for many conditions (<option>verify</option> being a good example), only left-hand
54749 side negation of the whole condition is possible.
54750 </para>
54751 <para>
54752 The arguments of conditions and modifiers are expanded. A forced failure
54753 of an expansion causes a condition to be ignored, that is, it behaves as if the
54754 condition is true. Consider these two statements:
54755 </para>
54756 <literallayout class="monospaced">
54757 accept  senders = ${lookup{$host_name}lsearch\
54758                   {/some/file}{$value}fail}
54759 accept  senders = ${lookup{$host_name}lsearch\
54760                   {/some/file}{$value}{}}
54761 </literallayout>
54762 <para>
54763 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
54764 the returned list is searched, but if the lookup fails the behaviour is
54765 different in the two cases. The <option>fail</option> in the first statement causes the
54766 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
54767 therefore succeeds. The second statement, however, generates an empty list when
54768 the lookup fails. No sender can match an empty list, so the condition fails,
54769 and therefore the <option>accept</option> also fails.
54770 </para>
54771 <para>
54772 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
54773 specify actions that are taken as the conditions for a statement are checked;
54774 others specify text for messages that are used when access is denied or a
54775 warning is generated. The <option>control</option> modifier affects the way an incoming
54776 message is handled.
54777 </para>
54778 <para>
54779 The positioning of the modifiers in an ACL statement is important, because the
54780 processing of a verb ceases as soon as its outcome is known. Only those
54781 modifiers that have already been encountered will take effect. For example,
54782 consider this use of the <option>message</option> modifier:
54783 </para>
54784 <literallayout class="monospaced">
54785 require message = Can't verify sender
54786         verify  = sender
54787         message = Can't verify recipient
54788         verify  = recipient
54789         message = This message cannot be used
54790 </literallayout>
54791 <para>
54792 If sender verification fails, Exim knows that the result of the statement is
54793 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
54794 so its text is used as the error message. If sender verification succeeds, but
54795 recipient verification fails, the second message is used. If recipient
54796 verification succeeds, the third message becomes <quote>current</quote>, but is never used
54797 because there are no more conditions to cause failure.
54798 </para>
54799 <para>
54800 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
54801 modifier that is used, because all the conditions must be true for rejection to
54802 happen. Specifying more than one <option>message</option> modifier does not make sense, and
54803 the message can even be specified after all the conditions. For example:
54804 </para>
54805 <literallayout class="monospaced">
54806 deny   hosts = ...
54807       !senders = *@my.domain.example
54808        message = Invalid sender from client host
54809 </literallayout>
54810 <para>
54811 The <quote>deny</quote> result does not happen until the end of the statement is reached,
54812 by which time Exim has set up the message.
54813 </para>
54814 </section>
54815 <section id="SECTACLmodi">
54816 <title>ACL modifiers</title>
54817 <para>
54818 <indexterm role="concept">
54819 <primary>access control lists (ACLs)</primary>
54820 <secondary>modifiers; list of</secondary>
54821 </indexterm>
54822 The ACL modifiers are as follows:
54823 </para>
54824 <variablelist>
54825 <varlistentry>
54826 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54827 <listitem>
54828 <para>
54829 This modifier specifies one or more header lines that are to be added to an
54830 incoming message, assuming, of course, that the message is ultimately
54831 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
54832 </para>
54833 </listitem></varlistentry>
54834 <varlistentry>
54835 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54836 <listitem>
54837 <para>
54838 <indexterm role="concept">
54839 <primary><option>continue</option> ACL modifier</primary>
54840 </indexterm>
54841 <indexterm role="concept">
54842 <primary>database</primary>
54843 <secondary>updating in ACL</secondary>
54844 </indexterm>
54845 This modifier does nothing of itself, and processing of the ACL always
54846 continues with the next condition or modifier. The value of <option>continue</option> is in
54847 the side effects of expanding its argument. Typically this could be used to
54848 update a database. It is really just a syntactic tidiness, to avoid having to
54849 write rather ugly lines like this:
54850 </para>
54851 <literallayout>
54852 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
54853 </literallayout>
54854 <para>
54855 Instead, all you need is
54856 </para>
54857 <literallayout>
54858 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
54859 </literallayout>
54860 </listitem></varlistentry>
54861 <varlistentry>
54862 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
54863 <listitem>
54864 <para>
54865 <indexterm role="concept">
54866 <primary><option>control</option> ACL modifier</primary>
54867 </indexterm>
54868 This modifier affects the subsequent processing of the SMTP connection or of an
54869 incoming message that is accepted. The effect of the first type of control
54870 lasts for the duration of the connection, whereas the effect of the second type
54871 lasts only until the current message has been received. The message-specific
54872 controls always apply to the whole message, not to individual recipients,
54873 even if the <option>control</option> modifier appears in a RCPT ACL.
54874 </para>
54875 <para>
54876 As there are now quite a few controls that can be applied, they are described
54877 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
54878 in several different ways. For example:
54879 </para>
54880 <itemizedlist>
54881 <listitem>
54882 <para>
54883 It can be at the end of an <option>accept</option> statement:
54884 </para>
54885 <literallayout class="monospaced">
54886     accept  ...some conditions
54887             control = queue_only
54888 </literallayout>
54889 <para>
54890 In this case, the control is applied when this statement yields <quote>accept</quote>, in
54891 other words, when the conditions are all true.
54892 </para>
54893 </listitem>
54894 <listitem>
54895 <para>
54896 It can be in the middle of an <option>accept</option> statement:
54897 </para>
54898 <literallayout class="monospaced">
54899     accept  ...some conditions...
54900             control = queue_only
54901             ...some more conditions...
54902 </literallayout>
54903 <para>
54904 If the first set of conditions are true, the control is applied, even if the
54905 statement does not accept because one of the second set of conditions is false.
54906 In this case, some subsequent statement must yield <quote>accept</quote> for the control
54907 to be relevant.
54908 </para>
54909 </listitem>
54910 <listitem>
54911 <para>
54912 It can be used with <option>warn</option> to apply the control, leaving the
54913 decision about accepting or denying to a subsequent verb. For
54914 example:
54915 </para>
54916 <literallayout class="monospaced">
54917     warn    ...some conditions...
54918             control = freeze
54919     accept  ...
54920 </literallayout>
54921 <para>
54922 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
54923 <option>logwrite</option>, so it does not add anything to the message and does not write a
54924 log entry.
54925 </para>
54926 </listitem>
54927 <listitem>
54928 <para>
54929 If you want to apply a control unconditionally, you can use it with a
54930 <option>require</option> verb. For example:
54931 </para>
54932 <literallayout class="monospaced">
54933     require  control = no_multiline_responses
54934 </literallayout>
54935 </listitem>
54936 </itemizedlist>
54937 </listitem></varlistentry>
54938 <varlistentry>
54939 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
54940 <listitem>
54941 <para>
54942 <indexterm role="concept">
54943 <primary><option>delay</option> ACL modifier</primary>
54944 </indexterm>
54945 <indexterm role="option">
54946 <primary><option>-bh</option></primary>
54947 </indexterm>
54948 This modifier may appear in any ACL except notquit. It causes Exim to wait for
54949 the time interval before proceeding. However, when testing Exim using the
54950 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
54951 output instead). The time is given in the usual Exim notation, and the delay
54952 happens as soon as the modifier is processed. In an SMTP session, pending
54953 output is flushed before the delay is imposed.
54954 </para>
54955 <para>
54956 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
54957 example:
54958 </para>
54959 <literallayout class="monospaced">
54960 deny    ...some conditions...
54961         delay = 30s
54962 </literallayout>
54963 <para>
54964 The delay happens if all the conditions are true, before the statement returns
54965 <quote>deny</quote>. Compare this with:
54966 </para>
54967 <literallayout class="monospaced">
54968 deny    delay = 30s
54969         ...some conditions...
54970 </literallayout>
54971 <para>
54972 which waits for 30s before processing the conditions. The <option>delay</option> modifier
54973 can also be used with <option>warn</option> and together with <option>control</option>:
54974 </para>
54975 <literallayout class="monospaced">
54976 warn    ...some conditions...
54977         delay = 2m
54978         control = freeze
54979 accept  ...
54980 </literallayout>
54981 <para>
54982 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
54983 responses to several commands are no longer buffered and sent in one packet (as
54984 they would normally be) because all output is flushed before imposing the
54985 delay. This optimization is disabled so that a number of small delays do not
54986 appear to the client as one large aggregated delay that might provoke an
54987 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
54988 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
54989 </para>
54990 </listitem></varlistentry>
54991 <varlistentry>
54992 <term><emphasis role="bold">endpass</emphasis></term>
54993 <listitem>
54994 <para>
54995 <indexterm role="concept">
54996 <primary><option>endpass</option> ACL modifier</primary>
54997 </indexterm>
54998 This modifier, which has no argument, is recognized only in <option>accept</option> and
54999 <option>discard</option> statements. It marks the boundary between the conditions whose
55000 failure causes control to pass to the next statement, and the conditions whose
55001 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
55002 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
55003 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
55004 </para>
55005 </listitem></varlistentry>
55006 <varlistentry>
55007 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55008 <listitem>
55009 <para>
55010 <indexterm role="concept">
55011 <primary><option>log_message</option> ACL modifier</primary>
55012 </indexterm>
55013 This modifier sets up a message that is used as part of the log message if the
55014 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
55015 </para>
55016 <literallayout class="monospaced">
55017 require log_message = wrong cipher suite $tls_in_cipher
55018         encrypted   = DES-CBC3-SHA
55019 </literallayout>
55020 <para>
55021 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
55022 example:
55023 </para>
55024 <literallayout>
55025 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
55026 <literal>        log_message = Discarded $local_part@$domain because...</literal>
55027 </literallayout>
55028 <para>
55029 When access is denied, <option>log_message</option> adds to any underlying error message
55030 that may exist because of a condition failure. For example, while verifying a
55031 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
55032 message.
55033 </para>
55034 <para>
55035 The message may be defined before the conditions to which it applies, because
55036 the string expansion does not happen until Exim decides that access is to be
55037 denied. This means that any variables that are set by the condition are
55038 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
55039 variables are set after a DNS black list lookup succeeds. If the expansion of
55040 <option>log_message</option> fails, or if the result is an empty string, the modifier is
55041 ignored.
55042 </para>
55043 <para>
55044 <indexterm role="variable">
55045 <primary><varname>$acl_verify_message</varname></primary>
55046 </indexterm>
55047 If you want to use a <option>warn</option> statement to log the result of an address
55048 verification, you can use <varname>$acl_verify_message</varname> to include the verification
55049 error message.
55050 </para>
55051 <para>
55052 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
55053 the start of the logged message. If the same warning log message is requested
55054 more than once while receiving  a single email message, only one copy is
55055 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
55056 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
55057 is logged for a successful <option>warn</option> statement.
55058 </para>
55059 <para>
55060 If <option>log_message</option> is not present and there is no underlying error message (for
55061 example, from the failure of address verification), but <option>message</option> is present,
55062 the <option>message</option> text is used for logging rejections. However, if any text for
55063 logging contains newlines, only the first line is logged. In the absence of
55064 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
55065 logging rejections.
55066 </para>
55067 </listitem></varlistentry>
55068 <varlistentry>
55069 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
55070 <listitem>
55071 <para>
55072 <indexterm role="concept">
55073 <primary><option>log_reject_target</option> ACL modifier</primary>
55074 </indexterm>
55075 <indexterm role="concept">
55076 <primary>logging in ACL</primary>
55077 <secondary>specifying which log</secondary>
55078 </indexterm>
55079 This modifier makes it possible to specify which logs are used for messages
55080 about ACL rejections. Its argument is a colon-separated list of words that can
55081 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
55082 may be empty, in which case a rejection is not logged at all. For example, this
55083 ACL fragment writes no logging information when access is denied:
55084 </para>
55085 <literallayout>
55086 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
55087 <literal>     log_reject_target =</literal>
55088 </literallayout>
55089 <para>
55090 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
55091 permanent and temporary rejections. Its effect lasts for the rest of the
55092 current ACL.
55093 </para>
55094 </listitem></varlistentry>
55095 <varlistentry>
55096 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55097 <listitem>
55098 <para>
55099 <indexterm role="concept">
55100 <primary><option>logwrite</option> ACL modifier</primary>
55101 </indexterm>
55102 <indexterm role="concept">
55103 <primary>logging in ACL</primary>
55104 <secondary>immediate</secondary>
55105 </indexterm>
55106 This modifier writes a message to a log file as soon as it is encountered when
55107 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
55108 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
55109 access.) The <option>logwrite</option> modifier can be used to log special incidents in
55110 ACLs. For example:
55111 </para>
55112 <literallayout>
55113 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
55114 <literal>       control  = freeze</literal>
55115 <literal>       logwrite = froze message because ...</literal>
55116 </literallayout>
55117 <para>
55118 By default, the message is written to the main log. However, it may begin
55119 with a colon, followed by a comma-separated list of log names, and then
55120 another colon, to specify exactly which logs are to be written. For
55121 example:
55122 </para>
55123 <literallayout class="monospaced">
55124 logwrite = :main,reject: text for main and reject logs
55125 logwrite = :panic: text for panic log only
55126 </literallayout>
55127 </listitem></varlistentry>
55128 <varlistentry>
55129 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55130 <listitem>
55131 <para>
55132 <indexterm role="concept">
55133 <primary><option>message</option> ACL modifier</primary>
55134 </indexterm>
55135 This modifier sets up a text string that is expanded and used as a response
55136 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
55137 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
55138 there is some complication if <option>endpass</option> is involved; see the description of
55139 <option>accept</option> for details.)
55140 </para>
55141 <para>
55142 The expansion of the message happens at the time Exim decides that the ACL is
55143 to end, not at the time it processes <option>message</option>. If the expansion fails, or
55144 generates an empty string, the modifier is ignored. Here is an example where
55145 <option>message</option> must be specified first, because the ACL ends with a rejection if
55146 the <option>hosts</option> condition fails:
55147 </para>
55148 <literallayout class="monospaced">
55149 require  message = Host not recognized
55150          hosts = 10.0.0.0/8
55151 </literallayout>
55152 <para>
55153 (Once a condition has failed, no further conditions or modifiers are
55154 processed.)
55155 </para>
55156 <para>
55157 <indexterm role="concept">
55158 <primary>SMTP</primary>
55159 <secondary>error codes</secondary>
55160 </indexterm>
55161 <indexterm role="option">
55162 <primary><option>smtp_banner</option></primary>
55163 </indexterm>
55164 For ACLs that are triggered by SMTP commands, the message is returned as part
55165 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
55166 is meaningful only for SMTP, as no message is returned when a non-SMTP message
55167 is accepted. In the case of the connect ACL, accepting with a message modifier
55168 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
55169 accept message may not contain more than one line (otherwise it will be
55170 truncated at the first newline and a panic logged), and it cannot affect the
55171 EHLO options.
55172 </para>
55173 <para>
55174 When SMTP is involved, the message may begin with an overriding response code,
55175 consisting of three digits optionally followed by an <quote>extended response code</quote>
55176 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
55177 </para>
55178 <literallayout class="monospaced">
55179 deny  message = 599 1.2.3 Host not welcome
55180       hosts = 192.168.34.0/24
55181 </literallayout>
55182 <para>
55183 The first digit of the supplied response code must be the same as would be sent
55184 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
55185 access, but for the predata ACL, note that the default success code is 354, not
55186 2<emphasis>xx</emphasis>.
55187 </para>
55188 <para>
55189 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
55190 the message modifier cannot override the 221 response code.
55191 </para>
55192 <para>
55193 The text in a <option>message</option> modifier is literal; any quotes are taken as
55194 literals, but because the string is expanded, backslash escapes are processed
55195 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
55196 response.
55197 </para>
55198 <para>
55199 <indexterm role="variable">
55200 <primary><varname>$acl_verify_message</varname></primary>
55201 </indexterm>
55202 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
55203 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
55204 </para>
55205 <para>
55206 If <option>message</option> is used on a statement that verifies an address, the message
55207 specified overrides any message that is generated by the verification process.
55208 However, the original message is available in the variable
55209 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
55210 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
55211 routers to be passed back as part of the SMTP response, you should either not
55212 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
55213 </para>
55214 <para>
55215 For compatibility with previous releases of Exim, a <option>message</option> modifier that
55216 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
55217 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
55218 all the conditions are true, wherever it appears in an ACL command, whereas
55219 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
55220 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
55221 effect.
55222 </para>
55223 </listitem></varlistentry>
55224 <varlistentry>
55225 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55226 <listitem>
55227 <para>
55228 This modifier specifies the use of a named queue for spool files
55229 for the message.
55230 It can only be used before the message is received (i.e. not in
55231 the DATA ACL).
55232 This could be used, for example, for known high-volume burst sources
55233 of traffic, or for quarantine of messages.
55234 Separate queue-runner processes will be needed for named queues.
55235 If the text after expansion is empty, the default queue is used.
55236 </para>
55237 </listitem></varlistentry>
55238 <varlistentry>
55239 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
55240 <listitem>
55241 <para>
55242 This modifier specifies one or more header names in a colon-separated list
55243  that are to be removed from an incoming message, assuming, of course, that
55244 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
55245 </para>
55246 </listitem></varlistentry>
55247 <varlistentry>
55248 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
55249 <listitem>
55250 <para>
55251 <indexterm role="concept">
55252 <primary><option>set</option> ACL modifier</primary>
55253 </indexterm>
55254 This modifier puts a value into one of the ACL variables (see section
55255 <xref linkend="SECTaclvariables"/>).
55256 </para>
55257 </listitem></varlistentry>
55258 <varlistentry>
55259 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
55260 <listitem>
55261 <para>
55262 This modifier sends a UDP packet, for purposes such as statistics
55263 collection or behaviour monitoring. The parameters are expanded, and
55264 the result of the expansion must be a colon-separated list consisting
55265 of a destination server, port number, and the packet contents. The
55266 server can be specified as a host name or IPv4 or IPv6 address. The
55267 separator can be changed with the usual angle bracket syntax. For
55268 example, you might want to collect information on which hosts connect
55269 when:
55270 </para>
55271 <literallayout class="monospaced">
55272 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
55273              $tod_zulu $sender_host_address
55274 </literallayout>
55275 </listitem></varlistentry>
55276 </variablelist>
55277 </section>
55278 <section id="SECTcontrols">
55279 <title>Use of the control modifier</title>
55280 <para>
55281 <indexterm role="concept">
55282 <primary><option>control</option> ACL modifier</primary>
55283 </indexterm>
55284 The <option>control</option> modifier supports the following settings:
55285 </para>
55286 <variablelist>
55287 <varlistentry>
55288 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
55289 <listitem>
55290 <para>
55291 This modifier allows a client host to use the SMTP AUTH command even when it
55292 has not been advertised in response to EHLO. Furthermore, because there are
55293 apparently some really broken clients that do this, Exim will accept AUTH after
55294 HELO (rather than EHLO) when this control is set. It should be used only if you
55295 really need it, and you should limit its use to those broken clients that do
55296 not work without it. For example:
55297 </para>
55298 <literallayout class="monospaced">
55299 warn hosts   = 192.168.34.25
55300      control = allow_auth_unadvertised
55301 </literallayout>
55302 <para>
55303 Normally, when an Exim server receives an AUTH command, it checks the name of
55304 the authentication mechanism that is given in the command to ensure that it
55305 matches an advertised mechanism. When this control is set, the check that a
55306 mechanism has been advertised is bypassed. Any configured mechanism can be used
55307 by the client. This control is permitted only in the connection and HELO ACLs.
55308 </para>
55309 </listitem></varlistentry>
55310 <varlistentry>
55311 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
55312 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
55313 <listitem>
55314 <para>
55315 <indexterm role="concept">
55316 <primary>access control lists (ACLs)</primary>
55317 <secondary>case of local part in</secondary>
55318 </indexterm>
55319 <indexterm role="concept">
55320 <primary>case of local parts</primary>
55321 </indexterm>
55322 <indexterm role="variable">
55323 <primary><varname>$local_part</varname></primary>
55324 </indexterm>
55325 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
55326 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
55327 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
55328 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
55329 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
55330 is encountered.
55331 </para>
55332 <para>
55333 These controls affect only the current recipient. Moreover, they apply only to
55334 local part handling that takes place directly in the ACL (for example, as a key
55335 in lookups). If a test to verify the recipient is obeyed, the case-related
55336 handling of the local part during the verification is controlled by the router
55337 configuration (see the <option>caseful_local_part</option> generic router option).
55338 </para>
55339 <para>
55340 This facility could be used, for example, to add a spam score to local parts
55341 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
55342 spam score:
55343 </para>
55344 <literallayout class="monospaced">
55345 warn  control = caseful_local_part
55346       set acl_m4 = ${eval:\
55347                      $acl_m4 + \
55348                      ${if match{$local_part}{[A-Z]}{1}{0}}\
55349                     }
55350       control = caselower_local_part
55351 </literallayout>
55352 <para>
55353 Notice that we put back the lower cased version afterwards, assuming that
55354 is what is wanted for subsequent tests.
55355 </para>
55356 </listitem></varlistentry>
55357 <varlistentry>
55358 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55359 <listitem>
55360 <para>
55361 <indexterm role="concept">
55362 <primary>access control lists (ACLs)</primary>
55363 <secondary>cutthrough routing</secondary>
55364 </indexterm>
55365 <indexterm role="concept">
55366 <primary>cutthrough</primary>
55367 <secondary>requesting</secondary>
55368 </indexterm>
55369 This option requests delivery be attempted while the item is being received.
55370 </para>
55371 <para>
55372 The option is usable in the RCPT ACL.
55373 If enabled for a message received via smtp and routed to an smtp transport,
55374 and only one transport, interface, destination host and port combination
55375 is used for all recipients of the message,
55376 then the delivery connection is made while the receiving connection is open
55377 and data is copied from one to the other.
55378 </para>
55379 <para>
55380 An attempt to set this option for any recipient but the first
55381 for a mail will be quietly ignored.
55382 If a recipient-verify callout
55383 (with use_sender)
55384 connection is subsequently
55385 requested in the same ACL it is held open and used for
55386 any subsequent recipients and the data,
55387 otherwise one is made after the initial RCPT ACL completes.
55388 </para>
55389 <para>
55390 Note that routers are used in verify mode,
55391 and cannot depend on content of received headers.
55392 Note also that headers cannot be
55393 modified by any of the post-data ACLs (DATA, MIME and DKIM).
55394 Headers may be modified by routers (subject to the above) and transports.
55395 </para>
55396 <para>
55397 All the usual ACLs are called; if one results in the message being
55398 rejected, all effort spent in delivery (including the costs on
55399 the ultimate destination) will be wasted.
55400 Note that in the case of data-time ACLs this includes the entire
55401 message body.
55402 </para>
55403 <para>
55404 Cutthrough delivery is not supported via transport-filters or when DKIM signing
55405 of outgoing messages is done, because it sends data to the ultimate destination
55406 before the entire message has been received from the source.
55407 It is not supported for messages received with the SMTP PRDR
55408 </para>
55409 <para revisionflag="changed">
55410 or CHUNKING
55411 </para>
55412 <para>
55413 options in use.
55414 </para>
55415 <para>
55416 Should the ultimate destination system positively accept or reject the mail,
55417 a corresponding indication is given to the source system and nothing is queued.
55418 If the item is successfully delivered in cutthrough mode
55419 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
55420 before the acceptance "&lt;=" line.
55421 </para>
55422 <para>
55423 If there is a temporary error the item is queued for later delivery in the
55424 usual fashion.
55425 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
55426 to the control; the default value is <quote>spool</quote> and the alternate value
55427 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
55428 and does not queue the message.
55429 Note that this is independent of any recipient verify conditions in the ACL.
55430 </para>
55431 <para>
55432 Delivery in this mode avoids the generation of a bounce mail to a
55433 (possibly faked)
55434 sender when the destination system is doing content-scan based rejection.
55435 </para>
55436 </listitem></varlistentry>
55437 <varlistentry>
55438 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55439 <listitem>
55440 <para>
55441 <indexterm role="concept">
55442 <primary>access control lists (ACLs)</primary>
55443 <secondary>enabling debug logging</secondary>
55444 </indexterm>
55445 <indexterm role="concept">
55446 <primary>debugging</primary>
55447 <secondary>enabling from an ACL</secondary>
55448 </indexterm>
55449 This control turns on debug logging, almost as though Exim had been invoked
55450 with <literal>-d</literal>, with the output going to a new logfile, by default called
55451 <emphasis>debuglog</emphasis>.  The filename can be adjusted with the <emphasis>tag</emphasis> option, which
55452 may access any variables already defined.  The logging may be adjusted with
55453 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
55454 option.
55455 Logging may be stopped, and the file removed, with the <emphasis>kill</emphasis> option.
55456 Some examples (which depend on variables that don&#x2019;t exist in all
55457 contexts):
55458 </para>
55459 <literallayout class="monospaced">
55460       control = debug
55461       control = debug/tag=.$sender_host_address
55462       control = debug/opts=+expand+acl
55463       control = debug/tag=.$message_exim_id/opts=+expand
55464       control = debug/kill
55465 </literallayout>
55466 </listitem></varlistentry>
55467 <varlistentry>
55468 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
55469 <listitem>
55470 <para>
55471 <indexterm role="concept">
55472 <primary>disable DKIM verify</primary>
55473 </indexterm>
55474 <indexterm role="concept">
55475 <primary>DKIM</primary>
55476 <secondary>disable verify</secondary>
55477 </indexterm>
55478 This control turns off DKIM verification processing entirely.  For details on
55479 the operation and configuration of DKIM, see chapter <xref linkend="CHAPdkim"/>.
55480 </para>
55481 </listitem></varlistentry>
55482 <varlistentry>
55483 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
55484 <listitem>
55485 <para>
55486 <indexterm role="concept">
55487 <primary>access control lists (ACLs)</primary>
55488 <secondary>setting DSCP value</secondary>
55489 </indexterm>
55490 <indexterm role="concept">
55491 <primary>DSCP</primary>
55492 <secondary>inbound</secondary>
55493 </indexterm>
55494 This option causes the DSCP value associated with the socket for the inbound
55495 connection to be adjusted to a given value, given as one of a number of fixed
55496 strings or to numeric value.
55497 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
55498 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
55499 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
55500 </para>
55501 <para>
55502 The outbound packets from Exim will be marked with this value in the header
55503 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
55504 that these values will have any effect, not be stripped by networking
55505 equipment, or do much of anything without cooperation with your Network
55506 Engineer and those of all network operators between the source and destination.
55507 </para>
55508 </listitem></varlistentry>
55509 <varlistentry>
55510 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
55511 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
55512 <listitem>
55513 <para>
55514 <indexterm role="concept">
55515 <primary>SMTP</primary>
55516 <secondary>synchronization checking</secondary>
55517 </indexterm>
55518 <indexterm role="concept">
55519 <primary>synchronization checking in SMTP</primary>
55520 </indexterm>
55521 These controls make it possible to be selective about when SMTP synchronization
55522 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
55523 state of the switch (it is true by default). See the description of this option
55524 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
55525 </para>
55526 <para>
55527 The effect of these two controls lasts for the remainder of the SMTP
55528 connection. They can appear in any ACL except the one for the non-SMTP
55529 messages. The most straightforward place to put them is in the ACL defined by
55530 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
55531 before the first synchronization check. The expected use is to turn off the
55532 synchronization checks for badly-behaved hosts that you nevertheless need to
55533 work with.
55534 </para>
55535 </listitem></varlistentry>
55536 <varlistentry>
55537 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
55538 <listitem>
55539 <para>
55540 <indexterm role="concept">
55541 <primary>fake defer</primary>
55542 </indexterm>
55543 <indexterm role="concept">
55544 <primary>defer, fake</primary>
55545 </indexterm>
55546 This control works in exactly the same way as <option>fakereject</option> (described below)
55547 except that it causes an SMTP 450 response after the message data instead of a
55548 550 response. You must take care when using <option>fakedefer</option> because it causes the
55549 messages to be duplicated when the sender retries. Therefore, you should not
55550 use <option>fakedefer</option> if the message is to be delivered normally.
55551 </para>
55552 </listitem></varlistentry>
55553 <varlistentry>
55554 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
55555 <listitem>
55556 <para>
55557 <indexterm role="concept">
55558 <primary>fake rejection</primary>
55559 </indexterm>
55560 <indexterm role="concept">
55561 <primary>rejection, fake</primary>
55562 </indexterm>
55563 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
55564 words, only when an SMTP message is being received. If Exim accepts the
55565 message, instead the final 250 response, a 550 rejection message is sent.
55566 However, Exim proceeds to deliver the message as normal. The control applies
55567 only to the current message, not to any subsequent ones that may be received in
55568 the same SMTP connection.
55569 </para>
55570 <para>
55571 The text for the 550 response is taken from the <option>control</option> modifier. If no
55572 message is supplied, the following is used:
55573 </para>
55574 <literallayout class="monospaced">
55575 550-Your message has been rejected but is being
55576 550-kept for evaluation.
55577 550-If it was a legitimate message, it may still be
55578 550 delivered to the target recipient(s).
55579 </literallayout>
55580 <para>
55581 This facility should be used with extreme caution.
55582 </para>
55583 </listitem></varlistentry>
55584 <varlistentry>
55585 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
55586 <listitem>
55587 <para>
55588 <indexterm role="concept">
55589 <primary>frozen messages</primary>
55590 <secondary>forcing in ACL</secondary>
55591 </indexterm>
55592 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
55593 other words, only when a message is being received. If the message is accepted,
55594 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
55595 current message, not to any subsequent ones that may be received in the same
55596 SMTP connection.
55597 </para>
55598 <para>
55599 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
55600 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
55601 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
55602 are obeyed for the current message have the <literal>/no_tell</literal> option.
55603 </para>
55604 </listitem></varlistentry>
55605 <varlistentry>
55606 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
55607 <listitem>
55608 <para>
55609 <indexterm role="concept">
55610 <primary>SMTP</primary>
55611 <secondary>output flushing, disabling for delay</secondary>
55612 </indexterm>
55613 Exim normally flushes SMTP output before implementing a delay in an ACL, to
55614 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
55615 use. This control, as long as it is encountered before the <option>delay</option> modifier,
55616 disables such output flushing.
55617 </para>
55618 </listitem></varlistentry>
55619 <varlistentry>
55620 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
55621 <listitem>
55622 <para>
55623 <indexterm role="concept">
55624 <primary>SMTP</primary>
55625 <secondary>output flushing, disabling for callout</secondary>
55626 </indexterm>
55627 Exim normally flushes SMTP output before performing a callout in an ACL, to
55628 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
55629 use. This control, as long as it is encountered before the <option>verify</option> condition
55630 that causes the callout, disables such output flushing.
55631 </para>
55632 </listitem></varlistentry>
55633 <varlistentry>
55634 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
55635 <listitem>
55636 <para>
55637 This control is available when Exim is compiled with the content scanning
55638 extension. Content scanning may require a copy of the current message, or parts
55639 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
55640 or spam scanner. Normally, such copies are deleted when they are no longer
55641 needed. If this control is set, the copies are not deleted. The control applies
55642 only to the current message, not to any subsequent ones that may be received in
55643 the same SMTP connection. It is provided for debugging purposes and is unlikely
55644 to be useful in production.
55645 </para>
55646 </listitem></varlistentry>
55647 <varlistentry>
55648 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
55649 <listitem>
55650 <para>
55651 <indexterm role="concept">
55652 <primary>multiline responses, suppressing</primary>
55653 </indexterm>
55654 This control is permitted for any ACL except the one for non-SMTP messages.
55655 It seems that there are broken clients in use that cannot handle multiline
55656 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
55657 </para>
55658 <para>
55659 If this control is set, multiline SMTP responses from ACL rejections are
55660 suppressed. One way of doing this would have been to put out these responses as
55661 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
55662 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
55663 responses might get close to that. So this facility, which is after all only a
55664 sop to broken clients, is implemented by doing two very easy things:
55665 </para>
55666 <itemizedlist>
55667 <listitem>
55668 <para>
55669 Extra information that is normally output as part of a rejection caused by
55670 sender verification failure is omitted. Only the final line (typically <quote>sender
55671 verification failed</quote>) is sent.
55672 </para>
55673 </listitem>
55674 <listitem>
55675 <para>
55676 If a <option>message</option> modifier supplies a multiline response, only the first
55677 line is output.
55678 </para>
55679 </listitem>
55680 </itemizedlist>
55681 <para>
55682 The setting of the switch can, of course, be made conditional on the
55683 calling host. Its effect lasts until the end of the SMTP connection.
55684 </para>
55685 </listitem></varlistentry>
55686 <varlistentry>
55687 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
55688 <listitem>
55689 <para>
55690 <indexterm role="concept">
55691 <primary>PIPELINING</primary>
55692 <secondary>suppressing advertising</secondary>
55693 </indexterm>
55694 This control turns off the advertising of the PIPELINING extension to SMTP in
55695 the current session. To be useful, it must be obeyed before Exim sends its
55696 response to an EHLO command. Therefore, it should normally appear in an ACL
55697 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
55698 <option>pipelining_advertise_hosts</option>.
55699 </para>
55700 </listitem></varlistentry>
55701 <varlistentry>
55702 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
55703 <listitem>
55704 <para>
55705 <indexterm role="option">
55706 <primary><option>queue_only</option></primary>
55707 </indexterm>
55708 <indexterm role="concept">
55709 <primary>queueing incoming messages</primary>
55710 </indexterm>
55711 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
55712 other words, only when a message is being received. If the message is accepted,
55713 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
55714 runner. No immediate delivery process is started. In other words, it has the
55715 effect as the <option>queue_only</option> global option. However, the control applies only
55716 to the current message, not to any subsequent ones that may be received in the
55717 same SMTP connection.
55718 </para>
55719 </listitem></varlistentry>
55720 <varlistentry>
55721 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
55722 <listitem>
55723 <para>
55724 <indexterm role="concept">
55725 <primary>message</primary>
55726 <secondary>submission</secondary>
55727 </indexterm>
55728 <indexterm role="concept">
55729 <primary>submission mode</primary>
55730 </indexterm>
55731 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
55732 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
55733 the current message is a submission from a local MUA. In this case, Exim
55734 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
55735 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
55736 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
55737 late (the message has already been created).
55738 </para>
55739 <para>
55740 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
55741 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
55742 submission mode; the available options for this control are described there.
55743 The control applies only to the current message, not to any subsequent ones
55744 that may be received in the same SMTP connection.
55745 </para>
55746 </listitem></varlistentry>
55747 <varlistentry>
55748 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
55749 <listitem>
55750 <para>
55751 <indexterm role="concept">
55752 <primary>submission fixups, suppressing</primary>
55753 </indexterm>
55754 This control applies to locally submitted (non TCP/IP) messages, and is the
55755 complement of <literal>control = submission</literal>. It disables the fixups that are
55756 normally applied to locally-submitted messages. Specifically:
55757 </para>
55758 <itemizedlist>
55759 <listitem>
55760 <para>
55761 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
55762 dynamic version of <option>local_sender_retain</option>).
55763 </para>
55764 </listitem>
55765 <listitem>
55766 <para>
55767 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
55768 </para>
55769 </listitem>
55770 <listitem>
55771 <para>
55772 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
55773 </para>
55774 </listitem>
55775 </itemizedlist>
55776 <para>
55777 This control may be useful when a remotely-originated message is accepted,
55778 passed to some scanning program, and then re-submitted for delivery. It can be
55779 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
55780 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
55781 data is read.
55782 </para>
55783 <para>
55784 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
55785 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
55786 </para>
55787 </listitem></varlistentry>
55788 <varlistentry>
55789 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
55790 <listitem>
55791 <para>
55792 This control enables conversion of UTF-8 in message addresses
55793 to a-label form.
55794 For details see section <xref linkend="SECTi18nMTA"/>.
55795 </para>
55796 </listitem></varlistentry>
55797 </variablelist>
55798 </section>
55799 <section id="SECTsummesfix">
55800 <title>Summary of message fixup control</title>
55801 <para>
55802 All four possibilities for message fixups can be specified:
55803 </para>
55804 <itemizedlist>
55805 <listitem>
55806 <para>
55807 Locally submitted, fixups applied: the default.
55808 </para>
55809 </listitem>
55810 <listitem>
55811 <para>
55812 Locally submitted, no fixups applied: use
55813 <literal>control = suppress_local_fixups</literal>.
55814 </para>
55815 </listitem>
55816 <listitem>
55817 <para>
55818 Remotely submitted, no fixups applied: the default.
55819 </para>
55820 </listitem>
55821 <listitem>
55822 <para>
55823 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
55824 </para>
55825 </listitem>
55826 </itemizedlist>
55827 </section>
55828 <section id="SECTaddheadacl">
55829 <title>Adding header lines in ACLs</title>
55830 <para>
55831 <indexterm role="concept">
55832 <primary>header lines</primary>
55833 <secondary>adding in an ACL</secondary>
55834 </indexterm>
55835 <indexterm role="concept">
55836 <primary>header lines</primary>
55837 <secondary>position of added lines</secondary>
55838 </indexterm>
55839 <indexterm role="concept">
55840 <primary><option>add_header</option> ACL modifier</primary>
55841 </indexterm>
55842 The <option>add_header</option> modifier can be used to add one or more extra header lines
55843 to an incoming message, as in this example:
55844 </para>
55845 <literallayout class="monospaced">
55846 warn dnslists = sbl.spamhaus.org : \
55847                 dialup.mail-abuse.org
55848      add_header = X-blacklisted-at: $dnslist_domain
55849 </literallayout>
55850 <para>
55851 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
55852 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
55853 receiving a message). The message must ultimately be accepted for
55854 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
55855 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
55856 RCPT ACL).
55857 </para>
55858 <para>
55859 Headers will not be added to the message if the modifier is used in
55860 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
55861 </para>
55862 <para>
55863 Leading and trailing newlines are removed from
55864 the data for the <option>add_header</option> modifier; if it then
55865 contains one or more newlines that
55866 are not followed by a space or a tab, it is assumed to contain multiple header
55867 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
55868 front of any line that is not a valid header line.
55869 </para>
55870 <para>
55871 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
55872 They are added to the message before processing the DATA and MIME ACLs.
55873 However, if an identical header line is requested more than once, only one copy
55874 is actually added to the message. Further header lines may be accumulated
55875 during the DATA and MIME ACLs, after which they are added to the message, again
55876 with duplicates suppressed. Thus, it is possible to add two identical header
55877 lines to an SMTP message, but only if one is added before DATA and one after.
55878 In the case of non-SMTP messages, new headers are accumulated during the
55879 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
55880 message is rejected after DATA or by the non-SMTP ACL, all added header lines
55881 are included in the entry that is written to the reject log.
55882 </para>
55883 <para>
55884 <indexterm role="concept">
55885 <primary>header lines</primary>
55886 <secondary>added; visibility of</secondary>
55887 </indexterm>
55888 Header lines are not visible in string expansions
55889 of message headers
55890 until they are added to the
55891 message. It follows that header lines defined in the MAIL, RCPT, and predata
55892 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
55893 header lines that are added by the DATA or MIME ACLs are not visible in those
55894 ACLs. Because of this restriction, you cannot use header lines as a way of
55895 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
55896 this, you can use ACL variables, as described in section
55897 <xref linkend="SECTaclvariables"/>.
55898 </para>
55899 <para>
55900 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
55901 </para>
55902 <para>
55903 The <option>add_header</option> modifier acts immediately as it is encountered during the
55904 processing of an ACL. Notice the difference between these two cases:
55905 </para>
55906 <literallayout>
55907 <literal>accept add_header = ADDED: some text</literal>
55908 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
55909
55910 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
55911 <literal>       add_header = ADDED: some text</literal>
55912 </literallayout>
55913 <para>
55914 In the first case, the header line is always added, whether or not the
55915 condition is true. In the second case, the header line is added only if the
55916 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
55917 ACL statement. All those that are encountered before a condition fails are
55918 honoured.
55919 </para>
55920 <para>
55921 <indexterm role="concept">
55922 <primary><option>warn</option> ACL verb</primary>
55923 </indexterm>
55924 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
55925 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
55926 effect only if all the conditions are true, even if it appears before some of
55927 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
55928 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
55929 are present on a <option>warn</option> verb, both are processed according to their
55930 specifications.
55931 </para>
55932 <para>
55933 By default, new header lines are added to a message at the end of the existing
55934 header lines. However, you can specify that any particular header line should
55935 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
55936 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
55937 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
55938 </para>
55939 <para>
55940 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
55941 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
55942 header line, respectively. (Header text cannot start with a colon, as there has
55943 to be a header name first.) For example:
55944 </para>
55945 <literallayout class="monospaced">
55946 warn add_header = \
55947        :after_received:X-My-Header: something or other...
55948 </literallayout>
55949 <para>
55950 If more than one header line is supplied in a single <option>add_header</option> modifier,
55951 each one is treated independently and can therefore be placed differently. If
55952 you add more than one line at the start, or after the Received: block, they end
55953 up in reverse order.
55954 </para>
55955 <para>
55956 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
55957 added in an ACL. It does NOT work for header lines that are added in a
55958 system filter or in a router or transport.
55959 </para>
55960 </section>
55961 <section id="SECTremoveheadacl">
55962 <title>Removing header lines in ACLs</title>
55963 <para>
55964 <indexterm role="concept">
55965 <primary>header lines</primary>
55966 <secondary>removing in an ACL</secondary>
55967 </indexterm>
55968 <indexterm role="concept">
55969 <primary>header lines</primary>
55970 <secondary>position of removed lines</secondary>
55971 </indexterm>
55972 <indexterm role="concept">
55973 <primary><option>remove_header</option> ACL modifier</primary>
55974 </indexterm>
55975 The <option>remove_header</option> modifier can be used to remove one or more header lines
55976 from an incoming message, as in this example:
55977 </para>
55978 <literallayout class="monospaced">
55979 warn   message        = Remove internal headers
55980        remove_header  = x-route-mail1 : x-route-mail2
55981 </literallayout>
55982 <para>
55983 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
55984 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
55985 receiving a message). The message must ultimately be accepted for
55986 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
55987 with any ACL verb, including <option>deny</option>, though this is really not useful for
55988 any verb that doesn&#x2019;t result in a delivered message.
55989 </para>
55990 <para>
55991 Headers will not be removed from the message if the modifier is used in
55992 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
55993 </para>
55994 <para>
55995 More than one header can be removed at the same time by using a colon separated
55996 list of header names. The header matching is case insensitive. Wildcards are
55997 not permitted, nor is list expansion performed, so you cannot use hostlists to
55998 create a list of headers, however both connection and message variable expansion
55999 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
56000 </para>
56001 <literallayout class="monospaced">
56002 warn   hosts           = +internal_hosts
56003        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
56004 warn   message         = Remove internal headers
56005        remove_header   = $acl_c_ihdrs
56006 </literallayout>
56007 <para>
56008 Removed header lines are accumulated during the MAIL, RCPT, and predata ACLs.
56009 They are removed from the message before processing the DATA and MIME ACLs.
56010 There is no harm in attempting to remove the same header twice nor is removing
56011 a non-existent header. Further header lines to be removed may be accumulated
56012 during the DATA and MIME ACLs, after which they are removed from the message,
56013 if present. In the case of non-SMTP messages, headers to be removed are
56014 accumulated during the non-SMTP ACLs, and are removed from the message after
56015 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
56016 ACL, there really is no effect because there is no logging of what headers
56017 would have been removed.
56018 </para>
56019 <para>
56020 <indexterm role="concept">
56021 <primary>header lines</primary>
56022 <secondary>removed; visibility of</secondary>
56023 </indexterm>
56024 Header lines are not visible in string expansions until the DATA phase when it
56025 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
56026 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
56027 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
56028 this restriction, you cannot use header lines as a way of controlling data
56029 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
56030 you should instead use ACL variables, as described in section
56031 <xref linkend="SECTaclvariables"/>.
56032 </para>
56033 <para>
56034 The <option>remove_header</option> modifier acts immediately as it is encountered during the
56035 processing of an ACL. Notice the difference between these two cases:
56036 </para>
56037 <literallayout>
56038 <literal>accept remove_header = X-Internal</literal>
56039 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
56040
56041 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
56042 <literal>       remove_header = X-Internal</literal>
56043 </literallayout>
56044 <para>
56045 In the first case, the header line is always removed, whether or not the
56046 condition is true. In the second case, the header line is removed only if the
56047 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
56048 same ACL statement. All those that are encountered before a condition fails
56049 are honoured.
56050 </para>
56051 <para>
56052 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
56053 present during ACL processing. It does NOT remove header lines that are added
56054 in a system filter or in a router or transport.
56055 </para>
56056 </section>
56057 <section id="SECTaclconditions">
56058 <title>ACL conditions</title>
56059 <para>
56060 <indexterm role="concept">
56061 <primary>access control lists (ACLs)</primary>
56062 <secondary>conditions; list of</secondary>
56063 </indexterm>
56064 Some of the conditions listed in this section are available only when Exim is
56065 compiled with the content-scanning extension. They are included here briefly
56066 for completeness. More detailed descriptions can be found in the discussion on
56067 content scanning in chapter <xref linkend="CHAPexiscan"/>.
56068 </para>
56069 <para>
56070 Not all conditions are relevant in all circumstances. For example, testing
56071 senders and recipients does not make sense in an ACL that is being run as the
56072 result of the arrival of an ETRN command, and checks on message headers can be
56073 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
56074 can use the same condition (with different parameters) more than once in the
56075 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
56076 The conditions are as follows:
56077 </para>
56078 <variablelist>
56079 <varlistentry>
56080 <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>
56081 <listitem>
56082 <para>
56083 <indexterm role="concept">
56084 <primary>access control lists (ACLs)</primary>
56085 <secondary>nested</secondary>
56086 </indexterm>
56087 <indexterm role="concept">
56088 <primary>access control lists (ACLs)</primary>
56089 <secondary>indirect</secondary>
56090 </indexterm>
56091 <indexterm role="concept">
56092 <primary>access control lists (ACLs)</primary>
56093 <secondary>arguments</secondary>
56094 </indexterm>
56095 <indexterm role="concept">
56096 <primary><option>acl</option> ACL condition</primary>
56097 </indexterm>
56098 The possible values of the argument are the same as for the
56099 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
56100 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
56101 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
56102 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
56103 condition false. This means that further processing of the <option>warn</option> verb
56104 ceases, but processing of the ACL continues.
56105 </para>
56106 <para>
56107 If the argument is a named ACL, up to nine space-separated optional values
56108 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
56109 and $acl_narg is set to the count of values.
56110 Previous values of these variables are restored after the call returns.
56111 The name and values are expanded separately.
56112 Note that spaces in complex expansions which are used as arguments
56113 will act as argument separators.
56114 </para>
56115 <para>
56116 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
56117 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
56118 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
56119 conditions are tested.
56120 </para>
56121 <para>
56122 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
56123 loops. This condition allows you to use different ACLs in different
56124 circumstances. For example, different ACLs can be used to handle RCPT commands
56125 for different local users or different local domains.
56126 </para>
56127 </listitem></varlistentry>
56128 <varlistentry>
56129 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
56130 <listitem>
56131 <para>
56132 <indexterm role="concept">
56133 <primary><option>authenticated</option> ACL condition</primary>
56134 </indexterm>
56135 <indexterm role="concept">
56136 <primary>authentication</primary>
56137 <secondary>ACL checking</secondary>
56138 </indexterm>
56139 <indexterm role="concept">
56140 <primary>access control lists (ACLs)</primary>
56141 <secondary>testing for authentication</secondary>
56142 </indexterm>
56143 If the SMTP connection is not authenticated, the condition is false. Otherwise,
56144 the name of the authenticator is tested against the list. To test for
56145 authentication by any authenticator, you can set
56146 </para>
56147 <literallayout class="monospaced">
56148 authenticated = *
56149 </literallayout>
56150 </listitem></varlistentry>
56151 <varlistentry>
56152 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
56153 <listitem>
56154 <para>
56155 <indexterm role="concept">
56156 <primary><option>condition</option> ACL condition</primary>
56157 </indexterm>
56158 <indexterm role="concept">
56159 <primary>customizing</primary>
56160 <secondary>ACL condition</secondary>
56161 </indexterm>
56162 <indexterm role="concept">
56163 <primary>access control lists (ACLs)</primary>
56164 <secondary>customized test</secondary>
56165 </indexterm>
56166 <indexterm role="concept">
56167 <primary>access control lists (ACLs)</primary>
56168 <secondary>testing, customized</secondary>
56169 </indexterm>
56170 This feature allows you to make up custom conditions. If the result of
56171 expanding the string is an empty string, the number zero, or one of the strings
56172 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
56173 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
56174 any other value, some error is assumed to have occurred, and the ACL returns
56175 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
56176 ignored. The effect is to treat it as true, whether it is positive or
56177 negative.
56178 </para>
56179 </listitem></varlistentry>
56180 <varlistentry>
56181 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
56182 <listitem>
56183 <para>
56184 <indexterm role="concept">
56185 <primary><option>decode</option> ACL condition</primary>
56186 </indexterm>
56187 This condition is available only when Exim is compiled with the
56188 content-scanning extension, and it is allowed only in the ACL defined by
56189 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
56190 If all goes well, the condition is true. It is false only if there are
56191 problems such as a syntax error or a memory shortage. For more details, see
56192 chapter <xref linkend="CHAPexiscan"/>.
56193 </para>
56194 </listitem></varlistentry>
56195 <varlistentry>
56196 <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>
56197 <listitem>
56198 <para>
56199 <indexterm role="concept">
56200 <primary><option>dnslists</option> ACL condition</primary>
56201 </indexterm>
56202 <indexterm role="concept">
56203 <primary>DNS list</primary>
56204 <secondary>in ACL</secondary>
56205 </indexterm>
56206 <indexterm role="concept">
56207 <primary>black list (DNS)</primary>
56208 </indexterm>
56209 <indexterm role="concept">
56210 <primary>access control lists (ACLs)</primary>
56211 <secondary>testing a DNS list</secondary>
56212 </indexterm>
56213 This condition checks for entries in DNS black lists. These are also known as
56214 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
56215 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
56216 different variants of this condition to describe briefly here. See sections
56217 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
56218 </para>
56219 </listitem></varlistentry>
56220 <varlistentry>
56221 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
56222 <listitem>
56223 <para>
56224 <indexterm role="concept">
56225 <primary><option>domains</option> ACL condition</primary>
56226 </indexterm>
56227 <indexterm role="concept">
56228 <primary>domain</primary>
56229 <secondary>ACL checking</secondary>
56230 </indexterm>
56231 <indexterm role="concept">
56232 <primary>access control lists (ACLs)</primary>
56233 <secondary>testing a recipient domain</secondary>
56234 </indexterm>
56235 <indexterm role="variable">
56236 <primary><varname>$domain_data</varname></primary>
56237 </indexterm>
56238 This condition is relevant only after a RCPT command. It checks that the domain
56239 of the recipient address is in the domain list. If percent-hack processing is
56240 enabled, it is done before this test is done. If the check succeeds with a
56241 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
56242 <option>domains</option> test.
56243 </para>
56244 <para>
56245 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
56246 use <option>domains</option> in a DATA ACL.
56247 </para>
56248 </listitem></varlistentry>
56249 <varlistentry>
56250 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
56251 <listitem>
56252 <para>
56253 <indexterm role="concept">
56254 <primary><option>encrypted</option> ACL condition</primary>
56255 </indexterm>
56256 <indexterm role="concept">
56257 <primary>encryption</primary>
56258 <secondary>checking in an ACL</secondary>
56259 </indexterm>
56260 <indexterm role="concept">
56261 <primary>access control lists (ACLs)</primary>
56262 <secondary>testing for encryption</secondary>
56263 </indexterm>
56264 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
56265 name of the cipher suite in use is tested against the list. To test for
56266 encryption without testing for any specific cipher suite(s), set
56267 </para>
56268 <literallayout class="monospaced">
56269 encrypted = *
56270 </literallayout>
56271 </listitem></varlistentry>
56272 <varlistentry>
56273 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
56274 <listitem>
56275 <para>
56276 <indexterm role="concept">
56277 <primary><option>hosts</option> ACL condition</primary>
56278 </indexterm>
56279 <indexterm role="concept">
56280 <primary>host</primary>
56281 <secondary>ACL checking</secondary>
56282 </indexterm>
56283 <indexterm role="concept">
56284 <primary>access control lists (ACLs)</primary>
56285 <secondary>testing the client host</secondary>
56286 </indexterm>
56287 This condition tests that the calling host matches the host list. If you have
56288 name lookups or wildcarded host names and IP addresses in the same host list,
56289 you should normally put the IP addresses first. For example, you could have:
56290 </para>
56291 <literallayout class="monospaced">
56292 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
56293 </literallayout>
56294 <para>
56295 The lookup in this example uses the host name for its key. This is implied by
56296 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
56297 and it wouldn&#x2019;t matter which way round you had these two items.)
56298 </para>
56299 <para>
56300 The reason for the problem with host names lies in the left-to-right way that
56301 Exim processes lists. It can test IP addresses without doing any DNS lookups,
56302 but when it reaches an item that requires a host name, it fails if it cannot
56303 find a host name to compare with the pattern. If the above list is given in the
56304 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
56305 found, even if its IP address is 10.9.8.7.
56306 </para>
56307 <para>
56308 If you really do want to do the name check first, and still recognize the IP
56309 address even if the name lookup fails, you can rewrite the ACL like this:
56310 </para>
56311 <literallayout class="monospaced">
56312 accept hosts = dbm;/etc/friendly/hosts
56313 accept hosts = 10.9.8.7
56314 </literallayout>
56315 <para>
56316 The default action on failing to find the host name is to assume that the host
56317 is not in the list, so the first <option>accept</option> statement fails. The second
56318 statement can then check the IP address.
56319 </para>
56320 <para>
56321 <indexterm role="variable">
56322 <primary><varname>$host_data</varname></primary>
56323 </indexterm>
56324 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
56325 of the lookup is made available in the <varname>$host_data</varname> variable. This
56326 allows you, for example, to set up a statement like this:
56327 </para>
56328 <literallayout class="monospaced">
56329 deny  hosts = net-lsearch;/some/file
56330 message = $host_data
56331 </literallayout>
56332 <para>
56333 which gives a custom error message for each denied host.
56334 </para>
56335 </listitem></varlistentry>
56336 <varlistentry>
56337 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
56338 <listitem>
56339 <para>
56340 <indexterm role="concept">
56341 <primary><option>local_parts</option> ACL condition</primary>
56342 </indexterm>
56343 <indexterm role="concept">
56344 <primary>local part</primary>
56345 <secondary>ACL checking</secondary>
56346 </indexterm>
56347 <indexterm role="concept">
56348 <primary>access control lists (ACLs)</primary>
56349 <secondary>testing a local part</secondary>
56350 </indexterm>
56351 <indexterm role="variable">
56352 <primary><varname>$local_part_data</varname></primary>
56353 </indexterm>
56354 This condition is relevant only after a RCPT command. It checks that the local
56355 part of the recipient address is in the list. If percent-hack processing is
56356 enabled, it is done before this test. If the check succeeds with a lookup, the
56357 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
56358 the next <option>local_parts</option> test.
56359 </para>
56360 </listitem></varlistentry>
56361 <varlistentry>
56362 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
56363 <listitem>
56364 <para>
56365 <indexterm role="concept">
56366 <primary><option>malware</option> ACL condition</primary>
56367 </indexterm>
56368 <indexterm role="concept">
56369 <primary>access control lists (ACLs)</primary>
56370 <secondary>virus scanning</secondary>
56371 </indexterm>
56372 <indexterm role="concept">
56373 <primary>access control lists (ACLs)</primary>
56374 <secondary>scanning for viruses</secondary>
56375 </indexterm>
56376 This condition is available only when Exim is compiled with the
56377 content-scanning extension. It causes the incoming message to be scanned for
56378 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
56379 </para>
56380 </listitem></varlistentry>
56381 <varlistentry>
56382 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
56383 <listitem>
56384 <para>
56385 <indexterm role="concept">
56386 <primary><option>mime_regex</option> ACL condition</primary>
56387 </indexterm>
56388 <indexterm role="concept">
56389 <primary>access control lists (ACLs)</primary>
56390 <secondary>testing by regex matching</secondary>
56391 </indexterm>
56392 This condition is available only when Exim is compiled with the
56393 content-scanning extension, and it is allowed only in the ACL defined by
56394 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
56395 with any of the regular expressions. For details, see chapter
56396 <xref linkend="CHAPexiscan"/>.
56397 </para>
56398 </listitem></varlistentry>
56399 <varlistentry>
56400 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
56401 <listitem>
56402 <para>
56403 <indexterm role="concept">
56404 <primary>rate limiting</primary>
56405 </indexterm>
56406 This condition can be used to limit the rate at which a user or host submits
56407 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
56408 </para>
56409 </listitem></varlistentry>
56410 <varlistentry>
56411 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
56412 <listitem>
56413 <para>
56414 <indexterm role="concept">
56415 <primary><option>recipients</option> ACL condition</primary>
56416 </indexterm>
56417 <indexterm role="concept">
56418 <primary>recipient</primary>
56419 <secondary>ACL checking</secondary>
56420 </indexterm>
56421 <indexterm role="concept">
56422 <primary>access control lists (ACLs)</primary>
56423 <secondary>testing a recipient</secondary>
56424 </indexterm>
56425 This condition is relevant only after a RCPT command. It checks the entire
56426 recipient address against a list of recipients.
56427 </para>
56428 </listitem></varlistentry>
56429 <varlistentry>
56430 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
56431 <listitem>
56432 <para>
56433 <indexterm role="concept">
56434 <primary><option>regex</option> ACL condition</primary>
56435 </indexterm>
56436 <indexterm role="concept">
56437 <primary>access control lists (ACLs)</primary>
56438 <secondary>testing by regex matching</secondary>
56439 </indexterm>
56440 This condition is available only when Exim is compiled with the
56441 content-scanning extension, and is available only in the DATA, MIME, and
56442 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
56443 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
56444 </para>
56445 </listitem></varlistentry>
56446 <varlistentry>
56447 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
56448 <listitem>
56449 <para>
56450 <indexterm role="concept">
56451 <primary><option>sender_domains</option> ACL condition</primary>
56452 </indexterm>
56453 <indexterm role="concept">
56454 <primary>sender</primary>
56455 <secondary>ACL checking</secondary>
56456 </indexterm>
56457 <indexterm role="concept">
56458 <primary>access control lists (ACLs)</primary>
56459 <secondary>testing a sender domain</secondary>
56460 </indexterm>
56461 <indexterm role="variable">
56462 <primary><varname>$domain</varname></primary>
56463 </indexterm>
56464 <indexterm role="variable">
56465 <primary><varname>$sender_address_domain</varname></primary>
56466 </indexterm>
56467 This condition tests the domain of the sender of the message against the given
56468 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
56469 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
56470 of this condition. This is an exception to the general rule for testing domain
56471 lists. It is done this way so that, if this condition is used in an ACL for a
56472 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
56473 influence the sender checking.
56474 </para>
56475 <para>
56476 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
56477 relaying, because sender addresses are easily, and commonly, forged.
56478 </para>
56479 </listitem></varlistentry>
56480 <varlistentry>
56481 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
56482 <listitem>
56483 <para>
56484 <indexterm role="concept">
56485 <primary><option>senders</option> ACL condition</primary>
56486 </indexterm>
56487 <indexterm role="concept">
56488 <primary>sender</primary>
56489 <secondary>ACL checking</secondary>
56490 </indexterm>
56491 <indexterm role="concept">
56492 <primary>access control lists (ACLs)</primary>
56493 <secondary>testing a sender</secondary>
56494 </indexterm>
56495 This condition tests the sender of the message against the given list. To test
56496 for a bounce message, which has an empty sender, set
56497 </para>
56498 <literallayout class="monospaced">
56499 senders = :
56500 </literallayout>
56501 <para>
56502 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
56503 relaying, because sender addresses are easily, and commonly, forged.
56504 </para>
56505 </listitem></varlistentry>
56506 <varlistentry>
56507 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
56508 <listitem>
56509 <para>
56510 <indexterm role="concept">
56511 <primary><option>spam</option> ACL condition</primary>
56512 </indexterm>
56513 <indexterm role="concept">
56514 <primary>access control lists (ACLs)</primary>
56515 <secondary>scanning for spam</secondary>
56516 </indexterm>
56517 This condition is available only when Exim is compiled with the
56518 content-scanning extension. It causes the incoming message to be scanned by
56519 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
56520 </para>
56521 </listitem></varlistentry>
56522 <varlistentry>
56523 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
56524 <listitem>
56525 <para>
56526 <indexterm role="concept">
56527 <primary><option>verify</option> ACL condition</primary>
56528 </indexterm>
56529 <indexterm role="concept">
56530 <primary>TLS</primary>
56531 <secondary>client certificate verification</secondary>
56532 </indexterm>
56533 <indexterm role="concept">
56534 <primary>certificate</primary>
56535 <secondary>verification of client</secondary>
56536 </indexterm>
56537 <indexterm role="concept">
56538 <primary>access control lists (ACLs)</primary>
56539 <secondary>certificate verification</secondary>
56540 </indexterm>
56541 <indexterm role="concept">
56542 <primary>access control lists (ACLs)</primary>
56543 <secondary>testing a TLS certificate</secondary>
56544 </indexterm>
56545 This condition is true in an SMTP session if the session is encrypted, and a
56546 certificate was received from the client, and the certificate was verified. The
56547 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
56548 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
56549 </para>
56550 </listitem></varlistentry>
56551 <varlistentry>
56552 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
56553 <listitem>
56554 <para>
56555 <indexterm role="concept">
56556 <primary>CSA verification</primary>
56557 </indexterm>
56558 This condition checks whether the sending host (the client) is authorized to
56559 send email. Details of how this works are given in section
56560 <xref linkend="SECTverifyCSA"/>.
56561 </para>
56562 </listitem></varlistentry>
56563 <varlistentry>
56564 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
56565 <listitem>
56566 <para>
56567 <indexterm role="concept">
56568 <primary><option>verify</option> ACL condition</primary>
56569 </indexterm>
56570 <indexterm role="concept">
56571 <primary>access control lists (ACLs)</primary>
56572 <secondary>verifying header names only ASCII</secondary>
56573 </indexterm>
56574 <indexterm role="concept">
56575 <primary>header lines</primary>
56576 <secondary>verifying header names only ASCII</secondary>
56577 </indexterm>
56578 <indexterm role="concept">
56579 <primary>verifying</primary>
56580 <secondary>header names only ASCII</secondary>
56581 </indexterm>
56582 This condition is relevant only in an ACL that is run after a message has been
56583 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56584 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
56585 there are no non-ASCII characters, also excluding control characters.  The
56586 allowable characters are decimal ASCII values 33 through 126.
56587 </para>
56588 <para>
56589 Exim itself will handle headers with non-ASCII characters, but it can cause
56590 problems for downstream applications, so this option will allow their
56591 detection and rejection in the DATA ACL&#x2019;s.
56592 </para>
56593 </listitem></varlistentry>
56594 <varlistentry>
56595 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56596 <listitem>
56597 <para>
56598 <indexterm role="concept">
56599 <primary><option>verify</option> ACL condition</primary>
56600 </indexterm>
56601 <indexterm role="concept">
56602 <primary>access control lists (ACLs)</primary>
56603 <secondary>verifying sender in the header</secondary>
56604 </indexterm>
56605 <indexterm role="concept">
56606 <primary>header lines</primary>
56607 <secondary>verifying the sender in</secondary>
56608 </indexterm>
56609 <indexterm role="concept">
56610 <primary>sender</primary>
56611 <secondary>verifying in header</secondary>
56612 </indexterm>
56613 <indexterm role="concept">
56614 <primary>verifying</primary>
56615 <secondary>sender in header</secondary>
56616 </indexterm>
56617 This condition is relevant only in an ACL that is run after a message has been
56618 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56619 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
56620 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
56621 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
56622 However, an address that appears in one of these headers need not be an address
56623 that accepts bounce messages; only sender addresses in envelopes are required
56624 to accept bounces. Therefore, if you use the callout option on this check, you
56625 might want to arrange for a non-empty address in the MAIL command.
56626 </para>
56627 <para>
56628 Details of address verification and the options are given later, starting at
56629 section <xref linkend="SECTaddressverification"/> (callouts are described in section
56630 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
56631 condition to restrict it to bounce messages only:
56632 </para>
56633 <literallayout class="monospaced">
56634 deny    senders = :
56635         message = A valid sender header is required for bounces
56636        !verify  = header_sender
56637 </literallayout>
56638 </listitem></varlistentry>
56639 <varlistentry>
56640 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
56641 <listitem>
56642 <para>
56643 <indexterm role="concept">
56644 <primary><option>verify</option> ACL condition</primary>
56645 </indexterm>
56646 <indexterm role="concept">
56647 <primary>access control lists (ACLs)</primary>
56648 <secondary>verifying header syntax</secondary>
56649 </indexterm>
56650 <indexterm role="concept">
56651 <primary>header lines</primary>
56652 <secondary>verifying syntax</secondary>
56653 </indexterm>
56654 <indexterm role="concept">
56655 <primary>verifying</primary>
56656 <secondary>header syntax</secondary>
56657 </indexterm>
56658 This condition is relevant only in an ACL that is run after a message has been
56659 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
56660 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
56661 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
56662 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
56663 Unqualified addresses (local parts without domains) are
56664 permitted only in locally generated messages and from hosts that match
56665 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
56666 appropriate.
56667 </para>
56668 <para>
56669 Note that this condition is a syntax check only. However, a common spamming
56670 ploy used to be to send syntactically invalid headers such as
56671 </para>
56672 <literallayout class="monospaced">
56673 To: @
56674 </literallayout>
56675 <para>
56676 and this condition can be used to reject such messages, though they are not as
56677 common as they used to be.
56678 </para>
56679 </listitem></varlistentry>
56680 <varlistentry>
56681 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
56682 <listitem>
56683 <para>
56684 <indexterm role="concept">
56685 <primary><option>verify</option> ACL condition</primary>
56686 </indexterm>
56687 <indexterm role="concept">
56688 <primary>access control lists (ACLs)</primary>
56689 <secondary>verifying HELO/EHLO</secondary>
56690 </indexterm>
56691 <indexterm role="concept">
56692 <primary>HELO</primary>
56693 <secondary>verifying</secondary>
56694 </indexterm>
56695 <indexterm role="concept">
56696 <primary>EHLO</primary>
56697 <secondary>verifying</secondary>
56698 </indexterm>
56699 <indexterm role="concept">
56700 <primary>verifying</primary>
56701 <secondary>EHLO</secondary>
56702 </indexterm>
56703 <indexterm role="concept">
56704 <primary>verifying</primary>
56705 <secondary>HELO</secondary>
56706 </indexterm>
56707 This condition is true if a HELO or EHLO command has been received from the
56708 client host, and its contents have been verified. If there has been no previous
56709 attempt to verify the HELO/EHLO contents, it is carried out when this
56710 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
56711 <option>helo_try_verify_hosts</option> options for details of how to request verification
56712 independently of this condition.
56713 </para>
56714 <para>
56715 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
56716 option), this condition is always true.
56717 </para>
56718 </listitem></varlistentry>
56719 <varlistentry>
56720 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
56721 <listitem>
56722 <para>
56723 <indexterm role="concept">
56724 <primary>verifying</primary>
56725 <secondary>not blind</secondary>
56726 </indexterm>
56727 <indexterm role="concept">
56728 <primary>bcc recipients, verifying none</primary>
56729 </indexterm>
56730 This condition checks that there are no blind (bcc) recipients in the message.
56731 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
56732 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
56733 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
56734 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
56735 used only in a DATA or non-SMTP ACL.
56736 </para>
56737 <para>
56738 There are, of course, many legitimate messages that make use of blind (bcc)
56739 recipients. This check should not be used on its own for blocking messages.
56740 </para>
56741 </listitem></varlistentry>
56742 <varlistentry>
56743 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56744 <listitem>
56745 <para>
56746 <indexterm role="concept">
56747 <primary><option>verify</option> ACL condition</primary>
56748 </indexterm>
56749 <indexterm role="concept">
56750 <primary>access control lists (ACLs)</primary>
56751 <secondary>verifying recipient</secondary>
56752 </indexterm>
56753 <indexterm role="concept">
56754 <primary>recipient</primary>
56755 <secondary>verifying</secondary>
56756 </indexterm>
56757 <indexterm role="concept">
56758 <primary>verifying</primary>
56759 <secondary>recipient</secondary>
56760 </indexterm>
56761 <indexterm role="variable">
56762 <primary><varname>$address_data</varname></primary>
56763 </indexterm>
56764 This condition is relevant only after a RCPT command. It verifies the current
56765 recipient. Details of address verification are given later, starting at section
56766 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
56767 of <varname>$address_data</varname> is the last value that was set while routing the address.
56768 This applies even if the verification fails. When an address that is being
56769 verified is redirected to a single address, verification continues with the new
56770 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
56771 value for the child address.
56772 </para>
56773 </listitem></varlistentry>
56774 <varlistentry>
56775 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56776 <listitem>
56777 <para>
56778 <indexterm role="concept">
56779 <primary><option>verify</option> ACL condition</primary>
56780 </indexterm>
56781 <indexterm role="concept">
56782 <primary>access control lists (ACLs)</primary>
56783 <secondary>verifying host reverse lookup</secondary>
56784 </indexterm>
56785 <indexterm role="concept">
56786 <primary>host</primary>
56787 <secondary>verifying reverse lookup</secondary>
56788 </indexterm>
56789 This condition ensures that a verified host name has been looked up from the IP
56790 address of the client host. (This may have happened already if the host name
56791 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
56792 Verification ensures that the host name obtained from a reverse DNS lookup, or
56793 one of its aliases, does, when it is itself looked up in the DNS, yield the
56794 original IP address.
56795 </para>
56796 <para>
56797 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
56798 DNS operation returns a temporary error, the verify condition succeeds.
56799 </para>
56800 <para>
56801 If this condition is used for a locally generated message (that is, when there
56802 is no client host involved), it always succeeds.
56803 </para>
56804 </listitem></varlistentry>
56805 <varlistentry>
56806 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56807 <listitem>
56808 <para>
56809 <indexterm role="concept">
56810 <primary><option>verify</option> ACL condition</primary>
56811 </indexterm>
56812 <indexterm role="concept">
56813 <primary>access control lists (ACLs)</primary>
56814 <secondary>verifying sender</secondary>
56815 </indexterm>
56816 <indexterm role="concept">
56817 <primary>sender</primary>
56818 <secondary>verifying</secondary>
56819 </indexterm>
56820 <indexterm role="concept">
56821 <primary>verifying</primary>
56822 <secondary>sender</secondary>
56823 </indexterm>
56824 This condition is relevant only after a MAIL or RCPT command, or after a
56825 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
56826 the message&#x2019;s sender is empty (that is, this is a bounce message), the
56827 condition is true. Otherwise, the sender address is verified.
56828 </para>
56829 <para>
56830 <indexterm role="variable">
56831 <primary><varname>$address_data</varname></primary>
56832 </indexterm>
56833 <indexterm role="variable">
56834 <primary><varname>$sender_address_data</varname></primary>
56835 </indexterm>
56836 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
56837 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
56838 value can be used in subsequent conditions and modifiers in the same ACL
56839 statement. It does not persist after the end of the current statement. If you
56840 want to preserve the value for longer, you can save it in an ACL variable.
56841 </para>
56842 <para>
56843 Details of verification are given later, starting at section
56844 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
56845 to avoid doing it more than once per message.
56846 </para>
56847 </listitem></varlistentry>
56848 <varlistentry>
56849 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
56850 <listitem>
56851 <para>
56852 <indexterm role="concept">
56853 <primary><option>verify</option> ACL condition</primary>
56854 </indexterm>
56855 This is a variation of the previous option, in which a modified address is
56856 verified as a sender.
56857 </para>
56858 <para revisionflag="changed">
56859 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
56860 (eg. is generated from the received message)
56861 they must be protected from the options parsing by doubling:
56862 </para>
56863 <literallayout class="monospaced" revisionflag="changed">
56864 verify = sender=${sg{${address:$h_sender:}}{/}{//}}
56865 </literallayout>
56866 </listitem></varlistentry>
56867 </variablelist>
56868 </section>
56869 <section id="SECTmorednslists">
56870 <title>Using DNS lists</title>
56871 <para>
56872 <indexterm role="concept">
56873 <primary>DNS list</primary>
56874 <secondary>in ACL</secondary>
56875 </indexterm>
56876 <indexterm role="concept">
56877 <primary>black list (DNS)</primary>
56878 </indexterm>
56879 <indexterm role="concept">
56880 <primary>access control lists (ACLs)</primary>
56881 <secondary>testing a DNS list</secondary>
56882 </indexterm>
56883 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
56884 is on at least one of a number of DNS lists by looking up the inverted IP
56885 address in one or more DNS domains. (Note that DNS list domains are not mail
56886 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
56887 special options instead.) For example, if the calling host&#x2019;s IP
56888 address is 192.168.62.43, and the ACL statement is
56889 </para>
56890 <literallayout class="monospaced">
56891 deny dnslists = blackholes.mail-abuse.org : \
56892                 dialups.mail-abuse.org
56893 </literallayout>
56894 <para>
56895 the following records are looked up:
56896 </para>
56897 <literallayout class="monospaced">
56898 43.62.168.192.blackholes.mail-abuse.org
56899 43.62.168.192.dialups.mail-abuse.org
56900 </literallayout>
56901 <para>
56902 As soon as Exim finds an existing DNS record, processing of the list stops.
56903 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
56904 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
56905 use two separate conditions:
56906 </para>
56907 <literallayout class="monospaced">
56908 deny dnslists = blackholes.mail-abuse.org
56909      dnslists = dialups.mail-abuse.org
56910 </literallayout>
56911 <para>
56912 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
56913 behaves as if the host does not match the list item, that is, as if the DNS
56914 record does not exist. If there are further items in the DNS list, they are
56915 processed.
56916 </para>
56917 <para>
56918 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
56919 (which is the most common usage), because it prevents a DNS failure from
56920 blocking mail. However, you can change this behaviour by putting one of the
56921 following special items in the list:
56922 </para>
56923 <literallayout>
56924 <literal>+include_unknown </literal>   behave as if the item is on the list
56925 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
56926 <literal>+defer_unknown   </literal>   give a temporary error
56927 </literallayout>
56928 <para>
56929 <indexterm role="concept">
56930 <primary><literal>+include_unknown</literal></primary>
56931 </indexterm>
56932 <indexterm role="concept">
56933 <primary><literal>+exclude_unknown</literal></primary>
56934 </indexterm>
56935 <indexterm role="concept">
56936 <primary><literal>+defer_unknown</literal></primary>
56937 </indexterm>
56938 Each of these applies to any subsequent items on the list. For example:
56939 </para>
56940 <literallayout class="monospaced">
56941 deny dnslists = +defer_unknown : foo.bar.example
56942 </literallayout>
56943 <para>
56944 Testing the list of domains stops as soon as a match is found. If you want to
56945 warn for one list and block for another, you can use two different statements:
56946 </para>
56947 <literallayout class="monospaced">
56948 deny  dnslists = blackholes.mail-abuse.org
56949 warn  message  = X-Warn: sending host is on dialups list
56950       dnslists = dialups.mail-abuse.org
56951 </literallayout>
56952 <para>
56953 <indexterm role="concept">
56954 <primary>caching</primary>
56955 <secondary>of dns lookup</secondary>
56956 </indexterm>
56957 <indexterm role="concept">
56958 <primary>DNS</primary>
56959 <secondary>TTL</secondary>
56960 </indexterm>
56961 DNS list lookups are cached by Exim for the duration of the SMTP session
56962 (but limited by the DNS return TTL value),
56963 so a lookup based on the IP address is done at most once for any incoming
56964 connection (assuming long-enough TTL).
56965 Exim does not share information between multiple incoming
56966 connections (but your local name server cache should be active).
56967 </para>
56968 </section>
56969 <section id="SECID201">
56970 <title>Specifying the IP address for a DNS list lookup</title>
56971 <para>
56972 <indexterm role="concept">
56973 <primary>DNS list</primary>
56974 <secondary>keyed by explicit IP address</secondary>
56975 </indexterm>
56976 By default, the IP address that is used in a DNS list lookup is the IP address
56977 of the calling host. However, you can specify another IP address by listing it
56978 after the domain name, introduced by a slash. For example:
56979 </para>
56980 <literallayout class="monospaced">
56981 deny dnslists = black.list.tld/192.168.1.2
56982 </literallayout>
56983 <para>
56984 This feature is not very helpful with explicit IP addresses; it is intended for
56985 use with IP addresses that are looked up, for example, the IP addresses of the
56986 MX hosts or nameservers of an email sender address. For an example, see section
56987 <xref linkend="SECTmulkeyfor"/> below.
56988 </para>
56989 </section>
56990 <section id="SECID202">
56991 <title>DNS lists keyed on domain names</title>
56992 <para>
56993 <indexterm role="concept">
56994 <primary>DNS list</primary>
56995 <secondary>keyed by domain name</secondary>
56996 </indexterm>
56997 There are some lists that are keyed on domain names rather than inverted IP
56998 addresses (see for example the <emphasis>domain based zones</emphasis> link at
56999 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
57000 with these lists. You can change the name that is looked up in a DNS list by
57001 listing it after the domain name, introduced by a slash. For example,
57002 </para>
57003 <literallayout class="monospaced">
57004 deny  message  = Sender's domain is listed at $dnslist_domain
57005       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
57006 </literallayout>
57007 <para>
57008 This particular example is useful only in ACLs that are obeyed after the
57009 RCPT or DATA commands, when a sender address is available. If (for
57010 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
57011 up by this example is
57012 </para>
57013 <literallayout class="monospaced">
57014 tld.example.dsn.rfc-ignorant.org
57015 </literallayout>
57016 <para>
57017 A single <option>dnslists</option> condition can contain entries for both names and IP
57018 addresses. For example:
57019 </para>
57020 <literallayout class="monospaced">
57021 deny dnslists = sbl.spamhaus.org : \
57022                 dsn.rfc-ignorant.org/$sender_address_domain
57023 </literallayout>
57024 <para>
57025 The first item checks the sending host&#x2019;s IP address; the second checks a domain
57026 name. The whole condition is true if either of the DNS lookups succeeds.
57027 </para>
57028 </section>
57029 <section id="SECTmulkeyfor">
57030 <title>Multiple explicit keys for a DNS list</title>
57031 <para>
57032 <indexterm role="concept">
57033 <primary>DNS list</primary>
57034 <secondary>multiple keys for</secondary>
57035 </indexterm>
57036 The syntax described above for looking up explicitly-defined values (either
57037 names or IP addresses) in a DNS blacklist is a simplification. After the domain
57038 name for the DNS list, what follows the slash can in fact be a list of items.
57039 As with all lists in Exim, the default separator is a colon. However, because
57040 this is a sublist within the list of DNS blacklist domains, it is necessary
57041 either to double the separators like this:
57042 </para>
57043 <literallayout class="monospaced">
57044 dnslists = black.list.tld/name.1::name.2
57045 </literallayout>
57046 <para>
57047 or to change the separator character, like this:
57048 </para>
57049 <literallayout class="monospaced">
57050 dnslists = black.list.tld/&lt;;name.1;name.2
57051 </literallayout>
57052 <para>
57053 If an item in the list is an IP address, it is inverted before the DNS
57054 blacklist domain is appended. If it is not an IP address, no inversion
57055 occurs. Consider this condition:
57056 </para>
57057 <literallayout class="monospaced">
57058 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
57059 </literallayout>
57060 <para>
57061 The DNS lookups that occur are:
57062 </para>
57063 <literallayout class="monospaced">
57064 2.1.168.192.black.list.tld
57065 a.domain.black.list.tld
57066 </literallayout>
57067 <para>
57068 Once a DNS record has been found (that matches a specific IP return
57069 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
57070 are done. If there is a temporary DNS error, the rest of the sublist of domains
57071 or IP addresses is tried. A temporary error for the whole dnslists item occurs
57072 only if no other DNS lookup in this sublist succeeds. In other words, a
57073 successful lookup for any of the items in the sublist overrides a temporary
57074 error for a previous item.
57075 </para>
57076 <para>
57077 The ability to supply a list of items after the slash is in some sense just a
57078 syntactic convenience. These two examples have the same effect:
57079 </para>
57080 <literallayout class="monospaced">
57081 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
57082 dnslists = black.list.tld/a.domain::b.domain
57083 </literallayout>
57084 <para>
57085 However, when the data for the list is obtained from a lookup, the second form
57086 is usually much more convenient. Consider this example:
57087 </para>
57088 <literallayout class="monospaced">
57089 deny message  = The mail servers for the domain \
57090                 $sender_address_domain \
57091                 are listed at $dnslist_domain ($dnslist_value); \
57092                 see $dnslist_text.
57093      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
57094                                    ${lookup dnsdb {&gt;|mxh=\
57095                                    $sender_address_domain} }} }
57096 </literallayout>
57097 <para>
57098 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
57099 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
57100 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
57101 of expanding the condition might be something like this:
57102 </para>
57103 <literallayout class="monospaced">
57104 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
57105 </literallayout>
57106 <para>
57107 Thus, this example checks whether or not the IP addresses of the sender
57108 domain&#x2019;s mail servers are on the Spamhaus black list.
57109 </para>
57110 <para>
57111 The key that was used for a successful DNS list lookup is put into the variable
57112 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
57113 </para>
57114 </section>
57115 <section id="SECID203">
57116 <title>Data returned by DNS lists</title>
57117 <para>
57118 <indexterm role="concept">
57119 <primary>DNS list</primary>
57120 <secondary>data returned from</secondary>
57121 </indexterm>
57122 DNS lists are constructed using address records in the DNS. The original RBL
57123 just used the address 127.0.0.1 on the right hand side of each record, but the
57124 RBL+ list and some other lists use a number of values with different meanings.
57125 The values used on the RBL+ list are:
57126 </para>
57127 <literallayout>
57128 127.1.0.1  RBL
57129 127.1.0.2  DUL
57130 127.1.0.3  DUL and RBL
57131 127.1.0.4  RSS
57132 127.1.0.5  RSS and RBL
57133 127.1.0.6  RSS and DUL
57134 127.1.0.7  RSS and DUL and RBL
57135 </literallayout>
57136 <para>
57137 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
57138 different values. Some DNS lists may return more than one address record;
57139 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
57140 </para>
57141 </section>
57142 <section id="SECID204">
57143 <title>Variables set from DNS lists</title>
57144 <para>
57145 <indexterm role="concept">
57146 <primary>expansion</primary>
57147 <secondary>variables, set from DNS list</secondary>
57148 </indexterm>
57149 <indexterm role="concept">
57150 <primary>DNS list</primary>
57151 <secondary>variables set from</secondary>
57152 </indexterm>
57153 <indexterm role="variable">
57154 <primary><varname>$dnslist_domain</varname></primary>
57155 </indexterm>
57156 <indexterm role="variable">
57157 <primary><varname>$dnslist_matched</varname></primary>
57158 </indexterm>
57159 <indexterm role="variable">
57160 <primary><varname>$dnslist_text</varname></primary>
57161 </indexterm>
57162 <indexterm role="variable">
57163 <primary><varname>$dnslist_value</varname></primary>
57164 </indexterm>
57165 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
57166 the name of the overall domain that matched (for example,
57167 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
57168 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
57169 the DNS record. When the key is an IP address, it is not reversed in
57170 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
57171 cases, for example:
57172 </para>
57173 <literallayout class="monospaced">
57174 deny dnslists = spamhaus.example
57175 </literallayout>
57176 <para>
57177 the key is also available in another variable (in this case,
57178 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
57179 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
57180 might generate a dnslists lookup like this:
57181 </para>
57182 <literallayout class="monospaced">
57183 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
57184 </literallayout>
57185 <para>
57186 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
57187 <literal>192.168.6.7</literal> (for example).
57188 </para>
57189 <para>
57190 If more than one address record is returned by the DNS lookup, all the IP
57191 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
57192 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
57193 record. For lists such as RBL+ the TXT record for a merged entry is often not
57194 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
57195 information.
57196 </para>
57197 <para>
57198 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
57199 &ndash; although these appear before the condition in the ACL, they are not
57200 expanded until after it has failed. For example:
57201 </para>
57202 <literallayout class="monospaced">
57203 deny    hosts = !+local_networks
57204         message = $sender_host_address is listed \
57205                   at $dnslist_domain
57206         dnslists = rbl-plus.mail-abuse.example
57207 </literallayout>
57208 </section>
57209 <section id="SECTaddmatcon">
57210 <title>Additional matching conditions for DNS lists</title>
57211 <para>
57212 <indexterm role="concept">
57213 <primary>DNS list</primary>
57214 <secondary>matching specific returned data</secondary>
57215 </indexterm>
57216 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
57217 in order to restrict its action to DNS records with a matching right hand side.
57218 For example,
57219 </para>
57220 <literallayout class="monospaced">
57221 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
57222 </literallayout>
57223 <para>
57224 rejects only those hosts that yield 127.0.0.2. Without this additional data,
57225 any address record is considered to be a match. For the moment, we assume
57226 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
57227 describes how multiple records are handled.
57228 </para>
57229 <para>
57230 More than one IP address may be given for checking, using a comma as a
57231 separator. These are alternatives &ndash; if any one of them matches, the
57232 <option>dnslists</option> condition is true. For example:
57233 </para>
57234 <literallayout class="monospaced">
57235 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
57236 </literallayout>
57237 <para>
57238 If you want to specify a constraining address list and also specify names or IP
57239 addresses to be looked up, the constraining address list must be specified
57240 first. For example:
57241 </para>
57242 <literallayout class="monospaced">
57243 deny dnslists = dsn.rfc-ignorant.org\
57244                 =127.0.0.2/$sender_address_domain
57245 </literallayout>
57246 <para>
57247 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
57248 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
57249 In other words, the listed addresses are used as bit masks. The comparison is
57250 true if all the bits in the mask are present in the address that is being
57251 tested. For example:
57252 </para>
57253 <literallayout class="monospaced">
57254 dnslists = a.b.c&amp;0.0.0.3
57255 </literallayout>
57256 <para>
57257 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
57258 want to test whether one bit or another bit is present (as opposed to both
57259 being present), you must use multiple values. For example:
57260 </para>
57261 <literallayout class="monospaced">
57262 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
57263 </literallayout>
57264 <para>
57265 matches if the final component of the address is an odd number or two times
57266 an odd number.
57267 </para>
57268 </section>
57269 <section id="SECID205">
57270 <title>Negated DNS matching conditions</title>
57271 <para>
57272 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
57273 condition. Whereas
57274 </para>
57275 <literallayout class="monospaced">
57276 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
57277 </literallayout>
57278 <para>
57279 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
57280 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
57281 </para>
57282 <literallayout class="monospaced">
57283 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
57284 </literallayout>
57285 <para>
57286 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
57287 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
57288 words, the result of the test is inverted if an exclamation mark appears before
57289 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
57290 </para>
57291 <para>
57292 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
57293 host, or address list (which is why the syntax is different).
57294 </para>
57295 <para>
57296 If you are using just one list, the negation syntax does not gain you much. The
57297 previous example is precisely equivalent to
57298 </para>
57299 <literallayout class="monospaced">
57300 deny  dnslists = a.b.c
57301      !dnslists = a.b.c=127.0.0.2,127.0.0.3
57302 </literallayout>
57303 <para>
57304 However, if you are using multiple lists, the negation syntax is clearer.
57305 Consider this example:
57306 </para>
57307 <literallayout class="monospaced">
57308 deny  dnslists = sbl.spamhaus.org : \
57309                  list.dsbl.org : \
57310                  dnsbl.njabl.org!=127.0.0.3 : \
57311                  relays.ordb.org
57312 </literallayout>
57313 <para>
57314 Using only positive lists, this would have to be:
57315 </para>
57316 <literallayout class="monospaced">
57317 deny  dnslists = sbl.spamhaus.org : \
57318                  list.dsbl.org
57319 deny  dnslists = dnsbl.njabl.org
57320      !dnslists = dnsbl.njabl.org=127.0.0.3
57321 deny  dnslists = relays.ordb.org
57322 </literallayout>
57323 <para>
57324 which is less clear, and harder to maintain.
57325 </para>
57326 </section>
57327 <section id="SECThanmuldnsrec">
57328 <title>Handling multiple DNS records from a DNS list</title>
57329 <para>
57330 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
57331 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
57332 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
57333 the match to specific results from the DNS lookup, there are two ways in which
57334 the checking can be handled. For example, consider the condition:
57335 </para>
57336 <literallayout class="monospaced">
57337 dnslists = a.b.c=127.0.0.1
57338 </literallayout>
57339 <para>
57340 What happens if the DNS lookup for the incoming IP address yields both
57341 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
57342 condition true because at least one given value was found, or is it false
57343 because at least one of the found values was not listed? And how does this
57344 affect negated conditions? Both possibilities are provided for with the help of
57345 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
57346 </para>
57347 <itemizedlist>
57348 <listitem>
57349 <para>
57350 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
57351 IP addresses matches one of the listed addresses. For the example above, the
57352 condition is true because 127.0.0.1 matches.
57353 </para>
57354 </listitem>
57355 <listitem>
57356 <para>
57357 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
57358 looked up IP addresses matches one of the listed addresses. If the condition is
57359 changed to:
57360 </para>
57361 <literallayout class="monospaced">
57362 dnslists = a.b.c==127.0.0.1
57363 </literallayout>
57364 <para>
57365 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57366 false because 127.0.0.2 is not listed. You would need to have:
57367 </para>
57368 <literallayout class="monospaced">
57369 dnslists = a.b.c==127.0.0.1,127.0.0.2
57370 </literallayout>
57371 <para>
57372 for the condition to be true.
57373 </para>
57374 </listitem>
57375 </itemizedlist>
57376 <para>
57377 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
57378 the precise opposite of the behaviour above. Thus:
57379 </para>
57380 <itemizedlist>
57381 <listitem>
57382 <para>
57383 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
57384 addresses matches one of the listed addresses. Consider:
57385 </para>
57386 <literallayout class="monospaced">
57387 dnslists = a.b.c!&amp;0.0.0.1
57388 </literallayout>
57389 <para>
57390 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57391 false because 127.0.0.1 matches.
57392 </para>
57393 </listitem>
57394 <listitem>
57395 <para>
57396 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
57397 looked up IP address that does not match. Consider:
57398 </para>
57399 <literallayout class="monospaced">
57400 dnslists = a.b.c!=&amp;0.0.0.1
57401 </literallayout>
57402 <para>
57403 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
57404 true, because 127.0.0.2 does not match. You would need to have:
57405 </para>
57406 <literallayout class="monospaced">
57407 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
57408 </literallayout>
57409 <para>
57410 for the condition to be false.
57411 </para>
57412 </listitem>
57413 </itemizedlist>
57414 <para>
57415 When the DNS lookup yields only a single IP address, there is no difference
57416 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
57417 </para>
57418 </section>
57419 <section id="SECTmordetinf">
57420 <title>Detailed information from merged DNS lists</title>
57421 <para>
57422 <indexterm role="concept">
57423 <primary>DNS list</primary>
57424 <secondary>information from merged</secondary>
57425 </indexterm>
57426 When the facility for restricting the matching IP values in a DNS list is used,
57427 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
57428 the true reason for rejection. This happens when lists are merged and the IP
57429 address in the A record is used to distinguish them; unfortunately there is
57430 only one TXT record. One way round this is not to use merged lists, but that
57431 can be inefficient because it requires multiple DNS lookups where one would do
57432 in the vast majority of cases when the host of interest is not on any of the
57433 lists.
57434 </para>
57435 <para>
57436 A less inefficient way of solving this problem is available. If
57437 two domain names, comma-separated, are given, the second is used first to
57438 do an initial check, making use of any IP value restrictions that are set.
57439 If there is a match, the first domain is used, without any IP value
57440 restrictions, to get the TXT record. As a byproduct of this, there is also
57441 a check that the IP being tested is indeed on the first list. The first
57442 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
57443 </para>
57444 <literallayout class="monospaced">
57445 reject message  = \
57446          rejected because $sender_host_address is blacklisted \
57447          at $dnslist_domain\n$dnslist_text
57448        dnslists = \
57449          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
57450          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
57451 </literallayout>
57452 <para>
57453 For the first blacklist item, this starts by doing a lookup in
57454 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
57455 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
57456 value, and as long as something is found, it looks for the corresponding TXT
57457 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
57458 The second blacklist item is processed similarly.
57459 </para>
57460 <para>
57461 If you are interested in more than one merged list, the same list must be
57462 given several times, but because the results of the DNS lookups are cached,
57463 the DNS calls themselves are not repeated. For example:
57464 </para>
57465 <literallayout class="monospaced">
57466 reject dnslists = \
57467          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
57468          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
57469          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
57470          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
57471 </literallayout>
57472 <para>
57473 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
57474 values matches (or if no record is found), this is the only lookup that is
57475 done. Only if there is a match is one of the more specific lists consulted.
57476 </para>
57477 </section>
57478 <section id="SECTmorednslistslast">
57479 <title>DNS lists and IPv6</title>
57480 <para>
57481 <indexterm role="concept">
57482 <primary>IPv6</primary>
57483 <secondary>DNS black lists</secondary>
57484 </indexterm>
57485 <indexterm role="concept">
57486 <primary>DNS list</primary>
57487 <secondary>IPv6 usage</secondary>
57488 </indexterm>
57489 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
57490 nibble by nibble. For example, if the calling host&#x2019;s IP address is
57491 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
57492 </para>
57493 <literallayout class="monospaced">
57494 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
57495   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
57496 </literallayout>
57497 <para>
57498 (split over two lines here to fit on the page). Unfortunately, some of the DNS
57499 lists contain wildcard records, intended for IPv4, that interact badly with
57500 IPv6. For example, the DNS entry
57501 </para>
57502 <literallayout class="monospaced">
57503 *.3.some.list.example.    A    127.0.0.1
57504 </literallayout>
57505 <para>
57506 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
57507 Unfortunately, it also matches the entire 3::/4 IPv6 network.
57508 </para>
57509 <para>
57510 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
57511 <option>condition</option> condition, as in this example:
57512 </para>
57513 <literallayout class="monospaced">
57514 deny   condition = ${if isip4{$sender_host_address}}
57515        dnslists  = some.list.example
57516 </literallayout>
57517 <para>
57518 If an explicit key is being used for a DNS lookup and it may be an IPv6
57519 address you should specify alternate list separators for both the outer
57520 (DNS list name) list and inner (lookup keys) list:
57521 </para>
57522 <literallayout class="monospaced">
57523        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
57524 </literallayout>
57525 </section>
57526 <section id="SECTratelimiting">
57527 <title>Rate limiting incoming messages</title>
57528 <para>
57529 <indexterm role="concept">
57530 <primary>rate limiting</primary>
57531 <secondary>client sending</secondary>
57532 </indexterm>
57533 <indexterm role="concept">
57534 <primary>limiting client sending rates</primary>
57535 </indexterm>
57536 <indexterm role="option">
57537 <primary><option>smtp_ratelimit_*</option></primary>
57538 </indexterm>
57539 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
57540 which clients can send email. This is more powerful than the
57541 <option>smtp_ratelimit_*</option> options, because those options control the rate of
57542 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
57543 works across all connections (concurrent and sequential) from the same client
57544 host. The syntax of the <option>ratelimit</option> condition is:
57545 </para>
57546 <literallayout>
57547 <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;
57548 </literallayout>
57549 <para>
57550 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
57551 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
57552 </para>
57553 <para>
57554 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
57555 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
57556 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
57557 of <emphasis>p</emphasis>.
57558 </para>
57559 <para>
57560 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
57561 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
57562 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
57563 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
57564 send in each time interval. It also specifies the number of messages permitted
57565 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
57566 constant, you can allow a client to send more messages in a burst without
57567 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
57568 both small, messages must be sent at an even rate.
57569 </para>
57570 <para>
57571 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
57572 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
57573 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
57574 instructions when it is run with no arguments.
57575 </para>
57576 <para>
57577 The key is used to look up the data for calculating the client&#x2019;s average
57578 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
57579 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
57580 which means Exim computes the sending rate of each client host IP address.
57581 By changing the key you can change how Exim identifies clients for the purpose
57582 of ratelimiting. For example, to limit the sending rate of each authenticated
57583 user, independent of the computer they are sending from, set the key to
57584 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
57585 example, <varname>$authenticated_id</varname> is only meaningful if the client has
57586 authenticated (which you can check with the <option>authenticated</option> ACL condition).
57587 </para>
57588 <para>
57589 The lookup key does not have to identify clients: If you want to limit the
57590 rate at which a recipient receives messages, you can use the key
57591 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
57592 ACL.
57593 </para>
57594 <para>
57595 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
57596 specifies what Exim measures the rate of, for example messages or recipients
57597 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
57598 <option>count=</option> options. You can also control when Exim updates the recorded rate
57599 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
57600 separated by a slash, like the other parameters. They may appear in any order.
57601 </para>
57602 <para>
57603 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
57604 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
57605 stored, so you can alter the configured maximum rate and Exim will still
57606 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
57607 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
57608 behaviour. The lookup key is not affected by changes to the update mode and
57609 the <option>count=</option> option.
57610 </para>
57611 </section>
57612 <section id="ratoptmea">
57613 <title>Ratelimit options for what is being measured</title>
57614 <para>
57615 <indexterm role="concept">
57616 <primary>rate limiting</primary>
57617 <secondary>per_* options</secondary>
57618 </indexterm>
57619 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
57620 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
57621 <option>acl_not_smtp_start</option> ACLs.
57622 </para>
57623 <para>
57624 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
57625 the default if none of the <option>per_*</option> options is specified. It can be used in
57626 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
57627 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
57628 </para>
57629 <para>
57630 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
57631 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
57632 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
57633 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
57634 in its MAIL command, which may be inaccurate or completely missing. You can
57635 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
57636 in kilobytes, megabytes, or gigabytes, respectively.
57637 </para>
57638 <para>
57639 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
57640 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
57641 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
57642 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
57643 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
57644 in either case the rate limiting engine will see a message with many
57645 recipients as a large high-speed burst.
57646 </para>
57647 <para>
57648 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
57649 number of different recipients that the client has sent messages to in the
57650 last time period. That is, if the client repeatedly sends messages to the same
57651 recipient, its measured rate is not increased. This option can only be used in
57652 <option>acl_smtp_rcpt</option>.
57653 </para>
57654 <para>
57655 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
57656 condition is processed. This can be used to limit the rate of any SMTP
57657 command. If it is used in multiple ACLs it can limit the aggregate rate of
57658 multiple different commands.
57659 </para>
57660 <para>
57661 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
57662 measured rate. For example, the <option>per_byte</option> option is equivalent to
57663 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
57664 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
57665 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
57666 </para>
57667 <para>
57668 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
57669 </para>
57670 </section>
57671 <section id="ratoptupd">
57672 <title>Ratelimit update modes</title>
57673 <para>
57674 <indexterm role="concept">
57675 <primary>rate limiting</primary>
57676 <secondary>reading data without updating</secondary>
57677 </indexterm>
57678 You can specify one of three options with the <option>ratelimit</option> condition to
57679 control when its database is updated. This section describes the <option>readonly</option>
57680 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
57681 </para>
57682 <para>
57683 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
57684 previously-computed rate to check against the limit.
57685 </para>
57686 <para>
57687 For example, you can test the client&#x2019;s sending rate and deny it access (when
57688 it is too fast) in the connect ACL. If the client passes this check then it
57689 can go on to send a message, in which case its recorded rate will be updated
57690 in the MAIL ACL. Subsequent connections from the same client will check this
57691 new rate.
57692 </para>
57693 <literallayout class="monospaced">
57694 acl_check_connect:
57695  deny ratelimit = 100 / 5m / readonly
57696     log_message = RATE CHECK: $sender_rate/$sender_rate_period \
57697                   (max $sender_rate_limit)
57698 # ...
57699 acl_check_mail:
57700  warn ratelimit = 100 / 5m / strict
57701     log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
57702                   (max $sender_rate_limit)
57703 </literallayout>
57704 <para>
57705 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
57706 processing a message then it may increase the client&#x2019;s measured rate more than
57707 it should. For example, this will happen if you check the <option>per_rcpt</option> option
57708 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
57709 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
57710 multiple update problems by using the <option>readonly</option> option on later ratelimit
57711 checks.
57712 </para>
57713 <para>
57714 The <option>per_*</option> options described above do not make sense in some ACLs. If you
57715 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
57716 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
57717 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
57718 next section) so you must specify the <option>readonly</option> option explicitly.
57719 </para>
57720 </section>
57721 <section id="ratoptfast">
57722 <title>Ratelimit options for handling fast clients</title>
57723 <para>
57724 <indexterm role="concept">
57725 <primary>rate limiting</primary>
57726 <secondary>strict and leaky modes</secondary>
57727 </indexterm>
57728 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
57729 engine can react in two possible ways, depending on the presence of the
57730 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
57731 counter-measures (such as rejecting the message) that may be specified by the
57732 rest of the ACL.
57733 </para>
57734 <para>
57735 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
57736 updated if it is above the limit. The effect of this is that Exim measures the
57737 client&#x2019;s average rate of successfully sent email, which cannot be greater than
57738 the maximum allowed. If the client is over the limit it may suffer some
57739 counter-measures (as specified in the ACL), but it will still be able to send
57740 email at the configured maximum rate, whatever the rate of its attempts. This
57741 is generally the better choice if you have clients that retry automatically.
57742 For example, it does not prevent a sender with an over-aggressive retry rate
57743 from getting any email through.
57744 </para>
57745 <para>
57746 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
57747 updated. The effect of this is that Exim measures the client&#x2019;s average rate
57748 of attempts to send email, which can be much higher than the maximum it is
57749 actually allowed. If the client is over the limit it may be subjected to
57750 counter-measures by the ACL. It must slow down and allow sufficient time to
57751 pass that its computed rate falls below the maximum before it can send email
57752 again. The time (the number of smoothing periods) it must wait and not
57753 attempt to send mail can be calculated with this formula:
57754 </para>
57755 <literallayout class="monospaced">
57756         ln(peakrate/maxrate)
57757 </literallayout>
57758 </section>
57759 <section id="ratoptuniq">
57760 <title>Limiting the rate of different events</title>
57761 <para>
57762 <indexterm role="concept">
57763 <primary>rate limiting</primary>
57764 <secondary>counting unique events</secondary>
57765 </indexterm>
57766 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
57767 rate of different events. For example, the <option>per_addr</option> option uses this
57768 mechanism to count the number of different recipients that the client has
57769 sent messages to in the last time period; it is equivalent to
57770 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
57771 measure the rate that a client uses different sender addresses with the
57772 options <literal>per_mail/unique=$sender_address</literal>.
57773 </para>
57774 <para>
57775 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
57776 has seen for that key. The whole set is thrown away when it is older than the
57777 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
57778 per period. In the <option>leaky</option> update mode, an event that causes the client to
57779 go over the limit is not added to the set, in the same way that the client&#x2019;s
57780 recorded rate is not updated in the same situation.
57781 </para>
57782 <para>
57783 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
57784 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
57785 rate.
57786 </para>
57787 <para>
57788 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
57789 other <option>ratelimit</option> options in order to store the event set. The number of
57790 unique values is potentially as large as the rate limit, so the extra space
57791 required increases with larger limits.
57792 </para>
57793 <para>
57794 The uniqueification is not perfect: there is a small probability that Exim
57795 will think a new event has happened before. If the sender&#x2019;s rate is less than
57796 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
57797 the measured rate can go above the limit, in which case Exim may under-count
57798 events by a significant margin. Fortunately, if the rate is high enough (2.7
57799 times the limit) that the false positive rate goes above 9%, then Exim will
57800 throw away the over-full event set before the measured rate falls below the
57801 limit. Therefore the only harm should be that exceptionally high sending rates
57802 are logged incorrectly; any countermeasures you configure will be as effective
57803 as intended.
57804 </para>
57805 </section>
57806 <section id="useratlim">
57807 <title>Using rate limiting</title>
57808 <para>
57809 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
57810 when the rate limit is exceeded. This might be anything from logging a warning
57811 (for example, while measuring existing sending rates in order to define
57812 policy), through time delays to slow down fast senders, up to rejecting the
57813 message. For example:
57814 </para>
57815 <literallayout class="monospaced">
57816 # Log all senders' rates
57817 warn ratelimit = 0 / 1h / strict
57818      log_message = Sender rate $sender_rate / $sender_rate_period
57819
57820 # Slow down fast senders; note the need to truncate $sender_rate
57821 # at the decimal point.
57822 warn ratelimit = 100 / 1h / per_rcpt / strict
57823      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
57824                    $sender_rate_limit }s
57825
57826 # Keep authenticated users under control
57827 deny authenticated = *
57828      ratelimit = 100 / 1d / strict / $authenticated_id
57829
57830 # System-wide rate limit
57831 defer message = Sorry, too busy. Try again later.
57832      ratelimit = 10 / 1s / $primary_hostname
57833
57834 # Restrict incoming rate from each host, with a default
57835 # set using a macro and special cases looked up in a table.
57836 defer message = Sender rate exceeds $sender_rate_limit \
57837                messages per $sender_rate_period
57838      ratelimit = ${lookup {$sender_host_address} \
57839                    cdb {DB/ratelimits.cdb} \
57840                    {$value} {RATELIMIT} }
57841 </literallayout>
57842 <para>
57843 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
57844 especially with the <option>per_rcpt</option> option, you may suffer from a performance
57845 bottleneck caused by locking on the ratelimit hints database. Apart from
57846 making your ACLs less complicated, you can reduce the problem by using a
57847 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
57848 this means that Exim will lose its hints data after a reboot (including retry
57849 hints, the callout cache, and ratelimit data).
57850 </para>
57851 </section>
57852 <section id="SECTaddressverification">
57853 <title>Address verification</title>
57854 <para>
57855 <indexterm role="concept">
57856 <primary>verifying address</primary>
57857 <secondary>options for</secondary>
57858 </indexterm>
57859 <indexterm role="concept">
57860 <primary>policy control</primary>
57861 <secondary>address verification</secondary>
57862 </indexterm>
57863 Several of the <option>verify</option> conditions described in section
57864 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
57865 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
57866 The verification conditions can be followed by options that modify the
57867 verification process. The options are separated from the keyword and from each
57868 other by slashes, and some of them contain parameters. For example:
57869 </para>
57870 <literallayout class="monospaced">
57871 verify = sender/callout
57872 verify = recipient/defer_ok/callout=10s,defer_ok
57873 </literallayout>
57874 <para>
57875 The first stage of address verification, which always happens, is to run the
57876 address through the routers, in <quote>verify mode</quote>. Routers can detect the
57877 difference between verification and routing for delivery, and their actions can
57878 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
57879 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
57880 The available options are as follows:
57881 </para>
57882 <itemizedlist>
57883 <listitem>
57884 <para>
57885 If the <option>callout</option> option is specified, successful routing to one or more
57886 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
57887 check. Callouts and their sub-options are discussed in the next section.
57888 </para>
57889 </listitem>
57890 <listitem>
57891 <para>
57892 If there is a defer error while doing verification routing, the ACL
57893 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
57894 options, the condition is forced to be true instead. Note that this is a main
57895 verification option as well as a suboption for callouts.
57896 </para>
57897 </listitem>
57898 <listitem>
57899 <para>
57900 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
57901 discusses the reporting of sender address verification failures.
57902 </para>
57903 </listitem>
57904 <listitem>
57905 <para>
57906 The <option>success_on_redirect</option> option causes verification always to succeed
57907 immediately after a successful redirection. By default, if a redirection
57908 generates just one address, that address is also verified. See further
57909 discussion in section <xref linkend="SECTredirwhilveri"/>.
57910 </para>
57911 </listitem>
57912 </itemizedlist>
57913 <para>
57914 <indexterm role="concept">
57915 <primary>verifying address</primary>
57916 <secondary>differentiating failures</secondary>
57917 </indexterm>
57918 <indexterm role="variable">
57919 <primary><varname>$recipient_verify_failure</varname></primary>
57920 </indexterm>
57921 <indexterm role="variable">
57922 <primary><varname>$sender_verify_failure</varname></primary>
57923 </indexterm>
57924 <indexterm role="variable">
57925 <primary><varname>$acl_verify_message</varname></primary>
57926 </indexterm>
57927 After an address verification failure, <varname>$acl_verify_message</varname> contains the
57928 error message that is associated with the failure. It can be preserved by
57929 coding like this:
57930 </para>
57931 <literallayout class="monospaced">
57932 warn  !verify = sender
57933        set acl_m0 = $acl_verify_message
57934 </literallayout>
57935 <para>
57936 If you are writing your own custom rejection message or log message when
57937 denying access, you can use this variable to include information about the
57938 verification failure.
57939 </para>
57940 <para>
57941 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
57942 appropriate) contains one of the following words:
57943 </para>
57944 <itemizedlist>
57945 <listitem>
57946 <para>
57947 <option>qualify</option>: The address was unqualified (no domain), and the message
57948 was neither local nor came from an exempted host.
57949 </para>
57950 </listitem>
57951 <listitem>
57952 <para>
57953 <option>route</option>: Routing failed.
57954 </para>
57955 </listitem>
57956 <listitem>
57957 <para>
57958 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
57959 occurred at or before the MAIL command (that is, on initial
57960 connection, HELO, or MAIL).
57961 </para>
57962 </listitem>
57963 <listitem>
57964 <para>
57965 <option>recipient</option>: The RCPT command in a callout was rejected.
57966 </para>
57967 </listitem>
57968 <listitem>
57969 <para>
57970 <option>postmaster</option>: The postmaster check in a callout was rejected.
57971 </para>
57972 </listitem>
57973 </itemizedlist>
57974 <para>
57975 The main use of these variables is expected to be to distinguish between
57976 rejections of MAIL and rejections of RCPT in callouts.
57977 </para>
57978 </section>
57979 <section id="SECTcallver">
57980 <title>Callout verification</title>
57981 <para>
57982 <indexterm role="concept">
57983 <primary>verifying address</primary>
57984 <secondary>by callout</secondary>
57985 </indexterm>
57986 <indexterm role="concept">
57987 <primary>callout</primary>
57988 <secondary>verification</secondary>
57989 </indexterm>
57990 <indexterm role="concept">
57991 <primary>SMTP</primary>
57992 <secondary>callout verification</secondary>
57993 </indexterm>
57994 For non-local addresses, routing verifies the domain, but is unable to do any
57995 checking of the local part. There are situations where some means of verifying
57996 the local part is desirable. One way this can be done is to make an SMTP
57997 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
57998 a subsequent host for a recipient address, to see if the host accepts the
57999 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
58000 sender address, the callback is not to the client host that is trying to
58001 deliver the message, but to one of the hosts that accepts incoming mail for the
58002 sender&#x2019;s domain.
58003 </para>
58004 <para>
58005 Exim does not do callouts by default. If you want them to happen, you must
58006 request them by setting appropriate options on the <option>verify</option> condition, as
58007 described below. This facility should be used with care, because it can add a
58008 lot of resource usage to the cost of verifying an address. However, Exim does
58009 cache the results of callouts, which helps to reduce the cost. Details of
58010 caching are in section <xref linkend="SECTcallvercache"/>.
58011 </para>
58012 <para>
58013 Recipient callouts are usually used only between hosts that are controlled by
58014 the same administration. For example, a corporate gateway host could use
58015 callouts to check for valid recipients on an internal mailserver. A successful
58016 callout does not guarantee that a real delivery to the address would succeed;
58017 on the other hand, a failing callout does guarantee that a delivery would fail.
58018 </para>
58019 <para>
58020 If the <option>callout</option> option is present on a condition that verifies an address, a
58021 second stage of verification occurs if the address is successfully routed to
58022 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
58023 <command>manualroute</command> router, where the router specifies the hosts. However, if a
58024 router that does not set up hosts routes to an <command>smtp</command> transport with a
58025 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
58026 <option>hosts_override</option> set, its hosts are always used, whether or not the router
58027 supplies a host list.
58028 Callouts are only supported on <command>smtp</command> transports.
58029 </para>
58030 <para>
58031 The port that is used is taken from the transport, if it is specified and is a
58032 remote transport. (For routers that do verification only, no transport need be
58033 specified.) Otherwise, the default SMTP port is used. If a remote transport
58034 specifies an outgoing interface, this is used; otherwise the interface is not
58035 specified. Likewise, the text that is used for the HELO command is taken from
58036 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
58037 <varname>$smtp_active_hostname</varname> is used.
58038 </para>
58039 <para>
58040 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
58041 test whether a bounce message could be delivered to the sender address. The
58042 following SMTP commands are sent:
58043 </para>
58044 <literallayout>
58045 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
58046 <literal>MAIL FROM:&lt;&gt;</literal>
58047 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
58048 <literal>QUIT</literal>
58049 </literallayout>
58050 <para>
58051 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
58052 set to <quote>lmtp</quote>.
58053 </para>
58054 <para>
58055 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
58056 settings.
58057 </para>
58058 <para>
58059 A recipient callout check is similar. By default, it also uses an empty address
58060 for the sender. This default is chosen because most hosts do not make use of
58061 the sender address when verifying a recipient. Using the same address means
58062 that a single cache entry can be used for each recipient. Some sites, however,
58063 do make use of the sender address when verifying. These are catered for by the
58064 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
58065 </para>
58066 <para>
58067 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
58068 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
58069 Exim tries the next host, if any. If there is a problem with all the remote
58070 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
58071 <option>callout</option> option is given, in which case the condition is forced to succeed.
58072 </para>
58073 <para>
58074 <indexterm role="concept">
58075 <primary>SMTP</primary>
58076 <secondary>output flushing, disabling for callout</secondary>
58077 </indexterm>
58078 A callout may take a little time. For this reason, Exim normally flushes SMTP
58079 output before performing a callout in an ACL, to avoid unexpected timeouts in
58080 clients when the SMTP PIPELINING extension is in use. The flushing can be
58081 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
58082 </para>
58083 </section>
58084 <section id="CALLaddparcall">
58085 <title>Additional parameters for callouts</title>
58086 <para>
58087 <indexterm role="concept">
58088 <primary>callout</primary>
58089 <secondary>additional parameters for</secondary>
58090 </indexterm>
58091 The <option>callout</option> option can be followed by an equals sign and a number of
58092 optional parameters, separated by commas. For example:
58093 </para>
58094 <literallayout class="monospaced">
58095 verify = recipient/callout=10s,defer_ok
58096 </literallayout>
58097 <para>
58098 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
58099 separate verify options, is retained for backwards compatibility, but is now
58100 deprecated. The additional parameters for <option>callout</option> are as follows:
58101 </para>
58102 <variablelist>
58103 <varlistentry>
58104 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
58105 <listitem>
58106 <para>
58107 <indexterm role="concept">
58108 <primary>callout</primary>
58109 <secondary>timeout, specifying</secondary>
58110 </indexterm>
58111 This specifies the timeout that applies for the callout attempt to each host.
58112 For example:
58113 </para>
58114 <literallayout class="monospaced">
58115 verify = sender/callout=5s
58116 </literallayout>
58117 <para>
58118 The default is 30 seconds. The timeout is used for each response from the
58119 remote host. It is also used for the initial connection, unless overridden by
58120 the <option>connect</option> parameter.
58121 </para>
58122 </listitem></varlistentry>
58123 <varlistentry>
58124 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
58125 <listitem>
58126 <para>
58127 <indexterm role="concept">
58128 <primary>callout</primary>
58129 <secondary>connection timeout, specifying</secondary>
58130 </indexterm>
58131 This parameter makes it possible to set a different (usually smaller) timeout
58132 for making the SMTP connection. For example:
58133 </para>
58134 <literallayout class="monospaced">
58135 verify = sender/callout=5s,connect=1s
58136 </literallayout>
58137 <para>
58138 If not specified, this timeout defaults to the general timeout value.
58139 </para>
58140 </listitem></varlistentry>
58141 <varlistentry>
58142 <term><emphasis role="bold">defer_ok</emphasis></term>
58143 <listitem>
58144 <para>
58145 <indexterm role="concept">
58146 <primary>callout</primary>
58147 <secondary>defer, action on</secondary>
58148 </indexterm>
58149 When this parameter is present, failure to contact any host, or any other kind
58150 of temporary error, is treated as success by the ACL. However, the cache is not
58151 updated in this circumstance.
58152 </para>
58153 </listitem></varlistentry>
58154 <varlistentry>
58155 <term><emphasis role="bold">fullpostmaster</emphasis></term>
58156 <listitem>
58157 <para>
58158 <indexterm role="concept">
58159 <primary>callout</primary>
58160 <secondary>full postmaster check</secondary>
58161 </indexterm>
58162 This operates like the <option>postmaster</option> option (see below), but if the check for
58163 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
58164 accordance with the specification in RFC 2821. The RFC states that the
58165 unqualified address <emphasis>postmaster</emphasis> should be accepted.
58166 </para>
58167 </listitem></varlistentry>
58168 <varlistentry>
58169 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
58170 <listitem>
58171 <para>
58172 <indexterm role="concept">
58173 <primary>callout</primary>
58174 <secondary>sender when verifying header</secondary>
58175 </indexterm>
58176 When verifying addresses in header lines using the <option>header_sender</option>
58177 verification option, Exim behaves by default as if the addresses are envelope
58178 sender addresses from a message. Callout verification therefore tests to see
58179 whether a bounce message could be delivered, by using an empty address in the
58180 MAIL command. However, it is arguable that these addresses might never be used
58181 as envelope senders, and could therefore justifiably reject bounce messages
58182 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
58183 address to use in the MAIL command. For example:
58184 </para>
58185 <literallayout class="monospaced">
58186 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
58187 </literallayout>
58188 <para>
58189 This parameter is available only for the <option>header_sender</option> verification option.
58190 </para>
58191 </listitem></varlistentry>
58192 <varlistentry>
58193 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
58194 <listitem>
58195 <para>
58196 <indexterm role="concept">
58197 <primary>callout</primary>
58198 <secondary>overall timeout, specifying</secondary>
58199 </indexterm>
58200 This parameter sets an overall timeout for performing a callout verification.
58201 For example:
58202 </para>
58203 <literallayout class="monospaced">
58204 verify = sender/callout=5s,maxwait=30s
58205 </literallayout>
58206 <para>
58207 This timeout defaults to four times the callout timeout for individual SMTP
58208 commands. The overall timeout applies when there is more than one host that can
58209 be tried. The timeout is checked before trying the next host. This prevents
58210 very long delays if there are a large number of hosts and all are timing out
58211 (for example, when network connections are timing out).
58212 </para>
58213 </listitem></varlistentry>
58214 <varlistentry>
58215 <term><emphasis role="bold">no_cache</emphasis></term>
58216 <listitem>
58217 <para>
58218 <indexterm role="concept">
58219 <primary>callout</primary>
58220 <secondary>cache, suppressing</secondary>
58221 </indexterm>
58222 <indexterm role="concept">
58223 <primary>caching callout, suppressing</primary>
58224 </indexterm>
58225 When this parameter is given, the callout cache is neither read nor updated.
58226 </para>
58227 </listitem></varlistentry>
58228 <varlistentry>
58229 <term><emphasis role="bold">postmaster</emphasis></term>
58230 <listitem>
58231 <para>
58232 <indexterm role="concept">
58233 <primary>callout</primary>
58234 <secondary>postmaster; checking</secondary>
58235 </indexterm>
58236 When this parameter is set, a successful callout check is followed by a similar
58237 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
58238 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
58239 the postmaster check is recorded in a cache record; if it is a failure, this is
58240 used to fail subsequent callouts for the domain without a connection being
58241 made, until the cache record expires.
58242 </para>
58243 </listitem></varlistentry>
58244 <varlistentry>
58245 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
58246 <listitem>
58247 <para>
58248 The postmaster check uses an empty sender in the MAIL command by default.
58249 You can use this parameter to do a postmaster check using a different address.
58250 For example:
58251 </para>
58252 <literallayout class="monospaced">
58253 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
58254 </literallayout>
58255 <para>
58256 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
58257 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
58258 </para>
58259 <literallayout class="monospaced">
58260 require  verify = sender/callout=postmaster_mailfrom=
58261 </literallayout>
58262 <para>
58263 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
58264 account of the sender address. It is assumed that either the empty address or
58265 a fixed non-empty address will be used. All that Exim remembers is that the
58266 postmaster check for the domain succeeded or failed.
58267 </para>
58268 </listitem></varlistentry>
58269 <varlistentry>
58270 <term><emphasis role="bold">random</emphasis></term>
58271 <listitem>
58272 <para>
58273 <indexterm role="concept">
58274 <primary>callout</primary>
58275 <secondary><quote>random</quote> check</secondary>
58276 </indexterm>
58277 When this parameter is set, before doing the normal callout check, Exim does a
58278 check for a <quote>random</quote> local part at the same domain. The local part is not
58279 really random &ndash; it is defined by the expansion of the option
58280 <option>callout_random_local_part</option>, which defaults to
58281 </para>
58282 <literallayout class="monospaced">
58283 $primary_hostname-$tod_epoch-testing
58284 </literallayout>
58285 <para>
58286 The idea here is to try to determine whether the remote host accepts all local
58287 parts without checking. If it does, there is no point in doing callouts for
58288 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
58289 a cache record, and used to force the current and subsequent callout checks to
58290 succeed without a connection being made, until the cache record expires.
58291 </para>
58292 </listitem></varlistentry>
58293 <varlistentry>
58294 <term><emphasis role="bold">use_postmaster</emphasis></term>
58295 <listitem>
58296 <para>
58297 <indexterm role="concept">
58298 <primary>callout</primary>
58299 <secondary>sender for recipient check</secondary>
58300 </indexterm>
58301 This parameter applies to recipient callouts only. For example:
58302 </para>
58303 <literallayout class="monospaced">
58304 deny  !verify = recipient/callout=use_postmaster
58305 </literallayout>
58306 <para>
58307 <indexterm role="variable">
58308 <primary><varname>$qualify_domain</varname></primary>
58309 </indexterm>
58310 It causes a non-empty postmaster address to be used in the MAIL command when
58311 performing the callout for the recipient, and also for a <quote>random</quote> check if
58312 that is configured. The local part of the address is <literal>postmaster</literal> and the
58313 domain is the contents of <varname>$qualify_domain</varname>.
58314 </para>
58315 </listitem></varlistentry>
58316 <varlistentry>
58317 <term><emphasis role="bold">use_sender</emphasis></term>
58318 <listitem>
58319 <para>
58320 This option applies to recipient callouts only. For example:
58321 </para>
58322 <literallayout class="monospaced">
58323 require  verify = recipient/callout=use_sender
58324 </literallayout>
58325 <para>
58326 It causes the message&#x2019;s actual sender address to be used in the MAIL
58327 command when performing the callout, instead of an empty address. There is no
58328 need to use this option unless you know that the called hosts make use of the
58329 sender when checking recipients. If used indiscriminately, it reduces the
58330 usefulness of callout caching.
58331 </para>
58332 </listitem></varlistentry>
58333 </variablelist>
58334 <para>
58335 If you use any of the parameters that set a non-empty sender for the MAIL
58336 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
58337 <option>use_sender</option>), you should think about possible loops. Recipient checking is
58338 usually done between two hosts that are under the same management, and the host
58339 that receives the callouts is not normally configured to do callouts itself.
58340 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
58341 these circumstances.
58342 </para>
58343 <para>
58344 However, if you use a non-empty sender address for a callout to an arbitrary
58345 host, there is the likelihood that the remote host will itself initiate a
58346 callout check back to your host. As it is checking what appears to be a message
58347 sender, it is likely to use an empty address in MAIL, thus avoiding a
58348 callout loop. However, to be on the safe side it would be best to set up your
58349 own ACLs so that they do not do sender verification checks when the recipient
58350 is the address you use for header sender or postmaster callout checking.
58351 </para>
58352 <para>
58353 Another issue to think about when using non-empty senders for callouts is
58354 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
58355 by the sender/recipient combination; thus, for any given recipient, many more
58356 actual callouts are performed than when an empty sender or postmaster is used.
58357 </para>
58358 </section>
58359 <section id="SECTcallvercache">
58360 <title>Callout caching</title>
58361 <para>
58362 <indexterm role="concept">
58363 <primary>hints database</primary>
58364 <secondary>callout cache</secondary>
58365 </indexterm>
58366 <indexterm role="concept">
58367 <primary>callout</primary>
58368 <secondary>cache, description of</secondary>
58369 </indexterm>
58370 <indexterm role="concept">
58371 <primary>caching</primary>
58372 <secondary>callout</secondary>
58373 </indexterm>
58374 Exim caches the results of callouts in order to reduce the amount of resources
58375 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
58376 option. A hints database called <quote>callout</quote> is used for the cache. Two
58377 different record types are used: one records the result of a callout check for
58378 a specific address, and the other records information that applies to the
58379 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
58380 </para>
58381 <para>
58382 When an original callout fails, a detailed SMTP error message is given about
58383 the failure. However, for subsequent failures use the cache data, this message
58384 is not available.
58385 </para>
58386 <para>
58387 The expiry times for negative and positive address cache records are
58388 independent, and can be set by the global options <option>callout_negative_expire</option>
58389 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
58390 </para>
58391 <para>
58392 If a host gives a negative response to an SMTP connection, or rejects any
58393 commands up to and including
58394 </para>
58395 <literallayout class="monospaced">
58396 MAIL FROM:&lt;&gt;
58397 </literallayout>
58398 <para>
58399 (but not including the MAIL command with a non-empty address),
58400 any callout attempt is bound to fail. Exim remembers such failures in a
58401 domain cache record, which it uses to fail callouts for the domain without
58402 making new connections, until the domain record times out. There are two
58403 separate expiry times for domain cache records:
58404 <option>callout_domain_negative_expire</option> (default 3h) and
58405 <option>callout_domain_positive_expire</option> (default 7d).
58406 </para>
58407 <para>
58408 Domain records expire when the negative expiry time is reached if callouts
58409 cannot be made for the domain, or if the postmaster check failed.
58410 Otherwise, they expire when the positive expiry time is reached. This
58411 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
58412 will eventually be noticed.
58413 </para>
58414 <para>
58415 The callout caching mechanism is based on the domain of the address that is
58416 being tested. If the domain routes to several hosts, it is assumed that their
58417 behaviour will be the same.
58418 </para>
58419 </section>
58420 <section id="SECTsenaddver">
58421 <title>Sender address verification reporting</title>
58422 <para>
58423 <indexterm role="concept">
58424 <primary>verifying</primary>
58425 <secondary>suppressing error details</secondary>
58426 </indexterm>
58427 See section <xref linkend="SECTaddressverification"/> for a general discussion of
58428 verification. When sender verification fails in an ACL, the details of the
58429 failure are given as additional output lines before the 550 response to the
58430 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
58431 you might see:
58432 </para>
58433 <literallayout class="monospaced">
58434 MAIL FROM:&lt;xyz@abc.example&gt;
58435 250 OK
58436 RCPT TO:&lt;pqr@def.example&gt;
58437 550-Verification failed for &lt;xyz@abc.example&gt;
58438 550-Called:   192.168.34.43
58439 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
58440 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
58441 550 Sender verification failed
58442 </literallayout>
58443 <para>
58444 If more than one RCPT command fails in the same way, the details are given
58445 only for the first of them. However, some administrators do not want to send
58446 out this much information. You can suppress the details by adding
58447 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
58448 example:
58449 </para>
58450 <literallayout class="monospaced">
58451 verify = sender/no_details
58452 </literallayout>
58453 </section>
58454 <section id="SECTredirwhilveri">
58455 <title>Redirection while verifying</title>
58456 <para>
58457 <indexterm role="concept">
58458 <primary>verifying</primary>
58459 <secondary>redirection while</secondary>
58460 </indexterm>
58461 <indexterm role="concept">
58462 <primary>address redirection</primary>
58463 <secondary>while verifying</secondary>
58464 </indexterm>
58465 A dilemma arises when a local address is redirected by aliasing or forwarding
58466 during verification: should the generated addresses themselves be verified,
58467 or should the successful expansion of the original address be enough to verify
58468 it? By default, Exim takes the following pragmatic approach:
58469 </para>
58470 <itemizedlist>
58471 <listitem>
58472 <para>
58473 When an incoming address is redirected to just one child address, verification
58474 continues with the child address, and if that fails to verify, the original
58475 verification also fails.
58476 </para>
58477 </listitem>
58478 <listitem>
58479 <para>
58480 When an incoming address is redirected to more than one child address,
58481 verification does not continue. A success result is returned.
58482 </para>
58483 </listitem>
58484 </itemizedlist>
58485 <para>
58486 This seems the most reasonable behaviour for the common use of aliasing as a
58487 way of redirecting different local parts to the same mailbox. It means, for
58488 example, that a pair of alias entries of the form
58489 </para>
58490 <literallayout class="monospaced">
58491 A.Wol:   aw123
58492 aw123:   :fail: Gone away, no forwarding address
58493 </literallayout>
58494 <para>
58495 work as expected, with both local parts causing verification failure. When a
58496 redirection generates more than one address, the behaviour is more like a
58497 mailing list, where the existence of the alias itself is sufficient for
58498 verification to succeed.
58499 </para>
58500 <para>
58501 It is possible, however, to change the default behaviour so that all successful
58502 redirections count as successful verifications, however many new addresses are
58503 generated. This is specified by the <option>success_on_redirect</option> verification
58504 option. For example:
58505 </para>
58506 <literallayout class="monospaced">
58507 require verify = recipient/success_on_redirect/callout=10s
58508 </literallayout>
58509 <para>
58510 In this example, verification succeeds if a router generates a new address, and
58511 the callout does not occur, because no address was routed to a remote host.
58512 </para>
58513 <para>
58514 When verification is being tested via the <option>-bv</option> option, the treatment of
58515 redirections is as just described, unless the <option>-v</option> or any debugging option is
58516 also specified. In that case, full verification is done for every generated
58517 address and a report is output for each of them.
58518 </para>
58519 </section>
58520 <section id="SECTverifyCSA">
58521 <title>Client SMTP authorization (CSA)</title>
58522 <para>
58523 <indexterm role="concept">
58524 <primary>CSA</primary>
58525 <secondary>verifying</secondary>
58526 </indexterm>
58527 Client SMTP Authorization is a system that allows a site to advertise
58528 which machines are and are not permitted to send email. This is done by placing
58529 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
58530 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
58531 Authorization checks in Exim are performed by the ACL condition:
58532 </para>
58533 <literallayout class="monospaced">
58534 verify = csa
58535 </literallayout>
58536 <para>
58537 This fails if the client is not authorized. If there is a DNS problem, or if no
58538 valid CSA SRV record is found, or if the client is authorized, the condition
58539 succeeds. These three cases can be distinguished using the expansion variable
58540 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
58541 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
58542 be likely to cause problems for legitimate email.
58543 </para>
58544 <para>
58545 The error messages produced by the CSA code include slightly more
58546 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
58547 looking up the CSA SRV record, or problems looking up the CSA target
58548 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
58549 </para>
58550 <itemizedlist>
58551 <listitem>
58552 <para>
58553 The client&#x2019;s host name is explicitly not authorized.
58554 </para>
58555 </listitem>
58556 <listitem>
58557 <para>
58558 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
58559 </para>
58560 </listitem>
58561 <listitem>
58562 <para>
58563 The client&#x2019;s host name is authorized but it has no valid target IP addresses
58564 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
58565 </para>
58566 </listitem>
58567 <listitem>
58568 <para>
58569 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
58570 that all subdomains must be explicitly authorized.
58571 </para>
58572 </listitem>
58573 </itemizedlist>
58574 <para>
58575 The <option>csa</option> verification condition can take an argument which is the domain to
58576 use for the DNS query. The default is:
58577 </para>
58578 <literallayout class="monospaced">
58579 verify = csa/$sender_helo_name
58580 </literallayout>
58581 <para>
58582 This implementation includes an extension to CSA. If the query domain
58583 is an address literal such as [192.0.2.95], or if it is a bare IP
58584 address, Exim searches for CSA SRV records in the reverse DNS as if
58585 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
58586 meaningful to say:
58587 </para>
58588 <literallayout class="monospaced">
58589 verify = csa/$sender_host_address
58590 </literallayout>
58591 <para>
58592 In fact, this is the check that Exim performs if the client does not say HELO.
58593 This extension can be turned off by setting the main configuration option
58594 <option>dns_csa_use_reverse</option> to be false.
58595 </para>
58596 <para>
58597 If a CSA SRV record is not found for the domain itself, a search
58598 is performed through its parent domains for a record which might be
58599 making assertions about subdomains. The maximum depth of this search is limited
58600 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
58601 default. Exim does not look for CSA SRV records in a top level domain, so the
58602 default settings handle HELO domains as long as seven
58603 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
58604 of legitimate HELO domains.
58605 </para>
58606 <para>
58607 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
58608 direct SRV lookups, this is not sufficient because of the extra parent domain
58609 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
58610 addresses into lookups in the reverse DNS space. The result of a successful
58611 lookup such as:
58612 </para>
58613 <literallayout class="monospaced">
58614 ${lookup dnsdb {csa=$sender_helo_name}}
58615 </literallayout>
58616 <para>
58617 has two space-separated fields: an authorization code and a target host name.
58618 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
58619 authorization required but absent, or <quote>?</quote> for unknown.
58620 </para>
58621 </section>
58622 <section id="SECTverifyPRVS">
58623 <title>Bounce address tag validation</title>
58624 <para>
58625 <indexterm role="concept">
58626 <primary>BATV, verifying</primary>
58627 </indexterm>
58628 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
58629 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
58630 Genuine incoming bounce messages should therefore always be addressed to
58631 recipients that have a valid tag. This scheme is a way of detecting unwanted
58632 bounce messages caused by sender address forgeries (often called <quote>collateral
58633 spam</quote>), because the recipients of such messages do not include valid tags.
58634 </para>
58635 <para>
58636 There are two expansion items to help with the implementation of the BATV
58637 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
58638 the original envelope sender address by using a simple key to add a hash of the
58639 address and some time-based randomizing information. The <option>prvs</option> expansion
58640 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
58641 The syntax of these expansion items is described in section
58642 <xref linkend="SECTexpansionitems"/>.
58643 </para>
58644 <para>
58645 As an example, suppose the secret per-address keys are stored in an MySQL
58646 database. A query to look up the key for an address could be defined as a macro
58647 like this:
58648 </para>
58649 <literallayout class="monospaced">
58650 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
58651                 WHERE sender='${quote_mysql:$prvscheck_address}'\
58652                 }{$value}}
58653 </literallayout>
58654 <para>
58655 Suppose also that the senders who make use of BATV are defined by an address
58656 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
58657 use this:
58658 </para>
58659 <literallayout class="monospaced">
58660 # Bounces: drop unsigned addresses for BATV senders
58661 deny message = This address does not send an unsigned reverse path
58662      senders = :
58663      recipients = +batv_senders
58664
58665 # Bounces: In case of prvs-signed address, check signature.
58666 deny message = Invalid reverse path signature.
58667      senders = :
58668      condition  = ${prvscheck {$local_part@$domain}\
58669                   {PRVSCHECK_SQL}{1}}
58670      !condition = $prvscheck_result
58671 </literallayout>
58672 <para>
58673 The first statement rejects recipients for bounce messages that are addressed
58674 to plain BATV sender addresses, because it is known that BATV senders do not
58675 send out messages with plain sender addresses. The second statement rejects
58676 recipients that are prvs-signed, but with invalid signatures (either because
58677 the key is wrong, or the signature has timed out).
58678 </para>
58679 <para>
58680 A non-prvs-signed address is not rejected by the second statement, because the
58681 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
58682 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
58683 the first argument is a syntactically valid prvs-signed address, the yield is
58684 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
58685 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
58686 of the checks (empty for failure, <quote>1</quote> for success).
58687 </para>
58688 <para>
58689 There is one more issue you must consider when implementing prvs-signing:
58690 you have to ensure that the routers accept prvs-signed addresses and
58691 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
58692 router to remove the signature with a configuration along these lines:
58693 </para>
58694 <literallayout class="monospaced">
58695 batv_redirect:
58696   driver = redirect
58697   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
58698 </literallayout>
58699 <para>
58700 This works because, if the third argument of <option>prvscheck</option> is empty, the result
58701 of the expansion of a prvs-signed address is the decoded value of the original
58702 address. This router should probably be the first of your routers that handles
58703 local addresses.
58704 </para>
58705 <para>
58706 To create BATV-signed addresses in the first place, a transport of this form
58707 can be used:
58708 </para>
58709 <literallayout class="monospaced">
58710 external_smtp_batv:
58711   driver = smtp
58712   return_path = ${prvs {$return_path} \
58713                        {${lookup mysql{SELECT \
58714                        secret FROM batv_prvs WHERE \
58715                        sender='${quote_mysql:$sender_address}'} \
58716                        {$value}fail}}}
58717 </literallayout>
58718 <para>
58719 If no key can be found for the existing return path, no signing takes place.
58720 </para>
58721 </section>
58722 <section id="SECTrelaycontrol">
58723 <title>Using an ACL to control relaying</title>
58724 <para>
58725 <indexterm role="concept">
58726 <primary>access control lists (ACLs)</primary>
58727 <secondary>relay control</secondary>
58728 </indexterm>
58729 <indexterm role="concept">
58730 <primary>relaying</primary>
58731 <secondary>control by ACL</secondary>
58732 </indexterm>
58733 <indexterm role="concept">
58734 <primary>policy control</primary>
58735 <secondary>relay control</secondary>
58736 </indexterm>
58737 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
58738 delivers it directly to another host as a result of a remote address contained
58739 within it. Redirecting a local address via an alias or forward file and then
58740 passing the message on to another host is not relaying,
58741 <indexterm role="concept">
58742 <primary><quote>percent hack</quote></primary>
58743 </indexterm>
58744 but a redirection as a result of the <quote>percent hack</quote> is.
58745 </para>
58746 <para>
58747 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
58748 A host which is acting as a gateway or an MX backup is concerned with incoming
58749 relaying from arbitrary hosts to a specific set of domains. On the other hand,
58750 a host which is acting as a smart host for a number of clients is concerned
58751 with outgoing relaying from those clients to the Internet at large. Often the
58752 same host is fulfilling both functions,
58753 but in principle these two kinds of relaying are entirely independent. What is
58754 not wanted is the transmission of mail from arbitrary remote hosts through your
58755 system to arbitrary domains.
58756 </para>
58757 <para>
58758 You can implement relay control by means of suitable statements in the ACL that
58759 runs for each RCPT command. For convenience, it is often easiest to use
58760 Exim&#x2019;s named list facility to define the domains and hosts involved. For
58761 example, suppose you want to do the following:
58762 </para>
58763 <itemizedlist>
58764 <listitem>
58765 <para>
58766 Deliver a number of domains to mailboxes on the local host (or process them
58767 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
58768 <emphasis>my.dom2.example</emphasis>.
58769 </para>
58770 </listitem>
58771 <listitem>
58772 <para>
58773 Relay mail for a number of other domains for which you are the secondary MX.
58774 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
58775 </para>
58776 </listitem>
58777 <listitem>
58778 <para>
58779 Relay mail from the hosts on your local LAN, to whatever domains are involved.
58780 Suppose your LAN is 192.168.45.0/24.
58781 </para>
58782 </listitem>
58783 </itemizedlist>
58784 <para>
58785 In the main part of the configuration, you put the following definitions:
58786 </para>
58787 <literallayout class="monospaced">
58788 domainlist local_domains    = my.dom1.example : my.dom2.example
58789 domainlist relay_to_domains = friend1.example : friend2.example
58790 hostlist   relay_from_hosts = 192.168.45.0/24
58791 </literallayout>
58792 <para>
58793 Now you can use these definitions in the ACL that is run for every RCPT
58794 command:
58795 </para>
58796 <literallayout class="monospaced">
58797 acl_check_rcpt:
58798   accept domains = +local_domains : +relay_to_domains
58799   accept hosts   = +relay_from_hosts
58800 </literallayout>
58801 <para>
58802 The first statement accepts any RCPT command that contains an address in
58803 the local or relay domains. For any other domain, control passes to the second
58804 statement, which accepts the command only if it comes from one of the relay
58805 hosts. In practice, you will probably want to make your ACL more sophisticated
58806 than this, for example, by including sender and recipient verification. The
58807 default configuration includes a more comprehensive example, which is described
58808 in chapter <xref linkend="CHAPdefconfil"/>.
58809 </para>
58810 </section>
58811 <section id="SECTcheralcon">
58812 <title>Checking a relay configuration</title>
58813 <para>
58814 <indexterm role="concept">
58815 <primary>relaying</primary>
58816 <secondary>checking control of</secondary>
58817 </indexterm>
58818 You can check the relay characteristics of your configuration in the same way
58819 that you can test any ACL behaviour for an incoming SMTP connection, by using
58820 the <option>-bh</option> option to run a fake SMTP session with which you interact.
58821 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
58822 </para>
58823 </section>
58824 </chapter>
58825
58826 <chapter id="CHAPexiscan">
58827 <title>Content scanning at ACL time</title>
58828 <para>
58829 <indexterm role="concept" id="IIDcosca" class="startofrange">
58830 <primary>content scanning</primary>
58831 <secondary>at ACL time</secondary>
58832 </indexterm>
58833 The extension of Exim to include content scanning at ACL time, formerly known
58834 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
58835 was integrated into the main source for Exim release 4.50, and Tom continues to
58836 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
58837 specification.
58838 </para>
58839 <para>
58840 It is also possible to scan the content of messages at other times. The
58841 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
58842 scanning after all the ACLs have run. A transport filter can be used to scan
58843 messages at delivery time (see the <option>transport_filter</option> option, described in
58844 chapter <xref linkend="CHAPtransportgeneric"/>).
58845 </para>
58846 <para>
58847 If you want to include the ACL-time content-scanning features when you compile
58848 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
58849 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
58850 </para>
58851 <itemizedlist>
58852 <listitem>
58853 <para>
58854 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
58855 for all MIME parts for SMTP and non-SMTP messages, respectively.
58856 </para>
58857 </listitem>
58858 <listitem>
58859 <para>
58860 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
58861 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
58862 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
58863 </para>
58864 </listitem>
58865 <listitem>
58866 <para>
58867 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
58868 of messages, or parts of messages, for debugging purposes.
58869 </para>
58870 </listitem>
58871 <listitem>
58872 <para>
58873 Additional expansion variables that are set in the new ACL and by the new
58874 conditions.
58875 </para>
58876 </listitem>
58877 <listitem>
58878 <para>
58879 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
58880 </para>
58881 </listitem>
58882 </itemizedlist>
58883 <para>
58884 Content-scanning is continually evolving, and new features are still being
58885 added. While such features are still unstable and liable to incompatible
58886 changes, they are made available in Exim by setting options whose names begin
58887 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
58888 this manual. You can find out about them by reading the file called
58889 <filename>doc/experimental.txt</filename>.
58890 </para>
58891 <para>
58892 All the content-scanning facilities work on a MBOX copy of the message that is
58893 temporarily created in a file called:
58894 </para>
58895 <literallayout>
58896 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
58897 </literallayout>
58898 <para>
58899 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
58900 expect an MBOX-like structure inside that file. The file is created when the
58901 first content scanning facility is called. Subsequent calls to content
58902 scanning conditions open the same file again. The directory is recursively
58903 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
58904 </para>
58905 <literallayout class="monospaced">
58906 control = no_mbox_unspool
58907 </literallayout>
58908 <para>
58909 has been encountered. When the MIME ACL decodes files, they are put into the
58910 same directory by default.
58911 </para>
58912 <section id="SECTscanvirus">
58913 <title>Scanning for viruses</title>
58914 <para>
58915 <indexterm role="concept">
58916 <primary>virus scanning</primary>
58917 </indexterm>
58918 <indexterm role="concept">
58919 <primary>content scanning</primary>
58920 <secondary>for viruses</secondary>
58921 </indexterm>
58922 <indexterm role="concept">
58923 <primary>content scanning</primary>
58924 <secondary>the <option>malware</option> condition</secondary>
58925 </indexterm>
58926 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
58927 It supports a <quote>generic</quote> interface to scanners called via the shell, and
58928 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
58929 in memory and thus are much faster.
58930 </para>
58931 <para>
58932 A timeout of 2 minutes is applied to a scanner call (by default);
58933 if it expires then a defer action is taken.
58934 </para>
58935 <para>
58936 <indexterm role="option">
58937 <primary><option>av_scanner</option></primary>
58938 </indexterm>
58939 You can set the <option>av_scanner</option> option in the main part of the configuration
58940 to specify which scanner to use, together with any additional options that
58941 are needed. The basic syntax is as follows:
58942 </para>
58943 <literallayout>
58944 <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>
58945 </literallayout>
58946 <para>
58947 If you do not set <option>av_scanner</option>, it defaults to
58948 </para>
58949 <literallayout class="monospaced">
58950 av_scanner = sophie:/var/run/sophie
58951 </literallayout>
58952 <para>
58953 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
58954 before use.
58955 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
58956 The following scanner types are supported in this release:
58957 </para>
58958 <variablelist>
58959 <varlistentry>
58960 <term><option>avast</option></term>
58961 <listitem>
58962 <para>
58963 <indexterm role="concept">
58964 <primary>virus scanners</primary>
58965 <secondary>avast</secondary>
58966 </indexterm>
58967 This is the scanner daemon of Avast. It has been tested with Avast Core
58968 Security (currently at version 1.1.7).
58969 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
58970 at <emphasis role="bold"><ulink url="http://www.avast.com/linux-server-antivirus">http://www.avast.com/linux-server-antivirus</ulink></emphasis>.
58971 This scanner type takes one option,
58972 which can be either a full path to a UNIX socket,
58973 or host and port specifiers separated by white space.
58974 The host may be a name or an IP address; the port is either a
58975 single number or a pair of numbers with a dash between.
58976 Any further options are given, on separate lines,
58977 to the daemon as options before the main scan command.
58978 For example:
58979 </para>
58980 <literallayout class="monospaced">
58981 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
58982 av_scanner = avast:192.168.2.22 5036
58983 </literallayout>
58984 <para>
58985 If you omit the argument, the default path
58986 <filename>/var/run/avast/scan.sock</filename>
58987 is used.
58988 If you use a remote host,
58989 you need to make Exim&#x2019;s spool directory available to it,
58990 as the scanner is passed a file path, not file contents.
58991 For information about available commands and their options you may use
58992 </para>
58993 <literallayout class="monospaced">
58994 $ socat UNIX:/var/run/avast/scan.sock STDIO:
58995     FLAGS
58996     SENSITIVITY
58997     PACK
58998 </literallayout>
58999 </listitem></varlistentry>
59000 <varlistentry>
59001 <term><option>aveserver</option></term>
59002 <listitem>
59003 <para>
59004 <indexterm role="concept">
59005 <primary>virus scanners</primary>
59006 <secondary>Kaspersky</secondary>
59007 </indexterm>
59008 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
59009 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
59010 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
59011 example:
59012 </para>
59013 <literallayout class="monospaced">
59014 av_scanner = aveserver:/var/run/aveserver
59015 </literallayout>
59016 </listitem></varlistentry>
59017 <varlistentry>
59018 <term><option>clamd</option></term>
59019 <listitem>
59020 <para>
59021 <indexterm role="concept">
59022 <primary>virus scanners</primary>
59023 <secondary>clamd</secondary>
59024 </indexterm>
59025 This daemon-type scanner is GPL and free. You can get it at
59026 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
59027 unpack MIME containers, so it used to be recommended to unpack MIME attachments
59028 in the MIME ACL. This is no longer believed to be necessary.
59029 </para>
59030 <para>
59031 The options are a list of server specifiers, which may be
59032 a UNIX socket specification,
59033 a TCP socket specification,
59034 or a (global) option.
59035 </para>
59036 <para>
59037 A socket specification consists of a space-separated list.
59038 For a Unix socket the first element is a full path for the socket,
59039 for a TCP socket the first element is the IP address
59040 and the second a port number,
59041 Any further elements are per-server (non-global) options.
59042 These per-server options are supported:
59043 </para>
59044 <literallayout class="monospaced">
59045 retry=&lt;timespec&gt;  Retry on connect fail
59046 </literallayout>
59047 <para>
59048 The <literal>retry</literal> option specifies a time after which a single retry for
59049 a failed connect is made.  The default is to not retry.
59050 </para>
59051 <para>
59052 If a Unix socket file is specified, only one server is supported.
59053 </para>
59054 <para>
59055 Examples:
59056 </para>
59057 <literallayout class="monospaced">
59058 av_scanner = clamd:/opt/clamd/socket
59059 av_scanner = clamd:192.0.2.3 1234
59060 av_scanner = clamd:192.0.2.3 1234:local
59061 av_scanner = clamd:192.0.2.3 1234 retry=10s
59062 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
59063 </literallayout>
59064 <para>
59065 If the value of av_scanner points to a UNIX socket file or contains the
59066 <literal>local</literal>
59067 option, then the ClamAV interface will pass a filename containing the data
59068 to be scanned, which will should normally result in less I/O happening and be
59069 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
59070 Exim does not assume that there is a common filesystem with the remote host.
59071 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
59072 you be running a version of ClamAV prior to 0.95.
59073 </para>
59074 <para>
59075 The final example shows that multiple TCP targets can be specified.  Exim will
59076 randomly use one for each incoming email (i.e. it load balances them).  Note
59077 that only TCP targets may be used if specifying a list of scanners; a UNIX
59078 socket cannot be mixed in with TCP targets.  If one of the servers becomes
59079 unavailable, Exim will try the remaining one(s) until it finds one that works.
59080 When a clamd server becomes unreachable, Exim will log a message.  Exim does
59081 not keep track of scanner state between multiple messages, and the scanner
59082 selection is random, so the message will get logged in the mainlog for each
59083 email that the down scanner gets chosen first (message wrapped to be readable):
59084 </para>
59085 <literallayout class="monospaced">
59086 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
59087    clamd: connection to localhost, port 3310 failed
59088    (Connection refused)
59089 </literallayout>
59090 <para>
59091 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
59092 contributing the code for this scanner.
59093 </para>
59094 </listitem></varlistentry>
59095 <varlistentry>
59096 <term><option>cmdline</option></term>
59097 <listitem>
59098 <para>
59099 <indexterm role="concept">
59100 <primary>virus scanners</primary>
59101 <secondary>command line interface</secondary>
59102 </indexterm>
59103 This is the keyword for the generic command line scanner interface. It can be
59104 used to attach virus scanners that are invoked from the shell. This scanner
59105 type takes 3 mandatory options:
59106 </para>
59107 <orderedlist numeration="arabic">
59108 <listitem>
59109 <para>
59110 The full path and name of the scanner binary, with all command line options,
59111 and a placeholder (<literal>%s</literal>) for the directory to scan.
59112 </para>
59113 </listitem>
59114 <listitem>
59115 <para>
59116 A regular expression to match against the STDOUT and STDERR output of the
59117 virus scanner. If the expression matches, a virus was found. You must make
59118 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
59119 the <quote>trigger</quote> expression.
59120 </para>
59121 </listitem>
59122 <listitem>
59123 <para>
59124 Another regular expression, containing exactly one pair of parentheses, to
59125 match the name of the virus found in the scanners output. This is called the
59126 <quote>name</quote> expression.
59127 </para>
59128 </listitem>
59129 </orderedlist>
59130 <para>
59131 For example, Sophos Sweep reports a virus on a line like this:
59132 </para>
59133 <literallayout class="monospaced">
59134 Virus 'W32/Magistr-B' found in file ./those.bat
59135 </literallayout>
59136 <para>
59137 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
59138 name expression, we want to extract the W32/Magistr-B string, so we can match
59139 for the single quotes left and right of it. Altogether, this makes the
59140 configuration setting:
59141 </para>
59142 <literallayout class="monospaced">
59143 av_scanner = cmdline:\
59144              /path/to/sweep -ss -all -rec -archive %s:\
59145              found in file:'(.+)'
59146 </literallayout>
59147 </listitem></varlistentry>
59148 <varlistentry>
59149 <term><option>drweb</option></term>
59150 <listitem>
59151 <para>
59152 <indexterm role="concept">
59153 <primary>virus scanners</primary>
59154 <secondary>DrWeb</secondary>
59155 </indexterm>
59156 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface
59157 takes one option,
59158 either a full path to a UNIX socket,
59159 or host and port specifiers separated by white space.
59160 The host may be a name or an IP address; the port is either a
59161 single number or a pair of numbers with a dash between.
59162 For example:
59163 </para>
59164 <literallayout class="monospaced">
59165 av_scanner = drweb:/var/run/drwebd.sock
59166 av_scanner = drweb:192.168.2.20 31337
59167 </literallayout>
59168 <para>
59169 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
59170 is used. Thanks to Alex Miller for contributing the code for this scanner.
59171 </para>
59172 </listitem></varlistentry>
59173 <varlistentry>
59174 <term><option>f-protd</option></term>
59175 <listitem>
59176 <para>
59177 <indexterm role="concept">
59178 <primary>virus scanners</primary>
59179 <secondary>f-protd</secondary>
59180 </indexterm>
59181 The f-protd scanner is accessed via HTTP over TCP.
59182 One argument is taken, being a space-separated hostname and port number
59183 (or port-range).
59184 For example:
59185 </para>
59186 <literallayout class="monospaced">
59187 av_scanner = f-protd:localhost 10200-10204
59188 </literallayout>
59189 <para>
59190 If you omit the argument, the default values show above are used.
59191 </para>
59192 </listitem></varlistentry>
59193 <varlistentry>
59194 <term><option>fsecure</option></term>
59195 <listitem>
59196 <para>
59197 <indexterm role="concept">
59198 <primary>virus scanners</primary>
59199 <secondary>F-Secure</secondary>
59200 </indexterm>
59201 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
59202 argument which is the path to a UNIX socket. For example:
59203 </para>
59204 <literallayout class="monospaced">
59205 av_scanner = fsecure:/path/to/.fsav
59206 </literallayout>
59207 <para>
59208 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
59209 Thelmen for contributing the code for this scanner.
59210 </para>
59211 </listitem></varlistentry>
59212 <varlistentry>
59213 <term><option>kavdaemon</option></term>
59214 <listitem>
59215 <para>
59216 <indexterm role="concept">
59217 <primary>virus scanners</primary>
59218 <secondary>Kaspersky</secondary>
59219 </indexterm>
59220 This is the scanner daemon of Kaspersky Version 4. This version of the
59221 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
59222 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
59223 For example:
59224 </para>
59225 <literallayout class="monospaced">
59226 av_scanner = kavdaemon:/opt/AVP/AvpCtl
59227 </literallayout>
59228 <para>
59229 The default path is <filename>/var/run/AvpCtl</filename>.
59230 </para>
59231 </listitem></varlistentry>
59232 <varlistentry>
59233 <term><option>mksd</option></term>
59234 <listitem>
59235 <para>
59236 <indexterm role="concept">
59237 <primary>virus scanners</primary>
59238 <secondary>mksd</secondary>
59239 </indexterm>
59240 This is a daemon type scanner that is aimed mainly at Polish users, though some
59241 parts of documentation are now available in English. You can get it at
59242 <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
59243 the maximum number of processes used simultaneously to scan the attachments,
59244 provided that mksd has
59245 been run with at least the same number of child processes. For example:
59246 </para>
59247 <literallayout class="monospaced">
59248 av_scanner = mksd:2
59249 </literallayout>
59250 <para>
59251 You can safely omit this option (the default value is 1).
59252 </para>
59253 </listitem></varlistentry>
59254 <varlistentry>
59255 <term><option>sock</option></term>
59256 <listitem>
59257 <para>
59258 <indexterm role="concept">
59259 <primary>virus scanners</primary>
59260 <secondary>simple socket-connected</secondary>
59261 </indexterm>
59262 This is a general-purpose way of talking to simple scanner daemons
59263 running on the local machine.
59264 There are four options:
59265 an address (which may be an IP address and port, or the path of a Unix socket),
59266 a commandline to send (may include a single %s which will be replaced with
59267 the path to the mail file to be scanned),
59268 an RE to trigger on from the returned data,
59269 an RE to extract malware_name from the returned data.
59270 For example:
59271 </para>
59272 <literallayout class="monospaced">
59273 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)\$
59274 </literallayout>
59275 <para>
59276 Default for the socket specifier is <filename>/tmp/malware.sock</filename>.
59277 Default for the commandline is <filename>%s\n</filename>.
59278 Both regular-expressions are required.
59279 </para>
59280 </listitem></varlistentry>
59281 <varlistentry>
59282 <term><option>sophie</option></term>
59283 <listitem>
59284 <para>
59285 <indexterm role="concept">
59286 <primary>virus scanners</primary>
59287 <secondary>Sophos and Sophie</secondary>
59288 </indexterm>
59289 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
59290 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
59291 for this scanner type is the path to the UNIX socket that Sophie uses for
59292 client communication. For example:
59293 </para>
59294 <literallayout class="monospaced">
59295 av_scanner = sophie:/tmp/sophie
59296 </literallayout>
59297 <para>
59298 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
59299 the option.
59300 </para>
59301 </listitem></varlistentry>
59302 </variablelist>
59303 <para>
59304 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
59305 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
59306 ACL.
59307 </para>
59308 <para>
59309 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
59310 makes it possible to use different scanners. See further below for an example.
59311 The <option>malware</option> condition caches its results, so when you use it multiple times
59312 for the same message, the actual scanning process is only carried out once.
59313 However, using expandable items in <option>av_scanner</option> disables this caching, in
59314 which case each use of the <option>malware</option> condition causes a new scan of the
59315 message.
59316 </para>
59317 <para>
59318 The <option>malware</option> condition takes a right-hand argument that is expanded before
59319 use and taken as a list, slash-separated by default.
59320 The first element can then be one of
59321 </para>
59322 <itemizedlist>
59323 <listitem>
59324 <para>
59325 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
59326 The condition succeeds if a virus was found, and fail otherwise. This is the
59327 recommended usage.
59328 </para>
59329 </listitem>
59330 <listitem>
59331 <para>
59332 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
59333 the condition fails immediately.
59334 </para>
59335 </listitem>
59336 <listitem>
59337 <para>
59338 A regular expression, in which case the message is scanned for viruses. The
59339 condition succeeds if a virus is found and its name matches the regular
59340 expression. This allows you to take special actions on certain types of virus.
59341 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
59342 unless the separator is changed (in the usual way).
59343 </para>
59344 </listitem>
59345 </itemizedlist>
59346 <para>
59347 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
59348 messages even if there is a problem with the virus scanner.
59349 Otherwise, such a problem causes the ACL to defer.
59350 </para>
59351 <para>
59352 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
59353 specify a non-default timeout.  The default is two minutes.
59354 For example:
59355 </para>
59356 <literallayout class="monospaced">
59357 malware = * / defer_ok / tmo=10s
59358 </literallayout>
59359 <para>
59360 A timeout causes the ACL to defer.
59361 </para>
59362 <para>
59363 <indexterm role="variable">
59364 <primary><varname>$callout_address</varname></primary>
59365 </indexterm>
59366 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
59367 is set to record the actual address used.
59368 </para>
59369 <para>
59370 <indexterm role="variable">
59371 <primary><varname>$malware_name</varname></primary>
59372 </indexterm>
59373 When a virus is found, the condition sets up an expansion variable called
59374 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
59375 <option>message</option> modifier that specifies the error returned to the sender, and/or in
59376 logging data.
59377 </para>
59378 <para>
59379 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
59380 imposed by your anti-virus scanner.
59381 </para>
59382 <para>
59383 Here is a very simple scanning example:
59384 </para>
59385 <literallayout class="monospaced">
59386 deny message = This message contains malware ($malware_name)
59387      malware = *
59388 </literallayout>
59389 <para>
59390 The next example accepts messages when there is a problem with the scanner:
59391 </para>
59392 <literallayout class="monospaced">
59393 deny message = This message contains malware ($malware_name)
59394      malware = */defer_ok
59395 </literallayout>
59396 <para>
59397 The next example shows how to use an ACL variable to scan with both sophie and
59398 aveserver. It assumes you have set:
59399 </para>
59400 <literallayout class="monospaced">
59401 av_scanner = $acl_m0
59402 </literallayout>
59403 <para>
59404 in the main Exim configuration.
59405 </para>
59406 <literallayout class="monospaced">
59407 deny message = This message contains malware ($malware_name)
59408      set acl_m0 = sophie
59409      malware = *
59410
59411 deny message = This message contains malware ($malware_name)
59412      set acl_m0 = aveserver
59413      malware = *
59414 </literallayout>
59415 </section>
59416 <section id="SECTscanspamass">
59417 <title>Scanning with SpamAssassin and Rspamd</title>
59418 <para>
59419 <indexterm role="concept">
59420 <primary>content scanning</primary>
59421 <secondary>for spam</secondary>
59422 </indexterm>
59423 <indexterm role="concept">
59424 <primary>spam scanning</primary>
59425 </indexterm>
59426 <indexterm role="concept">
59427 <primary>SpamAssassin</primary>
59428 </indexterm>
59429 <indexterm role="concept">
59430 <primary>Rspamd</primary>
59431 </indexterm>
59432 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
59433 score and a report for the message.
59434 Support is also provided for Rspamd.
59435 </para>
59436 <para>
59437 For more information about installation and configuration of SpamAssassin or
59438 Rspamd refer to their respective websites at
59439 <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>
59440 </para>
59441 <para>
59442 SpamAssassin can be installed with CPAN by running:
59443 </para>
59444 <literallayout class="monospaced">
59445 perl -MCPAN -e 'install Mail::SpamAssassin'
59446 </literallayout>
59447 <para>
59448 SpamAssassin has its own set of configuration files. Please review its
59449 documentation to see how you can tweak it. The default installation should work
59450 nicely, however.
59451 </para>
59452 <para>
59453 <indexterm role="option">
59454 <primary><option>spamd_address</option></primary>
59455 </indexterm>
59456 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
59457 intend to use an instance running on the local host you do not need to set
59458 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
59459 you must set the <option>spamd_address</option> option in the global part of the Exim
59460 configuration as follows (example):
59461 </para>
59462 <literallayout class="monospaced">
59463 spamd_address = 192.168.99.45 387
59464 </literallayout>
59465 <para>
59466 The SpamAssassin protocol relies on a TCP half-close from the client.
59467 If your SpamAssassin client side is running a Linux system with an
59468 iptables firewall, consider setting
59469 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
59470 timeout, Exim uses when waiting for a response from the SpamAssassin
59471 server (currently defaulting to 120s).  With a lower value the Linux
59472 connection tracking may consider your half-closed connection as dead too
59473 soon.
59474 </para>
59475 <para>
59476 To use Rspamd (which by default listens on all local addresses
59477 on TCP port 11333)
59478 you should add <option>variant=rspamd</option> after the address/port pair, for example:
59479 </para>
59480 <literallayout class="monospaced">
59481 spamd_address = 127.0.0.1 11333 variant=rspamd
59482 </literallayout>
59483 <para>
59484 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
59485 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
59486 file name instead of an address/port pair:
59487 </para>
59488 <literallayout class="monospaced">
59489 spamd_address = /var/run/spamd_socket
59490 </literallayout>
59491 <para>
59492 You can have multiple <option>spamd</option> servers to improve scalability. These can
59493 reside on other hardware reachable over the network. To specify multiple
59494 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
59495 option, separated with colons (the separator can be changed in the usual way):
59496 </para>
59497 <literallayout class="monospaced">
59498 spamd_address = 192.168.2.10 783 : \
59499                 192.168.2.11 783 : \
59500                 192.168.2.12 783
59501 </literallayout>
59502 <para>
59503 Up to 32 <option>spamd</option> servers are supported.
59504 When a server fails to respond to the connection attempt, all other
59505 servers are tried until one succeeds. If no server responds, the <option>spam</option>
59506 condition defers.
59507 </para>
59508 <para>
59509 Unix and TCP socket specifications may be mixed in any order.
59510 Each element of the list is a list itself, space-separated by default
59511 and changeable in the usual way; take care to not double the separator.
59512 </para>
59513 <para>
59514 For TCP socket specifications a host name or IP (v4 or v6, but
59515 subject to list-separator quoting rules) address can be used,
59516 and the port can be one or a dash-separated pair.
59517 In the latter case, the range is tried in strict order.
59518 </para>
59519 <para>
59520 Elements after the first for Unix sockets, or second for TCP socket,
59521 are options.
59522 The supported options are:
59523 </para>
59524 <literallayout class="monospaced">
59525 pri=&lt;priority&gt;      Selection priority
59526 weight=&lt;value&gt;      Selection bias
59527 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
59528 retry=&lt;timespec&gt;    Retry on connect fail
59529 tmo=&lt;timespec&gt;      Connection time limit
59530 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
59531 </literallayout>
59532 <para>
59533 The <literal>pri</literal> option specifies a priority for the server within the list,
59534 higher values being tried first.
59535 The default priority is 1.
59536 </para>
59537 <para>
59538 The <literal>weight</literal> option specifies a selection bias.
59539 Within a priority set
59540 servers are queried in a random fashion, weighted by this value.
59541 The default value for selection bias is 1.
59542 </para>
59543 <para>
59544 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
59545 in the local time zone; each element being one or more digits.
59546 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
59547 characters, may be omitted and will be taken as zero.
59548 </para>
59549 <para>
59550 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
59551 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
59552 </para>
59553 <para>
59554 The <literal>tmo</literal> option specifies an overall timeout for communication.
59555 The default value is two minutes.
59556 </para>
59557 <para>
59558 The <literal>retry</literal> option specifies a time after which a single retry for
59559 a failed connect is made.
59560 The default is to not retry.
59561 </para>
59562 <para>
59563 The <option>spamd_address</option> variable is expanded before use if it starts with
59564 a dollar sign. In this case, the expansion may return a string that is
59565 used as the list so that multiple spamd servers can be the result of an
59566 expansion.
59567 </para>
59568 <para>
59569 <indexterm role="variable">
59570 <primary><varname>$callout_address</varname></primary>
59571 </indexterm>
59572 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
59573 is set to record the actual address used.
59574 </para>
59575 </section>
59576 <section id="SECID206">
59577 <title>Calling SpamAssassin from an Exim ACL</title>
59578 <para>
59579 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
59580 </para>
59581 <literallayout class="monospaced">
59582 deny message = This message was classified as SPAM
59583      spam = joe
59584 </literallayout>
59585 <para>
59586 The right-hand side of the <option>spam</option> condition specifies a name. This is
59587 relevant if you have set up multiple SpamAssassin profiles. If you do not want
59588 to scan using a specific profile, but rather use the SpamAssassin system-wide
59589 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
59590 Rspamd does not use this setting. However, you must put something on the
59591 right-hand side.
59592 </para>
59593 <para>
59594 The name allows you to use per-domain or per-user antispam profiles in
59595 principle, but this is not straightforward in practice, because a message may
59596 have multiple recipients, not necessarily all in the same domain. Because the
59597 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
59598 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
59599 are not set.
59600 Careful enforcement of single-recipient messages
59601 (e.g. by responding with defer in the recipient ACL for all recipients
59602 after the first),
59603 or the use of PRDR,
59604 <indexterm role="concept">
59605 <primary>PRDR</primary>
59606 <secondary>use for per-user SpamAssassin profiles</secondary>
59607 </indexterm>
59608 are needed to use this feature.
59609 </para>
59610 <para>
59611 The right-hand side of the <option>spam</option> condition is expanded before being used, so
59612 you can put lookups or conditions there. When the right-hand side evaluates to
59613 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
59614 </para>
59615 <para>
59616 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
59617 large ones may cause significant performance degradation. As most spam messages
59618 are quite small, it is recommended that you do not scan the big ones. For
59619 example:
59620 </para>
59621 <literallayout class="monospaced">
59622 deny message = This message was classified as SPAM
59623      condition = ${if &lt; {$message_size}{10K}}
59624      spam = nobody
59625 </literallayout>
59626 <para>
59627 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
59628 SpamAssassin profile has been matched or exceeded. If you want to use the
59629 <option>spam</option> condition for its side effects (see the variables below), you can make
59630 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
59631 </para>
59632 <para>
59633 <indexterm role="concept">
59634 <primary>spam scanning</primary>
59635 <secondary>returned variables</secondary>
59636 </indexterm>
59637 When the <option>spam</option> condition is run, it sets up a number of expansion
59638 variables.
59639 Except for <varname>$spam_report</varname>,
59640 these variables are saved with the received message so are
59641 available for use at delivery time.
59642 </para>
59643 <variablelist>
59644 <varlistentry>
59645 <term><varname>$spam_score</varname></term>
59646 <listitem>
59647 <para>
59648 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
59649 for inclusion in log or reject messages.
59650 </para>
59651 </listitem></varlistentry>
59652 <varlistentry>
59653 <term><varname>$spam_score_int</varname></term>
59654 <listitem>
59655 <para>
59656 The spam score of the message, multiplied by ten, as an integer value. For
59657 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
59658 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
59659 The integer value is useful for numeric comparisons in conditions.
59660 </para>
59661 </listitem></varlistentry>
59662 <varlistentry>
59663 <term><varname>$spam_bar</varname></term>
59664 <listitem>
59665 <para>
59666 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
59667 integer part of the spam score value. A spam score of 4.4 would have a
59668 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
59669 headers, since MUAs can match on such strings. The maximum length of the
59670 spam bar is 50 characters.
59671 </para>
59672 </listitem></varlistentry>
59673 <varlistentry>
59674 <term><varname>$spam_report</varname></term>
59675 <listitem>
59676 <para>
59677 A multiline text table, containing the full SpamAssassin report for the
59678 message. Useful for inclusion in headers or reject messages.
59679 This variable is only usable in a DATA-time ACL.
59680 Beware that SpamAssassin may return non-ASCII characters, especially
59681 when running in country-specific locales, which are not legal
59682 unencoded in headers.
59683 </para>
59684 </listitem></varlistentry>
59685 <varlistentry>
59686 <term><varname>$spam_action</varname></term>
59687 <listitem>
59688 <para>
59689 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
59690 spam score versus threshold.
59691 For Rspamd, the recommended action.
59692 </para>
59693 </listitem></varlistentry>
59694 </variablelist>
59695 <para>
59696 The <option>spam</option> condition caches its results unless expansion in
59697 spamd_address was used. If you call it again with the same user name, it
59698 does not scan again, but rather returns the same values as before.
59699 </para>
59700 <para>
59701 The <option>spam</option> condition returns DEFER if there is any error while running
59702 the message through SpamAssassin or if the expansion of spamd_address
59703 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
59704 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
59705 spam condition, like this:
59706 </para>
59707 <literallayout class="monospaced">
59708 deny message = This message was classified as SPAM
59709      spam    = joe/defer_ok
59710 </literallayout>
59711 <para>
59712 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
59713 </para>
59714 <para>
59715 Here is a longer, commented example of the use of the <option>spam</option>
59716 condition:
59717 </para>
59718 <literallayout class="monospaced">
59719 # put headers in all messages (no matter if spam or not)
59720 warn  spam = nobody:true
59721       add_header = X-Spam-Score: $spam_score ($spam_bar)
59722       add_header = X-Spam-Report: $spam_report
59723
59724 # add second subject line with *SPAM* marker when message
59725 # is over threshold
59726 warn  spam = nobody
59727       add_header = Subject: *SPAM* $h_Subject:
59728
59729 # reject spam at high scores (&gt; 12)
59730 deny  message = This message scored $spam_score spam points.
59731       spam = nobody:true
59732       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
59733 </literallayout>
59734 </section>
59735 <section id="SECTscanmimepart">
59736 <title>Scanning MIME parts</title>
59737 <para>
59738 <indexterm role="concept">
59739 <primary>content scanning</primary>
59740 <secondary>MIME parts</secondary>
59741 </indexterm>
59742 <indexterm role="concept">
59743 <primary>MIME content scanning</primary>
59744 </indexterm>
59745 <indexterm role="option">
59746 <primary><option>acl_smtp_mime</option></primary>
59747 </indexterm>
59748 <indexterm role="option">
59749 <primary><option>acl_not_smtp_mime</option></primary>
59750 </indexterm>
59751 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
59752 each MIME part of an SMTP message, including multipart types, in the sequence
59753 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
59754 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
59755 options may both refer to the same ACL if you want the same processing in both
59756 cases.
59757 </para>
59758 <para>
59759 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
59760 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
59761 the case of a non-SMTP message. However, a MIME ACL is called only if the
59762 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
59763 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
59764 result code is sent to the client. In the case of an SMTP message, the
59765 <option>acl_smtp_data</option> ACL is not called when this happens.
59766 </para>
59767 <para>
59768 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
59769 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
59770 condition to match against the raw MIME part. You can also use the
59771 <option>mime_regex</option> condition to match against the decoded MIME part (see section
59772 <xref linkend="SECTscanregex"/>).
59773 </para>
59774 <para>
59775 At the start of a MIME ACL, a number of variables are set from the header
59776 information for the relevant MIME part. These are described below. The contents
59777 of the MIME part are not by default decoded into a disk file except for MIME
59778 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
59779 part into a disk file, you can use the <option>decode</option> condition. The general
59780 syntax is:
59781 </para>
59782 <literallayout>
59783 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
59784 </literallayout>
59785 <para>
59786 The right hand side is expanded before use. After expansion,
59787 the value can be:
59788 </para>
59789 <orderedlist numeration="arabic">
59790 <listitem>
59791 <para>
59792 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
59793 </para>
59794 </listitem>
59795 <listitem>
59796 <para>
59797 The string <quote>default</quote>. In that case, the file is put in the temporary
59798 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
59799 a sequential file name consisting of the message id and a sequence number. The
59800 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
59801 </para>
59802 </listitem>
59803 <listitem>
59804 <para>
59805 A full path name starting with a slash. If the full name is an existing
59806 directory, it is used as a replacement for the default directory. The filename
59807 is then sequentially assigned. If the path does not exist, it is used as
59808 the full path and file name.
59809 </para>
59810 </listitem>
59811 <listitem>
59812 <para>
59813 If the string does not start with a slash, it is used as the
59814 filename, and the default path is then used.
59815 </para>
59816 </listitem>
59817 </orderedlist>
59818 <para>
59819 The <option>decode</option> condition normally succeeds. It is only false for syntax
59820 errors or unusual circumstances such as memory shortages. You can easily decode
59821 a file with its original, proposed filename using
59822 </para>
59823 <literallayout class="monospaced">
59824 decode = $mime_filename
59825 </literallayout>
59826 <para>
59827 However, you should keep in mind that <varname>$mime_filename</varname> might contain
59828 anything. If you place files outside of the default path, they are not
59829 automatically unlinked.
59830 </para>
59831 <para>
59832 For RFC822 attachments (these are messages attached to messages, with a
59833 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
59834 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
59835 variable is set (see below). Attached messages are always decoded to disk
59836 before being checked, and the files are unlinked once the check is done.
59837 </para>
59838 <para>
59839 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
59840 used to match regular expressions against raw and decoded MIME parts,
59841 respectively. They are described in section <xref linkend="SECTscanregex"/>.
59842 </para>
59843 <para>
59844 <indexterm role="concept">
59845 <primary>MIME content scanning</primary>
59846 <secondary>returned variables</secondary>
59847 </indexterm>
59848 The following list describes all expansion variables that are
59849 available in the MIME ACL:
59850 </para>
59851 <variablelist>
59852 <varlistentry>
59853 <term><varname>$mime_boundary</varname></term>
59854 <listitem>
59855 <para>
59856 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
59857 have a boundary string, which is stored in this variable. If the current part
59858 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
59859 contains the empty string.
59860 </para>
59861 </listitem></varlistentry>
59862 <varlistentry>
59863 <term><varname>$mime_charset</varname></term>
59864 <listitem>
59865 <para>
59866 This variable contains the character set identifier, if one was found in the
59867 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
59868 </para>
59869 <literallayout class="monospaced">
59870 us-ascii
59871 gb2312 (Chinese)
59872 iso-8859-1
59873 </literallayout>
59874 <para>
59875 Please note that this value is not normalized, so you should do matches
59876 case-insensitively.
59877 </para>
59878 </listitem></varlistentry>
59879 <varlistentry>
59880 <term><varname>$mime_content_description</varname></term>
59881 <listitem>
59882 <para>
59883 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
59884 header. It can contain a human-readable description of the parts content. Some
59885 implementations repeat the filename for attachments here, but they are usually
59886 only used for display purposes.
59887 </para>
59888 </listitem></varlistentry>
59889 <varlistentry>
59890 <term><varname>$mime_content_disposition</varname></term>
59891 <listitem>
59892 <para>
59893 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
59894 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
59895 </para>
59896 </listitem></varlistentry>
59897 <varlistentry>
59898 <term><varname>$mime_content_id</varname></term>
59899 <listitem>
59900 <para>
59901 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
59902 This is a unique ID that can be used to reference a part from another part.
59903 </para>
59904 </listitem></varlistentry>
59905 <varlistentry>
59906 <term><varname>$mime_content_size</varname></term>
59907 <listitem>
59908 <para>
59909 This variable is set only after the <option>decode</option> modifier (see above) has been
59910 successfully run. It contains the size of the decoded part in kilobytes. The
59911 size is always rounded up to full kilobytes, so only a completely empty part
59912 has a <varname>$mime_content_size</varname> of zero.
59913 </para>
59914 </listitem></varlistentry>
59915 <varlistentry>
59916 <term><varname>$mime_content_transfer_encoding</varname></term>
59917 <listitem>
59918 <para>
59919 This variable contains the normalized content of the
59920 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
59921 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
59922 </para>
59923 </listitem></varlistentry>
59924 <varlistentry>
59925 <term><varname>$mime_content_type</varname></term>
59926 <listitem>
59927 <para>
59928 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
59929 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
59930 are some examples of popular MIME types, as they may appear in this variable:
59931 </para>
59932 <literallayout class="monospaced">
59933 text/plain
59934 text/html
59935 application/octet-stream
59936 image/jpeg
59937 audio/midi
59938 </literallayout>
59939 <para>
59940 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
59941 empty string.
59942 </para>
59943 </listitem></varlistentry>
59944 <varlistentry>
59945 <term><varname>$mime_decoded_filename</varname></term>
59946 <listitem>
59947 <para>
59948 This variable is set only after the <option>decode</option> modifier (see above) has been
59949 successfully run. It contains the full path and file name of the file
59950 containing the decoded data.
59951 </para>
59952 </listitem></varlistentry>
59953 </variablelist>
59954 <para>
59955 <indexterm role="concept">
59956 <primary>RFC 2047</primary>
59957 </indexterm>
59958 </para>
59959 <variablelist>
59960 <varlistentry>
59961 <term><varname>$mime_filename</varname></term>
59962 <listitem>
59963 <para>
59964 This is perhaps the most important of the MIME variables. It contains a
59965 proposed filename for an attachment, if one was found in either the
59966 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
59967 RFC2047
59968 or RFC2231
59969 decoded, but no additional sanity checks are done.
59970  If no filename was
59971 found, this variable contains the empty string.
59972 </para>
59973 </listitem></varlistentry>
59974 <varlistentry>
59975 <term><varname>$mime_is_coverletter</varname></term>
59976 <listitem>
59977 <para>
59978 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
59979 attached data. It can be used to clamp down on flashy or unnecessarily encoded
59980 content in the cover letter, while not restricting attachments at all.
59981 </para>
59982 <para>
59983 The variable contains 1 (true) for a MIME part believed to be part of the
59984 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
59985 follows:
59986 </para>
59987 <orderedlist numeration="arabic">
59988 <listitem>
59989 <para>
59990 The outermost MIME part of a message is always a cover letter.
59991 </para>
59992 </listitem>
59993 <listitem>
59994 <para>
59995 If a multipart/alternative or multipart/related MIME part is a cover letter,
59996 so are all MIME subparts within that multipart.
59997 </para>
59998 </listitem>
59999 <listitem>
60000 <para>
60001 If any other multipart is a cover letter, the first subpart is a cover letter,
60002 and the rest are attachments.
60003 </para>
60004 </listitem>
60005 <listitem>
60006 <para>
60007 All parts contained within an attachment multipart are attachments.
60008 </para>
60009 </listitem>
60010 </orderedlist>
60011 <para>
60012 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
60013 alternative plain text), while allowing HTML files to be attached. HTML
60014 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
60015 </para>
60016 <literallayout class="monospaced">
60017 deny message = HTML mail is not accepted here
60018 !condition = $mime_is_rfc822
60019 condition = $mime_is_coverletter
60020 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
60021 </literallayout>
60022 </listitem></varlistentry>
60023 <varlistentry>
60024 <term><varname>$mime_is_multipart</varname></term>
60025 <listitem>
60026 <para>
60027 This variable has the value 1 (true) when the current part has the main type
60028 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
60029 Since multipart entities only serve as containers for other parts, you may not
60030 want to carry out specific actions on them.
60031 </para>
60032 </listitem></varlistentry>
60033 <varlistentry>
60034 <term><varname>$mime_is_rfc822</varname></term>
60035 <listitem>
60036 <para>
60037 This variable has the value 1 (true) if the current part is not a part of the
60038 checked message itself, but part of an attached message. Attached message
60039 decoding is fully recursive.
60040 </para>
60041 </listitem></varlistentry>
60042 <varlistentry>
60043 <term><varname>$mime_part_count</varname></term>
60044 <listitem>
60045 <para>
60046 This variable is a counter that is raised for each processed MIME part. It
60047 starts at zero for the very first part (which is usually a multipart). The
60048 counter is per-message, so it is reset when processing RFC822 attachments (see
60049 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
60050 complete, so you can use it in the DATA ACL to determine the number of MIME
60051 parts of a message. For non-MIME messages, this variable contains the value -1.
60052 </para>
60053 </listitem></varlistentry>
60054 </variablelist>
60055 </section>
60056 <section id="SECTscanregex">
60057 <title>Scanning with regular expressions</title>
60058 <para>
60059 <indexterm role="concept">
60060 <primary>content scanning</primary>
60061 <secondary>with regular expressions</secondary>
60062 </indexterm>
60063 <indexterm role="concept">
60064 <primary>regular expressions</primary>
60065 <secondary>content scanning with</secondary>
60066 </indexterm>
60067 You can specify your own custom regular expression matches on the full body of
60068 the message, or on individual MIME parts.
60069 </para>
60070 <para>
60071 The <option>regex</option> condition takes one or more regular expressions as arguments and
60072 matches them against the full message (when called in the DATA ACL) or a raw
60073 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
60074 linewise, with a maximum line length of 32K characters. That means you cannot
60075 have multiline matches with the <option>regex</option> condition.
60076 </para>
60077 <para>
60078 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
60079 to 32K of decoded content (the whole content at once, not linewise). If the
60080 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
60081 is decoded automatically when <option>mime_regex</option> is executed (using default path
60082 and filename values). If the decoded data is larger than  32K, only the first
60083 32K characters are checked.
60084 </para>
60085 <para>
60086 The regular expressions are passed as a colon-separated list. To include a
60087 literal colon, you must double it. Since the whole right-hand side string is
60088 expanded before being used, you must also escape dollar signs and backslashes
60089 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
60090 Here is a simple example that contains two regular expressions:
60091 </para>
60092 <literallayout class="monospaced">
60093 deny message = contains blacklisted regex ($regex_match_string)
60094      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
60095 </literallayout>
60096 <para>
60097 The conditions returns true if any one of the regular expressions matches. The
60098 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
60099 matching regular expression.
60100 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
60101 are set to any substrings captured by the regular expression.
60102 </para>
60103 <para>
60104 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
60105 CPU-intensive.
60106 </para>
60107 <para>
60108 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
60109 </para>
60110 </section>
60111 </chapter>
60112
60113 <chapter id="CHAPlocalscan">
60114 <title>Adding a local scan function to Exim</title>
60115 <titleabbrev>Local scan function</titleabbrev>
60116 <para>
60117 <indexterm role="concept" id="IIDlosca" class="startofrange">
60118 <primary><function>local_scan()</function> function</primary>
60119 <secondary>description of</secondary>
60120 </indexterm>
60121 <indexterm role="concept">
60122 <primary>customizing</primary>
60123 <secondary>input scan using C function</secondary>
60124 </indexterm>
60125 <indexterm role="concept">
60126 <primary>policy control</primary>
60127 <secondary>by local scan function</secondary>
60128 </indexterm>
60129 In these days of email worms, viruses, and ever-increasing spam, some sites
60130 want to apply a lot of checking to messages before accepting them.
60131 </para>
60132 <para>
60133 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
60134 passing messages to external virus and spam scanning software. You can also do
60135 a certain amount in Exim itself through string expansions and the <option>condition</option>
60136 condition in the ACL that runs after the SMTP DATA command or the ACL for
60137 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
60138 </para>
60139 <para>
60140 To allow for further customization to a site&#x2019;s own requirements, there is the
60141 possibility of linking Exim with a private message scanning function, written
60142 in C. If you want to run code that is written in something other than C, you
60143 can of course use a little C stub to call it.
60144 </para>
60145 <para>
60146 The local scan function is run once for every incoming message, at the point
60147 when Exim is just about to accept the message.
60148 It can therefore be used to control non-SMTP messages from local processes as
60149 well as messages arriving via SMTP.
60150 </para>
60151 <para>
60152 Exim applies a timeout to calls of the local scan function, and there is an
60153 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
60154 Zero means <quote>no timeout</quote>.
60155 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
60156 before calling the local scan function, so that the most common types of crash
60157 are caught. If the timeout is exceeded or one of those signals is caught, the
60158 incoming message is rejected with a temporary error if it is an SMTP message.
60159 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
60160 code. The incident is logged on the main and reject logs.
60161 </para>
60162 <section id="SECID207">
60163 <title>Building Exim to use a local scan function</title>
60164 <para>
60165 <indexterm role="concept">
60166 <primary><function>local_scan()</function> function</primary>
60167 <secondary>building Exim to use</secondary>
60168 </indexterm>
60169 To make use of the local scan function feature, you must tell Exim where your
60170 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
60171 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
60172 directory, so you might set
60173 </para>
60174 <literallayout class="monospaced">
60175 LOCAL_SCAN_SOURCE=Local/local_scan.c
60176 </literallayout>
60177 <para>
60178 for example. The function must be called <function>local_scan()</function>. It is called by
60179 Exim after it has received a message, when the success return code is about to
60180 be sent. This is after all the ACLs have been run. The return code from your
60181 function controls whether the message is actually accepted or not. There is a
60182 commented template function (that just accepts the message) in the file
60183 _src/local_scan.c_.
60184 </para>
60185 <para>
60186 If you want to make use of Exim&#x2019;s run time configuration file to set options
60187 for your <function>local_scan()</function> function, you must also set
60188 </para>
60189 <literallayout class="monospaced">
60190 LOCAL_SCAN_HAS_OPTIONS=yes
60191 </literallayout>
60192 <para>
60193 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
60194 </para>
60195 </section>
60196 <section id="SECTapiforloc">
60197 <title>API for local_scan()</title>
60198 <para>
60199 <indexterm role="concept">
60200 <primary><function>local_scan()</function> function</primary>
60201 <secondary>API description</secondary>
60202 </indexterm>
60203 You must include this line near the start of your code:
60204 </para>
60205 <literallayout class="monospaced">
60206 #include "local_scan.h"
60207 </literallayout>
60208 <para>
60209 This header file defines a number of variables and other values, and the
60210 prototype for the function itself. Exim is coded to use unsigned char values
60211 almost exclusively, and one of the things this header defines is a shorthand
60212 for <literal>unsigned char</literal> called <literal>uschar</literal>.
60213 It also contains the following macro definitions, to simplify casting character
60214 strings and pointers to character strings:
60215 </para>
60216 <literallayout class="monospaced">
60217 #define CS   (char *)
60218 #define CCS  (const char *)
60219 #define CSS  (char **)
60220 #define US   (unsigned char *)
60221 #define CUS  (const unsigned char *)
60222 #define USS  (unsigned char **)
60223 </literallayout>
60224 <para>
60225 The function prototype for <function>local_scan()</function> is:
60226 </para>
60227 <literallayout class="monospaced">
60228 extern int local_scan(int fd, uschar **return_text);
60229 </literallayout>
60230 <para>
60231 The arguments are as follows:
60232 </para>
60233 <itemizedlist>
60234 <listitem>
60235 <para>
60236 <option>fd</option> is a file descriptor for the file that contains the body of the message
60237 (the -D file). The file is open for reading and writing, but updating it is not
60238 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
60239 </para>
60240 <para>
60241 The descriptor is positioned at character 19 of the file, which is the first
60242 character of the body itself, because the first 19 characters are the message
60243 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
60244 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
60245 case this changes in some future version.
60246 </para>
60247 </listitem>
60248 <listitem>
60249 <para>
60250 <option>return_text</option> is an address which you can use to return a pointer to a text
60251 string at the end of the function. The value it points to on entry is NULL.
60252 </para>
60253 </listitem>
60254 </itemizedlist>
60255 <para>
60256 The function must return an <option>int</option> value which is one of the following macros:
60257 </para>
60258 <variablelist>
60259 <varlistentry>
60260 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
60261 <listitem>
60262 <para>
60263 <indexterm role="variable">
60264 <primary><varname>$local_scan_data</varname></primary>
60265 </indexterm>
60266 The message is accepted. If you pass back a string of text, it is saved with
60267 the message, and made available in the variable <varname>$local_scan_data</varname>. No
60268 newlines are permitted (if there are any, they are turned into spaces) and the
60269 maximum length of text is 1000 characters.
60270 </para>
60271 </listitem></varlistentry>
60272 <varlistentry>
60273 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
60274 <listitem>
60275 <para>
60276 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
60277 queued without immediate delivery, and is frozen.
60278 </para>
60279 </listitem></varlistentry>
60280 <varlistentry>
60281 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
60282 <listitem>
60283 <para>
60284 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
60285 queued without immediate delivery.
60286 </para>
60287 </listitem></varlistentry>
60288 <varlistentry>
60289 <term><literal>LOCAL_SCAN_REJECT</literal></term>
60290 <listitem>
60291 <para>
60292 The message is rejected; the returned text is used as an error message which is
60293 passed back to the sender and which is also logged. Newlines are permitted &ndash;
60294 they cause a multiline response for SMTP rejections, but are converted to
60295 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
60296 used.
60297 </para>
60298 </listitem></varlistentry>
60299 <varlistentry>
60300 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
60301 <listitem>
60302 <para>
60303 The message is temporarily rejected; the returned text is used as an error
60304 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
60305 problem</quote> is used.
60306 </para>
60307 </listitem></varlistentry>
60308 <varlistentry>
60309 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
60310 <listitem>
60311 <para>
60312 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
60313 message is not written to the reject log. It has the effect of unsetting the
60314 <option>rejected_header</option> log selector for just this rejection. If
60315 <option>rejected_header</option> is already unset (see the discussion of the
60316 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
60317 same as LOCAL_SCAN_REJECT.
60318 </para>
60319 </listitem></varlistentry>
60320 <varlistentry>
60321 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
60322 <listitem>
60323 <para>
60324 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
60325 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
60326 </para>
60327 </listitem></varlistentry>
60328 </variablelist>
60329 <para>
60330 If the message is not being received by interactive SMTP, rejections are
60331 reported by writing to <option>stderr</option> or by sending an email, as configured by the
60332 <option>-oe</option> command line options.
60333 </para>
60334 </section>
60335 <section id="SECTconoptloc">
60336 <title>Configuration options for local_scan()</title>
60337 <para>
60338 <indexterm role="concept">
60339 <primary><function>local_scan()</function> function</primary>
60340 <secondary>configuration options</secondary>
60341 </indexterm>
60342 It is possible to have option settings in the main configuration file
60343 that set values in static variables in the <function>local_scan()</function> module. If you
60344 want to do this, you must have the line
60345 </para>
60346 <literallayout class="monospaced">
60347 LOCAL_SCAN_HAS_OPTIONS=yes
60348 </literallayout>
60349 <para>
60350 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
60351 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
60352 file, you must define static variables to hold the option values, and a table
60353 to define them.
60354 </para>
60355 <para>
60356 The table must be a vector called <option>local_scan_options</option>, of type
60357 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
60358 and a pointer to the variable that holds the value. The entries must appear in
60359 alphabetical order. Following <option>local_scan_options</option> you must also define a
60360 variable called <option>local_scan_options_count</option> that contains the number of
60361 entries in the table. Here is a short example, showing two kinds of option:
60362 </para>
60363 <literallayout class="monospaced">
60364 static int my_integer_option = 42;
60365 static uschar *my_string_option = US"a default string";
60366
60367 optionlist local_scan_options[] = {
60368   { "my_integer", opt_int,       &amp;my_integer_option },
60369   { "my_string",  opt_stringptr, &amp;my_string_option }
60370 };
60371
60372 int local_scan_options_count =
60373   sizeof(local_scan_options)/sizeof(optionlist);
60374 </literallayout>
60375 <para>
60376 The values of the variables can now be changed from Exim&#x2019;s runtime
60377 configuration file by including a local scan section as in this example:
60378 </para>
60379 <literallayout class="monospaced">
60380 begin local_scan
60381 my_integer = 99
60382 my_string = some string of text...
60383 </literallayout>
60384 <para>
60385 The available types of option data are as follows:
60386 </para>
60387 <variablelist>
60388 <varlistentry>
60389 <term><emphasis role="bold">opt_bool</emphasis></term>
60390 <listitem>
60391 <para>
60392 This specifies a boolean (true/false) option. The address should point to a
60393 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
60394 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
60395 whether such a variable has been set at all, you can initialize it to
60396 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
60397 values.)
60398 </para>
60399 </listitem></varlistentry>
60400 <varlistentry>
60401 <term><emphasis role="bold">opt_fixed</emphasis></term>
60402 <listitem>
60403 <para>
60404 This specifies a fixed point number, such as is used for load averages.
60405 The address should point to a variable of type <literal>int</literal>. The value is stored
60406 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
60407 </para>
60408 </listitem></varlistentry>
60409 <varlistentry>
60410 <term><emphasis role="bold">opt_int</emphasis></term>
60411 <listitem>
60412 <para>
60413 This specifies an integer; the address should point to a variable of type
60414 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
60415 Exim.
60416 </para>
60417 </listitem></varlistentry>
60418 <varlistentry>
60419 <term><emphasis role="bold">opt_mkint</emphasis></term>
60420 <listitem>
60421 <para>
60422 This is the same as <option>opt_int</option>, except that when such a value is output in a
60423 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
60424 printed with the suffix K or M.
60425 </para>
60426 </listitem></varlistentry>
60427 <varlistentry>
60428 <term><emphasis role="bold">opt_octint</emphasis></term>
60429 <listitem>
60430 <para>
60431 This also specifies an integer, but the value is always interpreted as an
60432 octal integer, whether or not it starts with the digit zero, and it is
60433 always output in octal.
60434 </para>
60435 </listitem></varlistentry>
60436 <varlistentry>
60437 <term><emphasis role="bold">opt_stringptr</emphasis></term>
60438 <listitem>
60439 <para>
60440 This specifies a string value; the address must be a pointer to a
60441 variable that points to a string (for example, of type <literal>uschar *</literal>).
60442 </para>
60443 </listitem></varlistentry>
60444 <varlistentry>
60445 <term><emphasis role="bold">opt_time</emphasis></term>
60446 <listitem>
60447 <para>
60448 This specifies a time interval value. The address must point to a variable of
60449 type <literal>int</literal>. The value that is placed there is a number of seconds.
60450 </para>
60451 </listitem></varlistentry>
60452 </variablelist>
60453 <para>
60454 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
60455 out the values of all the <function>local_scan()</function> options.
60456 </para>
60457 </section>
60458 <section id="SECID208">
60459 <title>Available Exim variables</title>
60460 <para>
60461 <indexterm role="concept">
60462 <primary><function>local_scan()</function> function</primary>
60463 <secondary>available Exim variables</secondary>
60464 </indexterm>
60465 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
60466 are the only ones that are guaranteed to be maintained from release to release.
60467 Note, however, that you can obtain the value of any Exim expansion variable,
60468 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
60469 C variables are as follows:
60470 </para>
60471 <variablelist>
60472 <varlistentry>
60473 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
60474 <listitem>
60475 <para>
60476 This variable contains the number of lines in the message&#x2019;s body.
60477 </para>
60478 </listitem></varlistentry>
60479 <varlistentry>
60480 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
60481 <listitem>
60482 <para>
60483 This variable contains the number of binary zero bytes in the message&#x2019;s body.
60484 </para>
60485 </listitem></varlistentry>
60486 <varlistentry>
60487 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
60488 <listitem>
60489 <para>
60490 This variable is set to zero when no debugging is taking place. Otherwise, it
60491 is a bitmap of debugging selectors. Two bits are identified for use in
60492 <function>local_scan()</function>; they are defined as macros:
60493 </para>
60494 <itemizedlist>
60495 <listitem>
60496 <para>
60497 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
60498 testing option that is not privileged &ndash; any caller may set it. All the
60499 other selector bits can be set only by admin users.
60500 </para>
60501 </listitem>
60502 <listitem>
60503 <para>
60504 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
60505 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
60506 of debugging bits.
60507 </para>
60508 </listitem>
60509 </itemizedlist>
60510 <para>
60511 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
60512 selected, you should use code like this:
60513 </para>
60514 <literallayout class="monospaced">
60515 if ((debug_selector &amp; D_local_scan) != 0)
60516   debug_printf("xxx", ...);
60517 </literallayout>
60518 </listitem></varlistentry>
60519 <varlistentry>
60520 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
60521 <listitem>
60522 <para>
60523 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
60524 variable <option>expand_string_message</option> contains the error message, zero-terminated.
60525 </para>
60526 </listitem></varlistentry>
60527 <varlistentry>
60528 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
60529 <listitem>
60530 <para>
60531 A pointer to a chain of header lines. The <option>header_line</option> structure is
60532 discussed below.
60533 </para>
60534 </listitem></varlistentry>
60535 <varlistentry>
60536 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
60537 <listitem>
60538 <para>
60539 A pointer to the last of the header lines.
60540 </para>
60541 </listitem></varlistentry>
60542 <varlistentry>
60543 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
60544 <listitem>
60545 <para>
60546 The value of the <option>headers_charset</option> configuration option.
60547 </para>
60548 </listitem></varlistentry>
60549 <varlistentry>
60550 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
60551 <listitem>
60552 <para>
60553 This variable is TRUE during a host checking session that is initiated by the
60554 <option>-bh</option> command line option.
60555 </para>
60556 </listitem></varlistentry>
60557 <varlistentry>
60558 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
60559 <listitem>
60560 <para>
60561 The IP address of the interface that received the message, as a string. This
60562 is NULL for locally submitted messages.
60563 </para>
60564 </listitem></varlistentry>
60565 <varlistentry>
60566 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
60567 <listitem>
60568 <para>
60569 The port on which this message was received. When testing with the <option>-bh</option>
60570 command line option, the value of this variable is -1 unless a port has been
60571 specified via the <option>-oMi</option> option.
60572 </para>
60573 </listitem></varlistentry>
60574 <varlistentry>
60575 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
60576 <listitem>
60577 <para>
60578 This variable contains Exim&#x2019;s message id for the incoming message (the value of
60579 <varname>$message_exim_id</varname>) as a zero-terminated string.
60580 </para>
60581 </listitem></varlistentry>
60582 <varlistentry>
60583 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
60584 <listitem>
60585 <para>
60586 The name of the protocol by which the message was received.
60587 </para>
60588 </listitem></varlistentry>
60589 <varlistentry>
60590 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
60591 <listitem>
60592 <para>
60593 The number of accepted recipients.
60594 </para>
60595 </listitem></varlistentry>
60596 <varlistentry>
60597 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
60598 <listitem>
60599 <para>
60600 <indexterm role="concept">
60601 <primary>recipient</primary>
60602 <secondary>adding in local scan</secondary>
60603 </indexterm>
60604 <indexterm role="concept">
60605 <primary>recipient</primary>
60606 <secondary>removing in local scan</secondary>
60607 </indexterm>
60608 The list of accepted recipients, held in a vector of length
60609 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
60610 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
60611 below). You can delete recipients by removing them from the vector and
60612 adjusting the value in <option>recipients_count</option>. In particular, by setting
60613 <option>recipients_count</option> to zero you remove all recipients. If you then return the
60614 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
60615 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
60616 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
60617 </para>
60618 </listitem></varlistentry>
60619 <varlistentry>
60620 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
60621 <listitem>
60622 <para>
60623 The envelope sender address. For bounce messages this is the empty string.
60624 </para>
60625 </listitem></varlistentry>
60626 <varlistentry>
60627 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
60628 <listitem>
60629 <para>
60630 The IP address of the sending host, as a string. This is NULL for
60631 locally-submitted messages.
60632 </para>
60633 </listitem></varlistentry>
60634 <varlistentry>
60635 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
60636 <listitem>
60637 <para>
60638 The name of the authentication mechanism that was used, or NULL if the message
60639 was not received over an authenticated SMTP connection.
60640 </para>
60641 </listitem></varlistentry>
60642 <varlistentry>
60643 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
60644 <listitem>
60645 <para>
60646 The name of the sending host, if known.
60647 </para>
60648 </listitem></varlistentry>
60649 <varlistentry>
60650 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
60651 <listitem>
60652 <para>
60653 The port on the sending host.
60654 </para>
60655 </listitem></varlistentry>
60656 <varlistentry>
60657 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
60658 <listitem>
60659 <para>
60660 This variable is TRUE for all SMTP input, including BSMTP.
60661 </para>
60662 </listitem></varlistentry>
60663 <varlistentry>
60664 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
60665 <listitem>
60666 <para>
60667 This variable is TRUE for BSMTP input.
60668 </para>
60669 </listitem></varlistentry>
60670 <varlistentry>
60671 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
60672 <listitem>
60673 <para>
60674 The contents of this variable control which pool of memory is used for new
60675 requests. See section <xref linkend="SECTmemhanloc"/> for details.
60676 </para>
60677 </listitem></varlistentry>
60678 </variablelist>
60679 </section>
60680 <section id="SECID209">
60681 <title>Structure of header lines</title>
60682 <para>
60683 The <option>header_line</option> structure contains the members listed below.
60684 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
60685 (see below). You can cause header lines to be ignored (deleted) by setting
60686 their type to *.
60687 </para>
60688 <variablelist>
60689 <varlistentry>
60690 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
60691 <listitem>
60692 <para>
60693 A pointer to the next header line, or NULL for the last line.
60694 </para>
60695 </listitem></varlistentry>
60696 <varlistentry>
60697 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
60698 <listitem>
60699 <para>
60700 A code identifying certain headers that Exim recognizes. The codes are printing
60701 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
60702 Notice in particular that any header line whose type is * is not transmitted
60703 with the message. This flagging is used for header lines that have been
60704 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
60705 lines.) Effectively, * means <quote>deleted</quote>.
60706 </para>
60707 </listitem></varlistentry>
60708 <varlistentry>
60709 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
60710 <listitem>
60711 <para>
60712 The number of characters in the header line, including the terminating and any
60713 internal newlines.
60714 </para>
60715 </listitem></varlistentry>
60716 <varlistentry>
60717 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
60718 <listitem>
60719 <para>
60720 A pointer to the text of the header. It always ends with a newline, followed by
60721 a zero byte. Internal newlines are preserved.
60722 </para>
60723 </listitem></varlistentry>
60724 </variablelist>
60725 </section>
60726 <section id="SECID210">
60727 <title>Structure of recipient items</title>
60728 <para>
60729 The <option>recipient_item</option> structure contains these members:
60730 </para>
60731 <variablelist>
60732 <varlistentry>
60733 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
60734 <listitem>
60735 <para>
60736 This is a pointer to the recipient address as it was received.
60737 </para>
60738 </listitem></varlistentry>
60739 <varlistentry>
60740 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
60741 <listitem>
60742 <para>
60743 This is used in later Exim processing when top level addresses are created by
60744 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
60745 and must always contain -1 at this stage.
60746 </para>
60747 </listitem></varlistentry>
60748 <varlistentry>
60749 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
60750 <listitem>
60751 <para>
60752 If this value is not NULL, bounce messages caused by failing to deliver to the
60753 recipient are sent to the address it contains. In other words, it overrides the
60754 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
60755 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
60756 an unqualified address, Exim qualifies it using the domain from
60757 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
60758 is NULL for all recipients.
60759 </para>
60760 </listitem></varlistentry>
60761 </variablelist>
60762 </section>
60763 <section id="SECID211">
60764 <title>Available Exim functions</title>
60765 <para>
60766 <indexterm role="concept">
60767 <primary><function>local_scan()</function> function</primary>
60768 <secondary>available Exim functions</secondary>
60769 </indexterm>
60770 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
60771 These are the only ones that are guaranteed to be maintained from release to
60772 release:
60773 </para>
60774 <variablelist>
60775 <varlistentry>
60776 <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>
60777 <listitem>
60778 <para>
60779 This function creates a child process that runs the command specified by
60780 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
60781 be NULL if no environment variables are to be passed. A new umask is supplied
60782 for the process in <option>newumask</option>.
60783 </para>
60784 <para>
60785 Pipes to the standard input and output of the new process are set up
60786 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
60787 standard error is cloned to the standard output. If there are any file
60788 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
60789 argument is TRUE, the new process is made into a process group leader.
60790 </para>
60791 <para>
60792 The function returns the pid of the new process, or -1 if things go wrong.
60793 </para>
60794 </listitem></varlistentry>
60795 <varlistentry>
60796 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
60797 <listitem>
60798 <para>
60799 This function waits for a child process to terminate, or for a timeout (in
60800 seconds) to expire. A timeout value of zero means wait as long as it takes. The
60801 return value is as follows:
60802 </para>
60803 <itemizedlist>
60804 <listitem>
60805 <para>
60806 &gt;= 0
60807 </para>
60808 <para>
60809 The process terminated by a normal exit and the value is the process
60810 ending status.
60811 </para>
60812 </listitem>
60813 <listitem>
60814 <para>
60815 &lt; 0 and &gt; &ndash;256
60816 </para>
60817 <para>
60818 The process was terminated by a signal and the value is the negation of the
60819 signal number.
60820 </para>
60821 </listitem>
60822 <listitem>
60823 <para>
60824 &ndash;256
60825 </para>
60826 <para>
60827 The process timed out.
60828 </para>
60829 </listitem>
60830 <listitem>
60831 <para>
60832 &ndash;257
60833 </para>
60834 <para>
60835 The was some other error in wait(); <option>errno</option> is still set.
60836 </para>
60837 </listitem>
60838 </itemizedlist>
60839 </listitem></varlistentry>
60840 <varlistentry>
60841 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
60842 <listitem>
60843 <para>
60844 This function provide you with a means of submitting a new message to
60845 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
60846 want, but this packages it all up for you.) The function creates a pipe,
60847 forks a subprocess that is running
60848 </para>
60849 <literallayout class="monospaced">
60850 exim -t -oem -oi -f &lt;&gt;
60851 </literallayout>
60852 <para>
60853 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
60854 that is connected to the standard input. The yield of the function is the PID
60855 of the subprocess. You can then write a message to the file descriptor, with
60856 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
60857 </para>
60858 <para>
60859 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
60860 finish and to collect its ending status. A timeout value of zero is usually
60861 fine in this circumstance. Unless you have made a mistake with the recipient
60862 addresses, you should get a return code of zero.
60863 </para>
60864 </listitem></varlistentry>
60865 <varlistentry>
60866 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
60867 <listitem>
60868 <para>
60869 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
60870 that it runs is:
60871 </para>
60872 <literallayout>
60873 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
60874 </literallayout>
60875 <para>
60876 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
60877 </para>
60878 </listitem></varlistentry>
60879 <varlistentry>
60880 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
60881 <listitem>
60882 <para>
60883 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
60884 output is written to the standard error stream. If no debugging is selected,
60885 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
60886 conditional on the <literal>local_scan</literal> debug selector by coding like this:
60887 </para>
60888 <literallayout class="monospaced">
60889 if ((debug_selector &amp; D_local_scan) != 0)
60890   debug_printf("xxx", ...);
60891 </literallayout>
60892 </listitem></varlistentry>
60893 <varlistentry>
60894 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
60895 <listitem>
60896 <para>
60897 This is an interface to Exim&#x2019;s string expansion code. The return value is the
60898 expanded string, or NULL if there was an expansion failure.
60899 The C variable <option>expand_string_message</option> contains an error message after an
60900 expansion failure. If expansion does not change the string, the return value is
60901 the pointer to the input string. Otherwise, the return value points to a new
60902 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
60903 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
60904 </para>
60905 </listitem></varlistentry>
60906 <varlistentry>
60907 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
60908 <listitem>
60909 <para>
60910 This function allows you to an add additional header line at the end of the
60911 existing ones. The first argument is the type, and should normally be a space
60912 character. The second argument is a format string and any number of
60913 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
60914 if you want, and you must ensure that the string ends with a newline.
60915 </para>
60916 </listitem></varlistentry>
60917 <varlistentry>
60918 <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>
60919 <listitem>
60920 <para>
60921 This function adds a new header line at a specified point in the header
60922 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
60923 </para>
60924 <para>
60925 If <option>name</option> is NULL, the new header is added at the end of the chain if
60926 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
60927 NULL, the header lines are searched for the first non-deleted header that
60928 matches the name. If one is found, the new header is added before it if
60929 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
60930 found header and any adjacent subsequent ones with the same name (even if
60931 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
60932 option controls where the header is added. If it is true, addition is at the
60933 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
60934 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
60935 </para>
60936 <literallayout class="monospaced">
60937 header_add_at_position(TRUE, US"Received", TRUE,
60938   ' ', "X-xxx: ...");
60939 </literallayout>
60940 <para>
60941 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
60942 there may not be if <option>received_header_text</option> expands to an empty string.
60943 </para>
60944 </listitem></varlistentry>
60945 <varlistentry>
60946 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
60947 <listitem>
60948 <para>
60949 This function removes header lines. If <option>occurrence</option> is zero or negative, all
60950 occurrences of the header are removed. If occurrence is greater than zero, that
60951 particular instance of the header is removed. If no header(s) can be found that
60952 match the specification, the function does nothing.
60953 </para>
60954 </listitem></varlistentry>
60955 <varlistentry>
60956 <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>
60957 <listitem>
60958 <para>
60959 This function tests whether the given header has the given name. It is not just
60960 a string comparison, because white space is permitted between the name and the
60961 colon. If the <option>notdel</option> argument is true, a false return is forced for all
60962 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
60963 </para>
60964 <literallayout class="monospaced">
60965 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
60966 </literallayout>
60967 </listitem></varlistentry>
60968 <varlistentry>
60969 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
60970 <listitem>
60971 <para>
60972 <indexterm role="concept">
60973 <primary>base64 encoding</primary>
60974 <secondary>functions for <function>local_scan()</function> use</secondary>
60975 </indexterm>
60976 This function base64-encodes a string, which is passed by address and length.
60977 The text may contain bytes of any value, including zero. The result is passed
60978 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
60979 zero-terminated.
60980 </para>
60981 </listitem></varlistentry>
60982 <varlistentry>
60983 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
60984 <listitem>
60985 <para>
60986 This function decodes a base64-encoded string. Its arguments are a
60987 zero-terminated base64-encoded string and the address of a variable that is set
60988 to point to the result, which is in dynamic memory. The length of the decoded
60989 string is the yield of the function. If the input is invalid base64 data, the
60990 yield is -1. A zero byte is added to the end of the output string to make it
60991 easy to interpret as a C string (assuming it contains no zeros of its own). The
60992 added zero byte is not included in the returned count.
60993 </para>
60994 </listitem></varlistentry>
60995 <varlistentry>
60996 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
60997 <listitem>
60998 <para>
60999 This function checks for a match in a domain list. Domains are always
61000 matched caselessly. The return value is one of the following:
61001 </para>
61002 <literallayout>
61003 <literal>OK     </literal> match succeeded
61004 <literal>FAIL   </literal> match failed
61005 <literal>DEFER  </literal> match deferred
61006 </literallayout>
61007 <para>
61008 DEFER is usually caused by some kind of lookup defer, such as the
61009 inability to contact a database.
61010 </para>
61011 </listitem></varlistentry>
61012 <varlistentry>
61013 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
61014 <listitem>
61015 <para>
61016 This function checks for a match in a local part list. The third argument
61017 controls case-sensitivity. The return values are as for
61018 <emphasis>lss_match_domain()</emphasis>.
61019 </para>
61020 </listitem></varlistentry>
61021 <varlistentry>
61022 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
61023 <listitem>
61024 <para>
61025 This function checks for a match in an address list. The third argument
61026 controls the case-sensitivity of the local part match. The domain is always
61027 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
61028 </para>
61029 </listitem></varlistentry>
61030 <varlistentry>
61031 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
61032 <listitem>
61033 <para>
61034 This function checks for a match in a host list. The most common usage is
61035 expected to be
61036 </para>
61037 <literallayout class="monospaced">
61038 lss_match_host(sender_host_name, sender_host_address, ...)
61039 </literallayout>
61040 <para>
61041 <indexterm role="variable">
61042 <primary><varname>$sender_host_address</varname></primary>
61043 </indexterm>
61044 An empty address field matches an empty item in the host list. If the host name
61045 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
61046 looked up if a host name is required to match an item in the list. The return
61047 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
61048 returns ERROR in the case when it had to look up a host name, but the lookup
61049 failed.
61050 </para>
61051 </listitem></varlistentry>
61052 <varlistentry>
61053 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
61054 <listitem>
61055 <para>
61056 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
61057 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
61058 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
61059 them. It specifies to which log or logs the message is written. The remaining
61060 arguments are a format and relevant insertion arguments. The string should not
61061 contain any newlines, not even at the end.
61062 </para>
61063 </listitem></varlistentry>
61064 <varlistentry>
61065 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
61066 <listitem>
61067 <para>
61068 This function adds an additional recipient to the message. The first argument
61069 is the recipient address. If it is unqualified (has no domain), it is qualified
61070 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
61071 </para>
61072 <para>
61073 This function does not allow you to specify a private <option>errors_to</option> address (as
61074 described with the structure of <option>recipient_item</option> above), because it pre-dates
61075 the addition of that field to the structure. However, it is easy to add such a
61076 value afterwards. For example:
61077 </para>
61078 <literallayout class="monospaced">
61079  receive_add_recipient(US"monitor@mydom.example", -1);
61080  recipients_list[recipients_count-1].errors_to =
61081    US"postmaster@mydom.example";
61082 </literallayout>
61083 </listitem></varlistentry>
61084 <varlistentry>
61085 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
61086 <listitem>
61087 <para>
61088 This is a convenience function to remove a named recipient from the list of
61089 recipients. It returns true if a recipient was removed, and false if no
61090 matching recipient could be found. The argument must be a complete email
61091 address.
61092 </para>
61093 </listitem></varlistentry>
61094 </variablelist>
61095 <para>
61096 <indexterm role="concept">
61097 <primary>RFC 2047</primary>
61098 </indexterm>
61099 </para>
61100 <variablelist>
61101 <varlistentry>
61102 <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>
61103 <listitem>
61104 <para>
61105 This function decodes strings that are encoded according to RFC 2047. Typically
61106 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
61107 from the Q or B encoding into a byte-string. Then, if provided with the name of
61108 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
61109 made  to translate the result to the named character set. If this fails, the
61110 binary string is returned with an error message.
61111 </para>
61112 <para>
61113 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
61114 maximum MIME word length is enforced. The third argument is the target
61115 encoding, or NULL if no translation is wanted.
61116 </para>
61117 <para>
61118 <indexterm role="concept">
61119 <primary>binary zero</primary>
61120 <secondary>in RFC 2047 decoding</secondary>
61121 </indexterm>
61122 <indexterm role="concept">
61123 <primary>RFC 2047</primary>
61124 <secondary>binary zero in</secondary>
61125 </indexterm>
61126 If a binary zero is encountered in the decoded string, it is replaced by the
61127 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
61128 not be 0 because header lines are handled as zero-terminated strings.
61129 </para>
61130 <para>
61131 The function returns the result of processing the string, zero-terminated; if
61132 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
61133 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
61134 </para>
61135 <para>
61136 If an error is encountered, the function returns NULL and uses the <option>error</option>
61137 argument to return an error message. The variable pointed to by <option>error</option> is
61138 set to NULL if there is no error; it may be set non-NULL even when the function
61139 returns a non-NULL value if decoding was successful, but there was a problem
61140 with translation.
61141 </para>
61142 </listitem></varlistentry>
61143 <varlistentry>
61144 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
61145 <listitem>
61146 <para>
61147 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
61148 below.
61149 </para>
61150 </listitem></varlistentry>
61151 <varlistentry>
61152 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
61153 <listitem>
61154 <para>
61155 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
61156 output stream. You should use this function only when there is an SMTP output
61157 stream, that is, when the incoming message is being received via interactive
61158 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
61159 is FALSE. If you want to test for an incoming message from another host (as
61160 opposed to a local process that used the <option>-bs</option> command line option), you can
61161 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
61162 is involved.
61163 </para>
61164 <para>
61165 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
61166 output function, so it can be used for all forms of SMTP connection.
61167 </para>
61168 <para>
61169 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
61170 must start with an appropriate response code: 550 if you are going to return
61171 LOCAL_SCAN_REJECT, 451 if you are going to return
61172 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
61173 initial lines of a multi-line response, the code must be followed by a hyphen
61174 to indicate that the line is not the final response line. You must also ensure
61175 that the lines you write terminate with CRLF. For example:
61176 </para>
61177 <literallayout class="monospaced">
61178 smtp_printf("550-this is some extra info\r\n");
61179 return LOCAL_SCAN_REJECT;
61180 </literallayout>
61181 <para>
61182 Note that you can also create multi-line responses by including newlines in
61183 the data returned via the <option>return_text</option> argument. The added value of using
61184 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
61185 multiple output lines.
61186 </para>
61187 <para>
61188 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
61189 does not automatically flush pending output, and therefore does not test
61190 the state of the stream. (In the main code of Exim, flushing and error
61191 detection is done when Exim is ready for the next SMTP input command.) If
61192 you want to flush the output and check for an error (for example, the
61193 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
61194 arguments. It flushes the output stream, and returns a non-zero value if there
61195 is an error.
61196 </para>
61197 </listitem></varlistentry>
61198 <varlistentry>
61199 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
61200 <listitem>
61201 <para>
61202 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
61203 chunk of memory whose size is given by the argument. Exim bombs out if it ever
61204 runs out of memory. See the next section for a discussion of memory handling.
61205 </para>
61206 </listitem></varlistentry>
61207 <varlistentry>
61208 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
61209 <listitem>
61210 <para>
61211 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
61212 permanent pool. See the next section for a discussion of memory handling.
61213 </para>
61214 </listitem></varlistentry>
61215 <varlistentry>
61216 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
61217 <listitem>
61218 <para>
61219 See below.
61220 </para>
61221 </listitem></varlistentry>
61222 <varlistentry>
61223 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
61224 <listitem>
61225 <para>
61226 See below.
61227 </para>
61228 </listitem></varlistentry>
61229 <varlistentry>
61230 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
61231 <listitem>
61232 <para>
61233 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
61234 The first makes a copy of an entire string. The second copies up to a maximum
61235 number of characters, indicated by the second argument. The third uses a format
61236 and insertion arguments to create a new string. In each case, the result is a
61237 pointer to a new string in the current memory pool. See the next section for
61238 more discussion.
61239 </para>
61240 </listitem></varlistentry>
61241 </variablelist>
61242 </section>
61243 <section id="SECTmemhanloc">
61244 <title>More about Exim&#x2019;s memory handling</title>
61245 <para>
61246 <indexterm role="concept">
61247 <primary><function>local_scan()</function> function</primary>
61248 <secondary>memory handling</secondary>
61249 </indexterm>
61250 No function is provided for freeing memory, because that is never needed.
61251 The dynamic memory that Exim uses when receiving a message is automatically
61252 recycled if another message is received by the same process (this applies only
61253 to incoming SMTP connections &ndash; other input methods can supply only one
61254 message at a time). After receiving the last message, a reception process
61255 terminates.
61256 </para>
61257 <para>
61258 Because it is recycled, the normal dynamic memory cannot be used for holding
61259 data that must be preserved over a number of incoming messages on the same SMTP
61260 connection. However, Exim in fact uses two pools of dynamic memory; the second
61261 one is not recycled, and can be used for this purpose.
61262 </para>
61263 <para>
61264 If you want to allocate memory that remains available for subsequent messages
61265 in the same SMTP connection, you should set
61266 </para>
61267 <literallayout class="monospaced">
61268 store_pool = POOL_PERM
61269 </literallayout>
61270 <para>
61271 before calling the function that does the allocation. There is no need to
61272 restore the value if you do not need to; however, if you do want to revert to
61273 the normal pool, you can either restore the previous value of <option>store_pool</option> or
61274 set it explicitly to POOL_MAIN.
61275 </para>
61276 <para>
61277 The pool setting applies to all functions that get dynamic memory, including
61278 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
61279 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
61280 block of memory from the permanent pool while preserving the value of
61281 <option>store_pool</option>.
61282 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
61283 </para>
61284 </section>
61285 </chapter>
61286
61287 <chapter id="CHAPsystemfilter">
61288 <title>System-wide message filtering</title>
61289 <para>
61290 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
61291 <primary>filter</primary>
61292 <secondary>system filter</secondary>
61293 </indexterm>
61294 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
61295 <primary>filtering all mail</primary>
61296 </indexterm>
61297 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
61298 <primary>system filter</primary>
61299 </indexterm>
61300 The previous chapters (on ACLs and the local scan function) describe checks
61301 that can be applied to messages before they are accepted by a host. There is
61302 also a mechanism for checking messages once they have been received, but before
61303 they are delivered. This is called the <emphasis>system filter</emphasis>.
61304 </para>
61305 <para>
61306 The system filter operates in a similar manner to users&#x2019; filter files, but it
61307 is run just once per message (however many recipients the message has).
61308 It should not normally be used as a substitute for routing, because <option>deliver</option>
61309 commands in a system router provide new envelope recipient addresses.
61310 The system filter must be an Exim filter. It cannot be a Sieve filter.
61311 </para>
61312 <para>
61313 The system filter is run at the start of a delivery attempt, before any routing
61314 is done. If a message fails to be completely delivered at the first attempt,
61315 the system filter is run again at the start of every retry.
61316 If you want your filter to do something only once per message, you can make use
61317 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
61318 prevent it happening on retries.
61319 </para>
61320 <para>
61321 <indexterm role="variable">
61322 <primary><varname>$domain</varname></primary>
61323 </indexterm>
61324 <indexterm role="variable">
61325 <primary><varname>$local_part</varname></primary>
61326 </indexterm>
61327 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
61328 specific to individual recipient addresses, such as <varname>$local_part</varname> and
61329 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
61330 you want to run a centrally-specified filter for each recipient address
61331 independently, you can do so by setting up a suitable <command>redirect</command> router, as
61332 described in section <xref linkend="SECTperaddfil"/> below.
61333 </para>
61334 <section id="SECID212">
61335 <title>Specifying a system filter</title>
61336 <para>
61337 <indexterm role="concept">
61338 <primary>uid (user id)</primary>
61339 <secondary>system filter</secondary>
61340 </indexterm>
61341 <indexterm role="concept">
61342 <primary>gid (group id)</primary>
61343 <secondary>system filter</secondary>
61344 </indexterm>
61345 The name of the file that contains the system filter must be specified by
61346 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
61347 other than root, you must also set <option>system_filter_user</option> and
61348 <option>system_filter_group</option> as appropriate. For example:
61349 </para>
61350 <literallayout class="monospaced">
61351 system_filter = /etc/mail/exim.filter
61352 system_filter_user = exim
61353 </literallayout>
61354 <para>
61355 If a system filter generates any deliveries directly to files or pipes (via the
61356 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
61357 specified by setting <option>system_filter_file_transport</option> and
61358 <option>system_filter_pipe_transport</option>, respectively. Similarly,
61359 <option>system_filter_reply_transport</option> must be set to handle any messages generated
61360 by the <option>reply</option> command.
61361 </para>
61362 </section>
61363 <section id="SECID213">
61364 <title>Testing a system filter</title>
61365 <para>
61366 You can run simple tests of a system filter in the same way as for a user
61367 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
61368 are permitted only in system filters are recognized.
61369 </para>
61370 <para>
61371 If you want to test the combined effect of a system filter and a user filter,
61372 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
61373 </para>
61374 </section>
61375 <section id="SECID214">
61376 <title>Contents of a system filter</title>
61377 <para>
61378 The language used to specify system filters is the same as for users&#x2019; filter
61379 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
61380 mail filtering</emphasis>. However, there are some additional features that are
61381 available only in system filters; these are described in subsequent sections.
61382 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
61383 they cause errors.
61384 </para>
61385 <para>
61386 <indexterm role="concept">
61387 <primary>frozen messages</primary>
61388 <secondary>manual thaw; testing in filter</secondary>
61389 </indexterm>
61390 There are two special conditions which, though available in users&#x2019; filter
61391 files, are designed for use in system filters. The condition <option>first_delivery</option>
61392 is true only for the first attempt at delivering a message, and
61393 <option>manually_thawed</option> is true only if the message has been frozen, and
61394 subsequently thawed by an admin user. An explicit forced delivery counts as a
61395 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
61396 </para>
61397 <para>
61398 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
61399 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
61400 succeed, it will not be tried again.
61401 If you want Exim to retry an unseen delivery until it succeeds, you should
61402 arrange to set it up every time the filter runs.
61403 </para>
61404 <para>
61405 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
61406 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
61407 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
61408 to which users&#x2019; filter files can refer.
61409 </para>
61410 </section>
61411 <section id="SECID215">
61412 <title>Additional variable for system filters</title>
61413 <para>
61414 <indexterm role="variable">
61415 <primary><varname>$recipients</varname></primary>
61416 </indexterm>
61417 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
61418 of the message (separated by commas and white space), is available in system
61419 filters. It is not available in users&#x2019; filters for privacy reasons.
61420 </para>
61421 </section>
61422 <section id="SECID216">
61423 <title>Defer, freeze, and fail commands for system filters</title>
61424 <para>
61425 <indexterm role="concept">
61426 <primary>freezing messages</primary>
61427 </indexterm>
61428 <indexterm role="concept">
61429 <primary>message</primary>
61430 <secondary>freezing</secondary>
61431 </indexterm>
61432 <indexterm role="concept">
61433 <primary>message</primary>
61434 <secondary>forced failure</secondary>
61435 </indexterm>
61436 <indexterm role="concept">
61437 <primary><option>fail</option></primary>
61438 <secondary>in system filter</secondary>
61439 </indexterm>
61440 <indexterm role="concept">
61441 <primary><option>freeze</option> in system filter</primary>
61442 </indexterm>
61443 <indexterm role="concept">
61444 <primary><option>defer</option> in system filter</primary>
61445 </indexterm>
61446 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
61447 always available in system filters, but are not normally enabled in users&#x2019;
61448 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
61449 for the <command>redirect</command> router.) These commands can optionally be followed by the
61450 word <option>text</option> and a string containing an error message, for example:
61451 </para>
61452 <literallayout class="monospaced">
61453 fail text "this message looks like spam to me"
61454 </literallayout>
61455 <para>
61456 The keyword <option>text</option> is optional if the next character is a double quote.
61457 </para>
61458 <para>
61459 The <option>defer</option> command defers delivery of the original recipients of the
61460 message. The <option>fail</option> command causes all the original recipients to be failed,
61461 and a bounce message to be created. The <option>freeze</option> command suspends all
61462 delivery attempts for the original recipients. In all cases, any new deliveries
61463 that are specified by the filter are attempted as normal after the filter has
61464 run.
61465 </para>
61466 <para>
61467 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
61468 not manually frozen since. This means that automatic freezing by a system
61469 filter can be used as a way of checking out suspicious messages. If a message
61470 is found to be all right, manually unfreezing it allows it to be delivered.
61471 </para>
61472 <para>
61473 <indexterm role="concept">
61474 <primary>log</primary>
61475 <secondary><option>fail</option> command log line</secondary>
61476 </indexterm>
61477 <indexterm role="concept">
61478 <primary><option>fail</option></primary>
61479 <secondary>log line; reducing</secondary>
61480 </indexterm>
61481 The text given with a fail command is used as part of the bounce message as
61482 well as being written to the log. If the message is quite long, this can fill
61483 up a lot of log space when such failures are common. To reduce the size of the
61484 log message, Exim interprets the text in a special way if it starts with the
61485 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
61486 strings is written to the log, and the rest of the text is used in the bounce
61487 message. For example:
61488 </para>
61489 <literallayout class="monospaced">
61490 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
61491      because it contains attachments that we are \
61492      not prepared to receive."
61493 </literallayout>
61494 <para>
61495 <indexterm role="concept">
61496 <primary>loop</primary>
61497 <secondary>caused by <option>fail</option></secondary>
61498 </indexterm>
61499 Take great care with the <option>fail</option> command when basing the decision to fail on
61500 the contents of the message, because the bounce message will of course include
61501 the contents of the original message and will therefore trigger the <option>fail</option>
61502 command again (causing a mail loop) unless steps are taken to prevent this.
61503 Testing the <option>error_message</option> condition is one way to prevent this. You could
61504 use, for example
61505 </para>
61506 <literallayout class="monospaced">
61507 if $message_body contains "this is spam" and not error_message
61508 then fail text "spam is not wanted here" endif
61509 </literallayout>
61510 <para>
61511 though of course that might let through unwanted bounce messages. The
61512 alternative is clever checking of the body and/or headers to detect bounces
61513 generated by the filter.
61514 </para>
61515 <para>
61516 The interpretation of a system filter file ceases after a
61517 <option>defer</option>,
61518 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
61519 set up earlier in the filter file are honoured, so you can use a sequence such
61520 as
61521 </para>
61522 <literallayout class="monospaced">
61523 mail ...
61524 freeze
61525 </literallayout>
61526 <para>
61527 to send a specified message when the system filter is freezing (or deferring or
61528 failing) a message. The normal deliveries for the message do not, of course,
61529 take place.
61530 </para>
61531 </section>
61532 <section id="SECTaddremheasys">
61533 <title>Adding and removing headers in a system filter</title>
61534 <para>
61535 <indexterm role="concept">
61536 <primary>header lines</primary>
61537 <secondary>adding; in system filter</secondary>
61538 </indexterm>
61539 <indexterm role="concept">
61540 <primary>header lines</primary>
61541 <secondary>removing; in system filter</secondary>
61542 </indexterm>
61543 <indexterm role="concept">
61544 <primary>filter</primary>
61545 <secondary>header lines; adding/removing</secondary>
61546 </indexterm>
61547 Two filter commands that are available only in system filters are:
61548 </para>
61549 <literallayout class="monospaced">
61550 headers add &lt;string&gt;
61551 headers remove &lt;string&gt;
61552 </literallayout>
61553 <para>
61554 The argument for the <option>headers add</option> is a string that is expanded and then
61555 added to the end of the message&#x2019;s headers. It is the responsibility of the
61556 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
61557 space is ignored, and if the string is otherwise empty, or if the expansion is
61558 forced to fail, the command has no effect.
61559 </para>
61560 <para>
61561 You can use <quote>\n</quote> within the string, followed by white space, to specify
61562 continued header lines. More than one header may be added in one command by
61563 including <quote>\n</quote> within the string without any following white space. For
61564 example:
61565 </para>
61566 <literallayout class="monospaced">
61567 headers add "X-header-1: ....\n  \
61568              continuation of X-header-1 ...\n\
61569              X-header-2: ...."
61570 </literallayout>
61571 <para>
61572 Note that the header line continuation white space after the first newline must
61573 be placed before the backslash that continues the input string, because white
61574 space after input continuations is ignored.
61575 </para>
61576 <para>
61577 The argument for <option>headers remove</option> is a colon-separated list of header names.
61578 This command applies only to those headers that are stored with the message;
61579 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
61580 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
61581 header with the same name, they are all removed.
61582 </para>
61583 <para>
61584 The <option>headers</option> command in a system filter makes an immediate change to the set
61585 of header lines that was received with the message (with possible additions
61586 from ACL processing). Subsequent commands in the system filter operate on the
61587 modified set, which also forms the basis for subsequent message delivery.
61588 Unless further modified during routing or transporting, this set of headers is
61589 used for all recipients of the message.
61590 </para>
61591 <para>
61592 During routing and transporting, the variables that refer to the contents of
61593 header lines refer only to those lines that are in this set. Thus, header lines
61594 that are added by a system filter are visible to users&#x2019; filter files and to all
61595 routers and transports. This contrasts with the manipulation of header lines by
61596 routers and transports, which is not immediate, but which instead is saved up
61597 until the message is actually being written (see section
61598 <xref linkend="SECTheadersaddrem"/>).
61599 </para>
61600 <para>
61601 If the message is not delivered at the first attempt, header lines that were
61602 added by the system filter are stored with the message, and so are still
61603 present at the next delivery attempt. Header lines that were removed are still
61604 present, but marked <quote>deleted</quote> so that they are not transported with the
61605 message. For this reason, it is usual to make the <option>headers</option> command
61606 conditional on <option>first_delivery</option> so that the set of header lines is not
61607 modified more than once.
61608 </para>
61609 <para>
61610 Because header modification in a system filter acts immediately, you have to
61611 use an indirect approach if you want to modify the contents of a header line.
61612 For example:
61613 </para>
61614 <literallayout class="monospaced">
61615 headers add "Old-Subject: $h_subject:"
61616 headers remove "Subject"
61617 headers add "Subject: new subject (was: $h_old-subject:)"
61618 headers remove "Old-Subject"
61619 </literallayout>
61620 </section>
61621 <section id="SECID217">
61622 <title>Setting an errors address in a system filter</title>
61623 <para>
61624 <indexterm role="concept">
61625 <primary>envelope sender</primary>
61626 </indexterm>
61627 In a system filter, if a <option>deliver</option> command is followed by
61628 </para>
61629 <literallayout class="monospaced">
61630 errors_to &lt;some address&gt;
61631 </literallayout>
61632 <para>
61633 in order to change the envelope sender (and hence the error reporting) for that
61634 delivery, any address may be specified. (In a user filter, only the current
61635 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
61636 might use
61637 </para>
61638 <literallayout class="monospaced">
61639 unseen deliver monitor@spying.example errors_to root@local.example
61640 </literallayout>
61641 <para>
61642 to take a copy which would not be sent back to the normal error reporting
61643 address if its delivery failed.
61644 </para>
61645 </section>
61646 <section id="SECTperaddfil">
61647 <title>Per-address filtering</title>
61648 <para>
61649 <indexterm role="variable">
61650 <primary><varname>$domain</varname></primary>
61651 </indexterm>
61652 <indexterm role="variable">
61653 <primary><varname>$local_part</varname></primary>
61654 </indexterm>
61655 In contrast to the system filter, which is run just once per message for each
61656 delivery attempt, it is also possible to set up a system-wide filtering
61657 operation that runs once for each recipient address. In this case, variables
61658 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
61659 filter file could be made dependent on them. This is an example of a router
61660 which implements such a filter:
61661 </para>
61662 <literallayout class="monospaced">
61663 central_filter:
61664   check_local_user
61665   driver = redirect
61666   domains = +local_domains
61667   file = /central/filters/$local_part
61668   no_verify
61669   allow_filter
61670   allow_freeze
61671 </literallayout>
61672 <para>
61673 The filter is run in a separate process under its own uid. Therefore, either
61674 <option>check_local_user</option> must be set (as above), in which case the filter is run as
61675 the local user, or the <option>user</option> option must be used to specify which user to
61676 use. If both are set, <option>user</option> overrides.
61677 </para>
61678 <para>
61679 Care should be taken to ensure that none of the commands in the filter file
61680 specify a significant delivery if the message is to go on to be delivered to
61681 its intended recipient. The router will not then claim to have dealt with the
61682 address, so it will be passed on to subsequent routers to be delivered in the
61683 normal way.
61684 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
61685 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
61686 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
61687 </para>
61688 </section>
61689 </chapter>
61690
61691 <chapter id="CHAPmsgproc">
61692 <title>Message processing</title>
61693 <para>
61694 <indexterm role="concept" id="IIDmesproc" class="startofrange">
61695 <primary>message</primary>
61696 <secondary>general processing</secondary>
61697 </indexterm>
61698 Exim performs various transformations on the sender and recipient addresses of
61699 all messages that it handles, and also on the messages&#x2019; header lines. Some of
61700 these are optional and configurable, while others always take place. All of
61701 this processing, except rewriting as a result of routing, and the addition or
61702 removal of header lines while delivering, happens when a message is received,
61703 before it is placed on Exim&#x2019;s queue.
61704 </para>
61705 <para>
61706 Some of the automatic processing takes place by default only for
61707 <quote>locally-originated</quote> messages. This adjective is used to describe messages
61708 that are not received over TCP/IP, but instead are passed to an Exim process on
61709 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
61710 set up by the <option>-bs</option> command line option.
61711 </para>
61712 <para>
61713 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
61714 or ::1) are not considered to be locally-originated. Exim does not treat the
61715 loopback interface specially in any way.
61716 </para>
61717 <para>
61718 If you want the loopback interface to be treated specially, you must ensure
61719 that there are appropriate entries in your ACLs.
61720 </para>
61721 <section id="SECTsubmodnon">
61722 <title>Submission mode for non-local messages</title>
61723 <para>
61724 <indexterm role="concept">
61725 <primary>message</primary>
61726 <secondary>submission</secondary>
61727 </indexterm>
61728 <indexterm role="concept">
61729 <primary>submission mode</primary>
61730 </indexterm>
61731 Processing that happens automatically for locally-originated messages (unless
61732 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
61733 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
61734 state. Submission mode is set by the modifier
61735 </para>
61736 <literallayout class="monospaced">
61737 control = submission
61738 </literallayout>
61739 <para>
61740 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
61741 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
61742 a local submission, and is normally used when the source of the message is
61743 known to be an MUA running on a client host (as opposed to an MTA). For
61744 example, to set submission mode for messages originating on the IPv4 loopback
61745 interface, you could include the following in the MAIL ACL:
61746 </para>
61747 <literallayout class="monospaced">
61748 warn  hosts = 127.0.0.1
61749       control = submission
61750 </literallayout>
61751 <para>
61752 <indexterm role="concept">
61753 <primary><option>sender_retain</option> submission option</primary>
61754 </indexterm>
61755 There are some options that can be used when setting submission mode. A slash
61756 is used to separate options. For example:
61757 </para>
61758 <literallayout class="monospaced">
61759 control = submission/sender_retain
61760 </literallayout>
61761 <para>
61762 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
61763 true and <option>local_from_check</option> false for the current incoming message. The first
61764 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
61765 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
61766 authenticated sender. With this setting, Exim still fixes up messages by adding
61767 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
61768 attempt to check sender authenticity in header lines.
61769 </para>
61770 <para>
61771 When <option>sender_retain</option> is not set, a submission mode setting may specify a
61772 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
61773 example:
61774 </para>
61775 <literallayout class="monospaced">
61776 control = submission/domain=some.domain
61777 </literallayout>
61778 <para>
61779 The domain may be empty. How this value is used is described in sections
61780 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
61781 that allows you to specify the user&#x2019;s full name for inclusion in a created
61782 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
61783 </para>
61784 <literallayout class="monospaced">
61785 accept authenticated = *
61786        control = submission/domain=wonderland.example/\
61787                             name=${lookup {$authenticated_id} \
61788                                    lsearch {/etc/exim/namelist}}
61789 </literallayout>
61790 <para>
61791 Because the name may contain any characters, including slashes, the <option>name</option>
61792 option must be given last. The remainder of the string is used as the name. For
61793 the example above, if <filename>/etc/exim/namelist</filename> contains:
61794 </para>
61795 <literallayout class="monospaced">
61796 bigegg:  Humpty Dumpty
61797 </literallayout>
61798 <para>
61799 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
61800 line would be:
61801 </para>
61802 <literallayout class="monospaced">
61803 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
61804 </literallayout>
61805 <para>
61806 <indexterm role="concept">
61807 <primary>return path</primary>
61808 <secondary>in submission mode</secondary>
61809 </indexterm>
61810 By default, submission mode forces the return path to the same address as is
61811 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
61812 specified, the return path is also left unchanged.
61813 </para>
61814 <para>
61815 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
61816 ACL. This means that any sender checks performed before the fix-ups use the
61817 untrusted sender address specified by the user, not the trusted sender address
61818 specified by submission mode. Although this might be slightly unexpected, it
61819 does mean that you can configure ACL checks to spot that a user is trying to
61820 spoof another&#x2019;s address.
61821 </para>
61822 </section>
61823 <section id="SECTlineendings">
61824 <title>Line endings</title>
61825 <para>
61826 <indexterm role="concept">
61827 <primary>line endings</primary>
61828 </indexterm>
61829 <indexterm role="concept">
61830 <primary>carriage return</primary>
61831 </indexterm>
61832 <indexterm role="concept">
61833 <primary>linefeed</primary>
61834 </indexterm>
61835 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
61836 linefeed) is the line ending for messages transmitted over the Internet using
61837 SMTP over TCP/IP. However, within individual operating systems, different
61838 conventions are used. For example, Unix-like systems use just LF, but others
61839 use CRLF or just CR.
61840 </para>
61841 <para>
61842 Exim was designed for Unix-like systems, and internally, it stores messages
61843 using the system&#x2019;s convention of a single LF as a line terminator. When
61844 receiving a message, all line endings are translated to this standard format.
61845 Originally, it was thought that programs that passed messages directly to an
61846 MTA within an operating system would use that system&#x2019;s convention. Experience
61847 has shown that this is not the case; for example, there are Unix applications
61848 that use CRLF in this circumstance. For this reason, and for compatibility with
61849 other MTAs, the way Exim handles line endings for all messages is now as
61850 follows:
61851 </para>
61852 <itemizedlist>
61853 <listitem>
61854 <para>
61855 LF not preceded by CR is treated as a line ending.
61856 </para>
61857 </listitem>
61858 <listitem>
61859 <para>
61860 CR is treated as a line ending; if it is immediately followed by LF, the LF
61861 is ignored.
61862 </para>
61863 </listitem>
61864 <listitem>
61865 <para>
61866 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
61867 nor a local message in the state where a line containing only a dot is a
61868 terminator.
61869 </para>
61870 </listitem>
61871 <listitem>
61872 <para>
61873 If a bare CR is encountered within a header line, an extra space is added after
61874 the line terminator so as not to end the header line. The reasoning behind this
61875 is that bare CRs in header lines are most likely either to be mistakes, or
61876 people trying to play silly games.
61877 </para>
61878 </listitem>
61879 <listitem>
61880 <para>
61881 If the first header line received in a message ends with CRLF, a subsequent
61882 bare LF in a header line is treated in the same way as a bare CR in a header
61883 line.
61884 </para>
61885 </listitem>
61886 </itemizedlist>
61887 </section>
61888 <section id="SECID218">
61889 <title>Unqualified addresses</title>
61890 <para>
61891 <indexterm role="concept">
61892 <primary>unqualified addresses</primary>
61893 </indexterm>
61894 <indexterm role="concept">
61895 <primary>address</primary>
61896 <secondary>qualification</secondary>
61897 </indexterm>
61898 By default, Exim expects every envelope address it receives from an external
61899 host to be fully qualified. Unqualified addresses cause negative responses to
61900 SMTP commands. However, because SMTP is used as a means of transporting
61901 messages from MUAs running on personal workstations, there is sometimes a
61902 requirement to accept unqualified addresses from specific hosts or IP networks.
61903 </para>
61904 <para>
61905 Exim has two options that separately control which hosts may send unqualified
61906 sender or recipient addresses in SMTP commands, namely
61907 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
61908 cases, if an unqualified address is accepted, it is qualified by adding the
61909 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
61910 </para>
61911 <para>
61912 <indexterm role="option">
61913 <primary><option>qualify_domain</option></primary>
61914 </indexterm>
61915 <indexterm role="option">
61916 <primary><option>qualify_recipient</option></primary>
61917 </indexterm>
61918 Unqualified addresses in header lines are automatically qualified for messages
61919 that are locally originated, unless the <option>-bnq</option> option is given on the command
61920 line. For messages received over SMTP, unqualified addresses in header lines
61921 are qualified only if unqualified addresses are permitted in SMTP commands. In
61922 other words, such qualification is also controlled by
61923 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
61924 </para>
61925 </section>
61926 <section id="SECID219">
61927 <title>The UUCP From line</title>
61928 <para>
61929 <indexterm role="concept">
61930 <primary><quote>From</quote> line</primary>
61931 </indexterm>
61932 <indexterm role="concept">
61933 <primary>UUCP</primary>
61934 <secondary><quote>From</quote> line</secondary>
61935 </indexterm>
61936 <indexterm role="concept">
61937 <primary>sender</primary>
61938 <secondary>address</secondary>
61939 </indexterm>
61940 <indexterm role="option">
61941 <primary><option>uucp_from_pattern</option></primary>
61942 </indexterm>
61943 <indexterm role="option">
61944 <primary><option>uucp_from_sender</option></primary>
61945 </indexterm>
61946 <indexterm role="concept">
61947 <primary>envelope sender</primary>
61948 </indexterm>
61949 <indexterm role="concept">
61950 <primary>Sendmail compatibility</primary>
61951 <secondary><quote>From</quote> line</secondary>
61952 </indexterm>
61953 Messages that have come from UUCP (and some other applications) often begin
61954 with a line containing the envelope sender and a timestamp, following the word
61955 <quote>From</quote>. Examples of two common formats are:
61956 </para>
61957 <literallayout class="monospaced">
61958 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
61959 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
61960 </literallayout>
61961 <para>
61962 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
61963 Exim recognizes such lines at the start of messages that are submitted to it
61964 via the command line (that is, on the standard input). It does not recognize
61965 such lines in incoming SMTP messages, unless the sending host matches
61966 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
61967 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
61968 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
61969 default value matches the two common cases shown above and puts the address
61970 that follows <quote>From</quote> into <varname>$1</varname>.
61971 </para>
61972 <para>
61973 <indexterm role="concept">
61974 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
61975 <secondary>in <quote>From </quote> line handling</secondary>
61976 </indexterm>
61977 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
61978 a trusted user, the message&#x2019;s sender address is constructed by expanding the
61979 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
61980 then parsed as an RFC 2822 address. If there is no domain, the local part is
61981 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
61982 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
61983 </para>
61984 <para>
61985 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
61986 sender address is not changed. This is also the case for incoming SMTP messages
61987 that are permitted to contain <quote>From</quote> lines.
61988 </para>
61989 <para>
61990 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
61991 treated as a data line that starts the body of the message, as it is not valid
61992 as a header line. This also happens if a <quote>From</quote> line is present in an
61993 incoming SMTP message from a source that is not permitted to send them.
61994 </para>
61995 </section>
61996 <section id="SECID220">
61997 <title>Resent- header lines</title>
61998 <para>
61999 <indexterm role="concept">
62000 <primary><option>Resent-</option> header lines</primary>
62001 </indexterm>
62002 <indexterm role="concept">
62003 <primary>header lines</primary>
62004 <secondary>Resent-</secondary>
62005 </indexterm>
62006 RFC 2822 makes provision for sets of header lines starting with the string
62007 <literal>Resent-</literal> to be added to a message when it is resent by the original
62008 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
62009 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
62010 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
62011 </para>
62012 <blockquote>
62013 <para>
62014 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
62015 processing of replies or other such automatic actions on messages.</emphasis>
62016 </para>
62017 </blockquote>
62018 <para>
62019 This leaves things a bit vague as far as other processing actions such as
62020 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
62021 follows:
62022 </para>
62023 <itemizedlist>
62024 <listitem>
62025 <para>
62026 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
62027 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
62028 </para>
62029 </listitem>
62030 <listitem>
62031 <para>
62032 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
62033 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
62034 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
62035 </para>
62036 </listitem>
62037 <listitem>
62038 <para>
62039 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
62040 also removed.
62041 </para>
62042 </listitem>
62043 <listitem>
62044 <para>
62045 For a locally-submitted message,
62046 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
62047 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
62048 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
62049 included in log lines in this case.
62050 </para>
62051 </listitem>
62052 <listitem>
62053 <para>
62054 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
62055 <option>Resent-</option> header lines are present.
62056 </para>
62057 </listitem>
62058 </itemizedlist>
62059 </section>
62060 <section id="SECID221">
62061 <title>The Auto-Submitted: header line</title>
62062 <para>
62063 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
62064 includes the header line:
62065 </para>
62066 <literallayout class="monospaced">
62067 Auto-Submitted: auto-replied
62068 </literallayout>
62069 </section>
62070 <section id="SECID222">
62071 <title>The Bcc: header line</title>
62072 <para>
62073 <indexterm role="concept">
62074 <primary><emphasis>Bcc:</emphasis> header line</primary>
62075 </indexterm>
62076 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
62077 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
62078 extracting its addresses). If <option>-t</option> is not present on the command line, any
62079 existing <emphasis>Bcc:</emphasis> is not removed.
62080 </para>
62081 </section>
62082 <section id="SECID223">
62083 <title>The Date: header line</title>
62084 <para>
62085 <indexterm role="concept">
62086 <primary><emphasis>Date:</emphasis> header line</primary>
62087 </indexterm>
62088 <indexterm role="concept">
62089 <primary>header lines</primary>
62090 <secondary>Date:</secondary>
62091 </indexterm>
62092 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
62093 Exim adds one, using the current date and time, unless the
62094 <option>suppress_local_fixups</option> control has been specified.
62095 </para>
62096 </section>
62097 <section id="SECID224">
62098 <title>The Delivery-date: header line</title>
62099 <para>
62100 <indexterm role="concept">
62101 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
62102 </indexterm>
62103 <indexterm role="option">
62104 <primary><option>delivery_date_remove</option></primary>
62105 </indexterm>
62106 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
62107 set. Exim can be configured to add them to the final delivery of messages. (See
62108 the generic <option>delivery_date_add</option> transport option.) They should not be present
62109 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
62110 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
62111 messages.
62112 </para>
62113 </section>
62114 <section id="SECID225">
62115 <title>The Envelope-to: header line</title>
62116 <para>
62117 <indexterm role="concept">
62118 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
62119 </indexterm>
62120 <indexterm role="concept">
62121 <primary>header lines</primary>
62122 <secondary>Envelope-to:</secondary>
62123 </indexterm>
62124 <indexterm role="option">
62125 <primary><option>envelope_to_remove</option></primary>
62126 </indexterm>
62127 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
62128 Exim can be configured to add them to the final delivery of messages. (See the
62129 generic <option>envelope_to_add</option> transport option.) They should not be present in
62130 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
62131 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
62132 messages.
62133 </para>
62134 </section>
62135 <section id="SECTthefrohea">
62136 <title>The From: header line</title>
62137 <para>
62138 <indexterm role="concept">
62139 <primary><emphasis>From:</emphasis> header line</primary>
62140 </indexterm>
62141 <indexterm role="concept">
62142 <primary>header lines</primary>
62143 <secondary>From:</secondary>
62144 </indexterm>
62145 <indexterm role="concept">
62146 <primary>Sendmail compatibility</primary>
62147 <secondary><quote>From</quote> line</secondary>
62148 </indexterm>
62149 <indexterm role="concept">
62150 <primary>message</primary>
62151 <secondary>submission</secondary>
62152 </indexterm>
62153 <indexterm role="concept">
62154 <primary>submission mode</primary>
62155 </indexterm>
62156 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
62157 adds one if either of the following conditions is true:
62158 </para>
62159 <itemizedlist>
62160 <listitem>
62161 <para>
62162 The envelope sender address is not empty (that is, this is not a bounce
62163 message). The added header line copies the envelope sender address.
62164 </para>
62165 </listitem>
62166 <listitem>
62167 <para>
62168 <indexterm role="variable">
62169 <primary><varname>$authenticated_id</varname></primary>
62170 </indexterm>
62171 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
62172 </para>
62173 <orderedlist numeration="arabic">
62174 <listitem>
62175 <para>
62176 <indexterm role="variable">
62177 <primary><varname>$qualify_domain</varname></primary>
62178 </indexterm>
62179 If no domain is specified by the submission control, the local part is
62180 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
62181 </para>
62182 </listitem>
62183 <listitem>
62184 <para>
62185 If a non-empty domain is specified by the submission control, the local
62186 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
62187 </para>
62188 </listitem>
62189 <listitem>
62190 <para>
62191 If an empty domain is specified by the submission control,
62192 <varname>$authenticated_id</varname> is assumed to be the complete address.
62193 </para>
62194 </listitem>
62195 </orderedlist>
62196 </listitem>
62197 </itemizedlist>
62198 <para>
62199 A non-empty envelope sender takes precedence.
62200 </para>
62201 <para>
62202 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
62203 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
62204 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
62205 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
62206 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
62207 <option>unknown_login</option> configuration option). The address is qualified with
62208 <option>qualify_domain</option>.
62209 </para>
62210 <para>
62211 For compatibility with Sendmail, if an incoming, non-SMTP message has a
62212 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
62213 user, this is replaced by an address containing the user&#x2019;s login name and full
62214 name as described in section <xref linkend="SECTconstr"/>.
62215 </para>
62216 </section>
62217 <section id="SECID226">
62218 <title>The Message-ID: header line</title>
62219 <para>
62220 <indexterm role="concept">
62221 <primary><emphasis>Message-ID:</emphasis> header line</primary>
62222 </indexterm>
62223 <indexterm role="concept">
62224 <primary>header lines</primary>
62225 <secondary>Message-ID:</secondary>
62226 </indexterm>
62227 <indexterm role="concept">
62228 <primary>message</primary>
62229 <secondary>submission</secondary>
62230 </indexterm>
62231 <indexterm role="option">
62232 <primary><option>message_id_header_text</option></primary>
62233 </indexterm>
62234 If a locally-generated or submission-mode incoming message does not contain a
62235 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
62236 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
62237 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
62238 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
62239 message id, preceded by the letter E to ensure it starts with a letter, and
62240 followed by @ and the primary host name. Additional information can be included
62241 in this header line by setting the <option>message_id_header_text</option> and/or
62242 <option>message_id_header_domain</option> options.
62243 </para>
62244 </section>
62245 <section id="SECID227">
62246 <title>The Received: header line</title>
62247 <para>
62248 <indexterm role="concept">
62249 <primary><emphasis>Received:</emphasis> header line</primary>
62250 </indexterm>
62251 <indexterm role="concept">
62252 <primary>header lines</primary>
62253 <secondary>Received:</secondary>
62254 </indexterm>
62255 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
62256 contents are defined by the <option>received_header_text</option> configuration option, and
62257 Exim automatically adds a semicolon and a timestamp to the configured string.
62258 </para>
62259 <para>
62260 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
62261 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
62262 line is the time that the message started to be received. This is the value
62263 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
62264 </para>
62265 <para>
62266 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
62267 changed to the time of acceptance, which is (apart from a small delay while the
62268 -H spool file is written) the earliest time at which delivery could start.
62269 </para>
62270 </section>
62271 <section id="SECID228">
62272 <title>The References: header line</title>
62273 <para>
62274 <indexterm role="concept">
62275 <primary><emphasis>References:</emphasis> header line</primary>
62276 </indexterm>
62277 <indexterm role="concept">
62278 <primary>header lines</primary>
62279 <secondary>References:</secondary>
62280 </indexterm>
62281 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
62282 header line. This is constructed according to the rules that are described in
62283 section 3.64 of RFC 2822 (which states that replies should contain such a
62284 header line), and section 3.14 of RFC 3834 (which states that automatic
62285 responses are not different in this respect). However, because some mail
62286 processing software does not cope well with very long header lines, no more
62287 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
62288 incoming message. If there are more than 12, the first one and then the final
62289 11 are copied, before adding the message ID of the incoming message.
62290 </para>
62291 </section>
62292 <section id="SECID229">
62293 <title>The Return-path: header line</title>
62294 <para>
62295 <indexterm role="concept">
62296 <primary><emphasis>Return-path:</emphasis> header line</primary>
62297 </indexterm>
62298 <indexterm role="concept">
62299 <primary>header lines</primary>
62300 <secondary>Return-path:</secondary>
62301 </indexterm>
62302 <indexterm role="option">
62303 <primary><option>return_path_remove</option></primary>
62304 </indexterm>
62305 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
62306 it does the final delivery of messages. (See the generic <option>return_path_add</option>
62307 transport option.) Therefore, they should not be present in messages in
62308 transit. If the <option>return_path_remove</option> configuration option is set (the
62309 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
62310 </para>
62311 </section>
62312 <section id="SECTthesenhea">
62313 <title>The Sender: header line</title>
62314 <para>
62315 <indexterm role="concept">
62316 <primary><emphasis>Sender:</emphasis> header line</primary>
62317 </indexterm>
62318 <indexterm role="concept">
62319 <primary>message</primary>
62320 <secondary>submission</secondary>
62321 </indexterm>
62322 <indexterm role="concept">
62323 <primary>header lines</primary>
62324 <secondary>Sender:</secondary>
62325 </indexterm>
62326 For a locally-originated message from an untrusted user, Exim may remove an
62327 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
62328 these actions by setting the <option>local_sender_retain</option> option true, the
62329 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
62330 control setting.
62331 </para>
62332 <para>
62333 When a local message is received from an untrusted user and
62334 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
62335 control has not been set, a check is made to see if the address given in the
62336 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
62337 that is expected has the login name as the local part and the value of
62338 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
62339 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
62340 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
62341 line is added to the message.
62342 </para>
62343 <para>
62344 If you set <option>local_from_check</option> false, this checking does not occur. However,
62345 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
62346 <option>local_sender_retain</option> to be true. It is not possible to set both of these
62347 options true at the same time.
62348 </para>
62349 <para>
62350 <indexterm role="concept">
62351 <primary>submission mode</primary>
62352 </indexterm>
62353 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
62354 received over TCP/IP or for messages submitted by trusted users. However, when
62355 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
62356 not specified on the submission control, the following processing takes place:
62357 </para>
62358 <para>
62359 <indexterm role="variable">
62360 <primary><varname>$authenticated_id</varname></primary>
62361 </indexterm>
62362 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
62363 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
62364 created as follows:
62365 </para>
62366 <itemizedlist>
62367 <listitem>
62368 <para>
62369 <indexterm role="variable">
62370 <primary><varname>$qualify_domain</varname></primary>
62371 </indexterm>
62372 If no domain is specified by the submission control, the local part is
62373 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
62374 </para>
62375 </listitem>
62376 <listitem>
62377 <para>
62378 If a non-empty domain is specified by the submission control, the local part
62379 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
62380 </para>
62381 </listitem>
62382 <listitem>
62383 <para>
62384 If an empty domain is specified by the submission control,
62385 <varname>$authenticated_id</varname> is assumed to be the complete address.
62386 </para>
62387 </listitem>
62388 </itemizedlist>
62389 <para>
62390 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
62391 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
62392 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
62393 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
62394 </para>
62395 <para>
62396 <indexterm role="concept">
62397 <primary>return path</primary>
62398 <secondary>created from <emphasis>Sender:</emphasis></secondary>
62399 </indexterm>
62400 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
62401 the message (the envelope sender address) is changed to be the same address,
62402 except in the case of submission mode when <option>sender_retain</option> is specified.
62403 </para>
62404 </section>
62405 <section id="SECTheadersaddrem">
62406 <title>Adding and removing header lines in routers and transports</title>
62407 <para>
62408 <indexterm role="concept">
62409 <primary>header lines</primary>
62410 <secondary>adding; in router or transport</secondary>
62411 </indexterm>
62412 <indexterm role="concept">
62413 <primary>header lines</primary>
62414 <secondary>removing; in router or transport</secondary>
62415 </indexterm>
62416 When a message is delivered, the addition and removal of header lines can be
62417 specified in a system filter, or on any of the routers and transports that
62418 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
62419 modifying headers in a system filter. Header lines can also be added in an ACL
62420 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
62421 </para>
62422 <para>
62423 In contrast to what happens in a system filter, header modifications that are
62424 specified on routers and transports apply only to the particular recipient
62425 addresses that are being processed by those routers and transports. These
62426 changes do not actually take place until a copy of the message is being
62427 transported. Therefore, they do not affect the basic set of header lines, and
62428 they do not affect the values of the variables that refer to header lines.
62429 </para>
62430 <para>
62431 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
62432 the transport cannot refer to the modified header lines, because such
62433 expansions all occur before the message is actually transported.
62434 </para>
62435 <para>
62436 For both routers and transports, the argument of a <option>headers_add</option>
62437 option must be in the form of one or more RFC 2822 header lines, separated by
62438 newlines (coded as <quote>\n</quote>). For example:
62439 </para>
62440 <literallayout class="monospaced">
62441 headers_add = X-added-header: added by $primary_hostname\n\
62442               X-added-second: another added header line
62443 </literallayout>
62444 <para>
62445 Exim does not check the syntax of these added header lines.
62446 </para>
62447 <para>
62448 Multiple <option>headers_add</option> options for a single router or transport can be
62449 specified; the values will append to a single list of header lines.
62450 Each header-line is separately expanded.
62451 </para>
62452 <para>
62453 The argument of a <option>headers_remove</option> option must consist of a colon-separated
62454 list of header names. This is confusing, because header names themselves are
62455 often terminated by colons. In this case, the colons are the list separators,
62456 not part of the names. For example:
62457 </para>
62458 <literallayout class="monospaced">
62459 headers_remove = return-receipt-to:acknowledge-to
62460 </literallayout>
62461 <para>
62462 Multiple <option>headers_remove</option> options for a single router or transport can be
62463 specified; the arguments will append to a single header-names list.
62464 Each item is separately expanded.
62465 Note that colons in complex expansions which are used to
62466 form all or part of a <option>headers_remove</option> list
62467 will act as list separators.
62468 </para>
62469 <para>
62470 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
62471 items are expanded at routing time,
62472 and then associated with all addresses that are
62473 accepted by that router, and also with any new addresses that it generates. If
62474 an address passes through several routers as a result of aliasing or
62475 forwarding, the changes are cumulative.
62476 </para>
62477 <para>
62478 <indexterm role="option">
62479 <primary><option>unseen</option></primary>
62480 </indexterm>
62481 However, this does not apply to multiple routers that result from the use of
62482 the <option>unseen</option> option. Any header modifications that were specified by the
62483 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
62484 </para>
62485 <para>
62486 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
62487 settings cannot be delivered together in a batch, so a transport is always
62488 dealing with a set of addresses that have the same header-processing
62489 requirements.
62490 </para>
62491 <para>
62492 The transport starts by writing the original set of header lines that arrived
62493 with the message, possibly modified by the system filter. As it writes out
62494 these lines, it consults the list of header names that were attached to the
62495 recipient address(es) by <option>headers_remove</option> options in routers, and it also
62496 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
62497 names are on either of these lists are not written out. If there are multiple
62498 instances of any listed header, they are all skipped.
62499 </para>
62500 <para>
62501 After the remaining original header lines have been written, new header
62502 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
62503 the order in which they were attached to the address. These are followed by any
62504 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
62505 </para>
62506 <para>
62507 This way of handling header line modifications in routers and transports has
62508 the following consequences:
62509 </para>
62510 <itemizedlist>
62511 <listitem>
62512 <para>
62513 The original set of header lines, possibly modified by the system filter,
62514 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
62515 to it, at all times.
62516 </para>
62517 </listitem>
62518 <listitem>
62519 <para>
62520 Header lines that are added by a router&#x2019;s
62521 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
62522 expansion syntax in subsequent routers or the transport.
62523 </para>
62524 </listitem>
62525 <listitem>
62526 <para>
62527 Conversely, header lines that are specified for removal by <option>headers_remove</option>
62528 in a router remain visible to subsequent routers and the transport.
62529 </para>
62530 </listitem>
62531 <listitem>
62532 <para>
62533 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
62534 a later router or by a transport.
62535 </para>
62536 </listitem>
62537 <listitem>
62538 <para>
62539 An added header can refer to the contents of an original header that is to be
62540 removed, even it has the same name as the added header. For example:
62541 </para>
62542 <literallayout class="monospaced">
62543 headers_remove = subject
62544 headers_add = Subject: new subject (was: $h_subject:)
62545 </literallayout>
62546 </listitem>
62547 </itemizedlist>
62548 <para>
62549 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
62550 for a <command>redirect</command> router that has the <option>one_time</option> option set.
62551 </para>
62552 </section>
62553 <section id="SECTconstr">
62554 <title>Constructed addresses</title>
62555 <para>
62556 <indexterm role="concept">
62557 <primary>address</primary>
62558 <secondary>constructed</secondary>
62559 </indexterm>
62560 <indexterm role="concept">
62561 <primary>constructed address</primary>
62562 </indexterm>
62563 When Exim constructs a sender address for a locally-generated message, it uses
62564 the form
62565 </para>
62566 <literallayout>
62567 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
62568 </literallayout>
62569 <para>
62570 For example:
62571 </para>
62572 <literallayout class="monospaced">
62573 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
62574 </literallayout>
62575 <para>
62576 The user name is obtained from the <option>-F</option> command line option if set, or
62577 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
62578 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
62579 ampersand character, this is replaced by the login name with the first letter
62580 upper cased, as is conventional in a number of operating systems. See the
62581 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
62582 The <option>unknown_username</option> option can be used to specify user names in cases when
62583 there is no password file entry.
62584 </para>
62585 <para>
62586 <indexterm role="concept">
62587 <primary>RFC 2047</primary>
62588 </indexterm>
62589 In all cases, the user name is made to conform to RFC 2822 by quoting all or
62590 parts of it if necessary. In addition, if it contains any non-printing
62591 characters, it is encoded as described in RFC 2047, which defines a way of
62592 including non-ASCII characters in header lines. The value of the
62593 <option>headers_charset</option> option specifies the name of the encoding that is used (the
62594 characters are assumed to be in this encoding). The setting of
62595 <option>print_topbitchars</option> controls whether characters with the top bit set (that
62596 is, with codes greater than 127) count as printing characters or not.
62597 </para>
62598 </section>
62599 <section id="SECID230">
62600 <title>Case of local parts</title>
62601 <para>
62602 <indexterm role="concept">
62603 <primary>case of local parts</primary>
62604 </indexterm>
62605 <indexterm role="concept">
62606 <primary>local part</primary>
62607 <secondary>case of</secondary>
62608 </indexterm>
62609 RFC 2822 states that the case of letters in the local parts of addresses cannot
62610 be assumed to be non-significant. Exim preserves the case of local parts of
62611 addresses, but by default it uses a lower-cased form when it is routing,
62612 because on most Unix systems, usernames are in lower case and case-insensitive
62613 routing is required. However, any particular router can be made to use the
62614 original case for local parts by setting the <option>caseful_local_part</option> generic
62615 router option.
62616 </para>
62617 <para>
62618 <indexterm role="concept">
62619 <primary>mixed-case login names</primary>
62620 </indexterm>
62621 If you must have mixed-case user names on your system, the best way to proceed,
62622 assuming you want case-independent handling of incoming email, is to set up
62623 your first router to convert incoming local parts in your domains to the
62624 correct case by means of a file lookup. For example:
62625 </para>
62626 <literallayout class="monospaced">
62627 correct_case:
62628   driver = redirect
62629   domains = +local_domains
62630   data = ${lookup{$local_part}cdb\
62631               {/etc/usercased.cdb}{$value}fail}\
62632               @$domain
62633 </literallayout>
62634 <para>
62635 For this router, the local part is forced to lower case by the default action
62636 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
62637 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
62638 on any subsequent routers which process your domains, they will operate on
62639 local parts with the correct case in a case-sensitive manner.
62640 </para>
62641 </section>
62642 <section id="SECID231">
62643 <title>Dots in local parts</title>
62644 <para>
62645 <indexterm role="concept">
62646 <primary>dot</primary>
62647 <secondary>in local part</secondary>
62648 </indexterm>
62649 <indexterm role="concept">
62650 <primary>local part</primary>
62651 <secondary>dots in</secondary>
62652 </indexterm>
62653 RFC 2822 forbids empty components in local parts. That is, an unquoted local
62654 part may not begin or end with a dot, nor have two consecutive dots in the
62655 middle. However, it seems that many MTAs do not enforce this, so Exim permits
62656 empty components for compatibility.
62657 </para>
62658 </section>
62659 <section id="SECID232">
62660 <title>Rewriting addresses</title>
62661 <para>
62662 <indexterm role="concept">
62663 <primary>rewriting</primary>
62664 <secondary>addresses</secondary>
62665 </indexterm>
62666 Rewriting of sender and recipient addresses, and addresses in headers, can
62667 happen automatically, or as the result of configuration options, as described
62668 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
62669 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
62670 </para>
62671 <para>
62672 Automatic rewriting includes qualification, as mentioned above. The other case
62673 in which it can happen is when an incomplete non-local domain is given. The
62674 routing process may cause this to be expanded into the full domain name. For
62675 example, a header such as
62676 </para>
62677 <literallayout class="monospaced">
62678 To: hare@teaparty
62679 </literallayout>
62680 <para>
62681 might get rewritten as
62682 </para>
62683 <literallayout class="monospaced">
62684 To: hare@teaparty.wonderland.fict.example
62685 </literallayout>
62686 <para>
62687 Rewriting as a result of routing is the one kind of message processing that
62688 does not happen at input time, as it cannot be done until the address has
62689 been routed.
62690 </para>
62691 <para>
62692 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
62693 addresses have been routed, in case any of the headers get changed as a
62694 result of routing. However, doing this in practice would hold up many
62695 deliveries for unreasonable amounts of time, just because one address could not
62696 immediately be routed. Exim therefore does not delay other deliveries when
62697 routing of one or more addresses is deferred.
62698 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
62699 </para>
62700 </section>
62701 </chapter>
62702
62703 <chapter id="CHAPSMTP">
62704 <title>SMTP processing</title>
62705 <para>
62706 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
62707 <primary>SMTP</primary>
62708 <secondary>processing details</secondary>
62709 </indexterm>
62710 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
62711 <primary>LMTP</primary>
62712 <secondary>processing details</secondary>
62713 </indexterm>
62714 Exim supports a number of different ways of using the SMTP protocol, and its
62715 LMTP variant, which is an interactive protocol for transferring messages into a
62716 closed mail store application. This chapter contains details of how SMTP is
62717 processed. For incoming mail, the following are available:
62718 </para>
62719 <itemizedlist>
62720 <listitem>
62721 <para>
62722 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
62723 </para>
62724 </listitem>
62725 <listitem>
62726 <para>
62727 SMTP over the standard input and output (the <option>-bs</option> option);
62728 </para>
62729 </listitem>
62730 <listitem>
62731 <para>
62732 Batched SMTP on the standard input (the <option>-bS</option> option).
62733 </para>
62734 </listitem>
62735 </itemizedlist>
62736 <para>
62737 For mail delivery, the following are available:
62738 </para>
62739 <itemizedlist>
62740 <listitem>
62741 <para>
62742 SMTP over TCP/IP (the <command>smtp</command> transport);
62743 </para>
62744 </listitem>
62745 <listitem>
62746 <para>
62747 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
62748 <quote>lmtp</quote>);
62749 </para>
62750 </listitem>
62751 <listitem>
62752 <para>
62753 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
62754 transport);
62755 </para>
62756 </listitem>
62757 <listitem>
62758 <para>
62759 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
62760 the <option>use_bsmtp</option> option set).
62761 </para>
62762 </listitem>
62763 </itemizedlist>
62764 <para>
62765 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
62766 stored in or read from files (or pipes), in a format in which SMTP commands are
62767 used to contain the envelope information.
62768 </para>
62769 <section id="SECToutSMTPTCP">
62770 <title>Outgoing SMTP and LMTP over TCP/IP</title>
62771 <para>
62772 <indexterm role="concept">
62773 <primary>SMTP</primary>
62774 <secondary>outgoing over TCP/IP</secondary>
62775 </indexterm>
62776 <indexterm role="concept">
62777 <primary>outgoing SMTP over TCP/IP</primary>
62778 </indexterm>
62779 <indexterm role="concept">
62780 <primary>LMTP</primary>
62781 <secondary>over TCP/IP</secondary>
62782 </indexterm>
62783 <indexterm role="concept">
62784 <primary>outgoing LMTP over TCP/IP</primary>
62785 </indexterm>
62786 <indexterm role="concept">
62787 <primary>EHLO</primary>
62788 </indexterm>
62789 <indexterm role="concept">
62790 <primary>HELO</primary>
62791 </indexterm>
62792 <indexterm role="concept">
62793 <primary>SIZE option on MAIL command</primary>
62794 </indexterm>
62795 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
62796 The <option>protocol</option> option selects which protocol is to be used, but the actual
62797 processing is the same in both cases.
62798 </para>
62799 <para>
62800 If, in response to its EHLO command, Exim is told that the SIZE
62801 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
62802 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
62803 <option>size_addition</option> option (default 1024) to allow for additions to the message
62804 such as per-transport header lines, or changes made in a
62805 <indexterm role="concept">
62806 <primary>transport</primary>
62807 <secondary>filter</secondary>
62808 </indexterm>
62809 <indexterm role="concept">
62810 <primary>filter</primary>
62811 <secondary>transport filter</secondary>
62812 </indexterm>
62813 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
62814 suppressed.
62815 </para>
62816 <para>
62817 If the remote server advertises support for PIPELINING, Exim uses the
62818 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
62819 required for the transaction.
62820 </para>
62821 <para>
62822 If the remote server advertises support for the STARTTLS command, and Exim
62823 was built to support TLS encryption, it tries to start a TLS session unless the
62824 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
62825 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
62826 is called for verification.
62827 </para>
62828 <para>
62829 If the remote server advertises support for the AUTH command, Exim scans
62830 the authenticators configuration for any suitable client settings, as described
62831 in chapter <xref linkend="CHAPSMTPAUTH"/>.
62832 </para>
62833 <para>
62834 <indexterm role="concept">
62835 <primary>carriage return</primary>
62836 </indexterm>
62837 <indexterm role="concept">
62838 <primary>linefeed</primary>
62839 </indexterm>
62840 Responses from the remote host are supposed to be terminated by CR followed by
62841 LF. However, there are known to be hosts that do not send CR characters, so in
62842 order to be able to interwork with such hosts, Exim treats LF on its own as a
62843 line terminator.
62844 </para>
62845 <para>
62846 If a message contains a number of different addresses, all those with the same
62847 characteristics (for example, the same envelope sender) that resolve to the
62848 same set of hosts, in the same order, are sent in a single SMTP transaction,
62849 even if they are for different domains, unless there are more than the setting
62850 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
62851 they are split into groups containing no more than <option>max_rcpt</option>s addresses
62852 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
62853 in parallel sessions. The order of hosts with identical MX values is not
62854 significant when checking whether addresses can be batched in this way.
62855 </para>
62856 <para>
62857 When the <command>smtp</command> transport suffers a temporary failure that is not
62858 message-related, Exim updates its transport-specific database, which contains
62859 records indexed by host name that remember which messages are waiting for each
62860 particular host. It also updates the retry database with new retry times.
62861 </para>
62862 <para>
62863 <indexterm role="concept">
62864 <primary>hints database</primary>
62865 <secondary>retry keys</secondary>
62866 </indexterm>
62867 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
62868 a multi-homed host is broken, it will soon be skipped most of the time.
62869 See the next section for more detail about error handling.
62870 </para>
62871 <para>
62872 <indexterm role="concept">
62873 <primary>SMTP</primary>
62874 <secondary>passed connection</secondary>
62875 </indexterm>
62876 <indexterm role="concept">
62877 <primary>SMTP</primary>
62878 <secondary>batching over TCP/IP</secondary>
62879 </indexterm>
62880 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
62881 looks in the hints database for the transport to see if there are any queued
62882 messages waiting for the host to which it is connected. If it finds one, it
62883 creates a new Exim process using the <option>-MC</option> option (which can only be used by
62884 a process running as root or the Exim user) and passes the TCP/IP socket to it
62885 so that it can deliver another message using the same socket. The new process
62886 does only those deliveries that are routed to the connected host, and may in
62887 turn pass the socket on to a third process, and so on.
62888 </para>
62889 <para>
62890 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
62891 limit the number of messages sent down a single TCP/IP connection.
62892 </para>
62893 <para>
62894 <indexterm role="concept">
62895 <primary>asterisk</primary>
62896 <secondary>after IP address</secondary>
62897 </indexterm>
62898 The second and subsequent messages delivered down an existing connection are
62899 identified in the main log by the addition of an asterisk after the closing
62900 square bracket of the IP address.
62901 </para>
62902 </section>
62903 <section id="SECToutSMTPerr">
62904 <title>Errors in outgoing SMTP</title>
62905 <para>
62906 <indexterm role="concept">
62907 <primary>error</primary>
62908 <secondary>in outgoing SMTP</secondary>
62909 </indexterm>
62910 <indexterm role="concept">
62911 <primary>SMTP</primary>
62912 <secondary>errors in outgoing</secondary>
62913 </indexterm>
62914 <indexterm role="concept">
62915 <primary>host</primary>
62916 <secondary>error</secondary>
62917 </indexterm>
62918 Three different kinds of error are recognized for outgoing SMTP: host errors,
62919 message errors, and recipient errors.
62920 </para>
62921 <variablelist>
62922 <varlistentry>
62923 <term><emphasis role="bold">Host errors</emphasis></term>
62924 <listitem>
62925 <para>
62926 A host error is not associated with a particular message or with a
62927 particular recipient of a message. The host errors are:
62928 </para>
62929 <itemizedlist>
62930 <listitem>
62931 <para>
62932 Connection refused or timed out,
62933 </para>
62934 </listitem>
62935 <listitem>
62936 <para>
62937 Any error response code on connection,
62938 </para>
62939 </listitem>
62940 <listitem>
62941 <para>
62942 Any error response code to EHLO or HELO,
62943 </para>
62944 </listitem>
62945 <listitem>
62946 <para>
62947 Loss of connection at any time, except after <quote>.</quote>,
62948 </para>
62949 </listitem>
62950 <listitem>
62951 <para>
62952 I/O errors at any time,
62953 </para>
62954 </listitem>
62955 <listitem>
62956 <para>
62957 Timeouts during the session, other than in response to MAIL, RCPT or
62958 the <quote>.</quote> at the end of the data.
62959 </para>
62960 </listitem>
62961 </itemizedlist>
62962 <para>
62963 For a host error, a permanent error response on connection, or in response to
62964 EHLO, causes all addresses routed to the host to be failed. Any other host
62965 error causes all addresses to be deferred, and retry data to be created for the
62966 host. It is not tried again, for any message, until its retry time arrives. If
62967 the current set of addresses are not all delivered in this run (to some
62968 alternative host), the message is added to the list of those waiting for this
62969 host, so if it is still undelivered when a subsequent successful delivery is
62970 made to the host, it will be sent down the same SMTP connection.
62971 </para>
62972 </listitem></varlistentry>
62973 <varlistentry>
62974 <term><emphasis role="bold">Message errors</emphasis></term>
62975 <listitem>
62976 <para>
62977 <indexterm role="concept">
62978 <primary>message</primary>
62979 <secondary>error</secondary>
62980 </indexterm>
62981 A message error is associated with a particular message when sent to a
62982 particular host, but not with a particular recipient of the message. The
62983 message errors are:
62984 </para>
62985 <itemizedlist>
62986 <listitem>
62987 <para>
62988 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
62989 the data,
62990 </para>
62991 </listitem>
62992 <listitem>
62993 <para>
62994 Timeout after MAIL,
62995 </para>
62996 </listitem>
62997 <listitem>
62998 <para>
62999 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
63000 timeout after the DATA command itself is treated as a host error, as is loss of
63001 connection at any other time.
63002 </para>
63003 </listitem>
63004 </itemizedlist>
63005 <para>
63006 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
63007 to be failed, and a delivery error report to be returned to the sender. A
63008 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
63009 addresses to be deferred. Retry data is not created for the host, but instead,
63010 a retry record for the combination of host plus message id is created. The
63011 message is not added to the list of those waiting for this host. This ensures
63012 that the failing message will not be sent to this host again until the retry
63013 time arrives. However, other messages that are routed to the host are not
63014 affected, so if it is some property of the message that is causing the error,
63015 it will not stop the delivery of other mail.
63016 </para>
63017 <para>
63018 If the remote host specified support for the SIZE parameter in its response
63019 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
63020 over-large message will cause a message error because the error arrives as a
63021 response to MAIL.
63022 </para>
63023 </listitem></varlistentry>
63024 <varlistentry>
63025 <term><emphasis role="bold">Recipient errors</emphasis></term>
63026 <listitem>
63027 <para>
63028 <indexterm role="concept">
63029 <primary>recipient</primary>
63030 <secondary>error</secondary>
63031 </indexterm>
63032 A recipient error is associated with a particular recipient of a message. The
63033 recipient errors are:
63034 </para>
63035 <itemizedlist>
63036 <listitem>
63037 <para>
63038 Any error response to RCPT,
63039 </para>
63040 </listitem>
63041 <listitem>
63042 <para>
63043 Timeout after RCPT.
63044 </para>
63045 </listitem>
63046 </itemizedlist>
63047 <para>
63048 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
63049 recipient address to be failed, and a bounce message to be returned to the
63050 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
63051 address to be deferred, and routing retry data to be created for it. This is
63052 used to delay processing of the address in subsequent queue runs, until its
63053 routing retry time arrives. This applies to all messages, but because it
63054 operates only in queue runs, one attempt will be made to deliver a new message
63055 to the failing address before the delay starts to operate. This ensures that,
63056 if the failure is really related to the message rather than the recipient
63057 (<quote>message too big for this recipient</quote> is a possible example), other messages
63058 have a chance of getting delivered. If a delivery to the address does succeed,
63059 the retry information gets cleared, so all stuck messages get tried again, and
63060 the retry clock is reset.
63061 </para>
63062 <para>
63063 The message is not added to the list of those waiting for this host. Use of the
63064 host for other messages is unaffected, and except in the case of a timeout,
63065 other recipients are processed independently, and may be successfully delivered
63066 in the current SMTP session. After a timeout it is of course impossible to
63067 proceed with the session, so all addresses get deferred. However, those other
63068 than the one that failed do not suffer any subsequent retry delays. Therefore,
63069 if one recipient is causing trouble, the others have a chance of getting
63070 through when a subsequent delivery attempt occurs before the failing
63071 recipient&#x2019;s retry time.
63072 </para>
63073 </listitem></varlistentry>
63074 </variablelist>
63075 <para>
63076 In all cases, if there are other hosts (or IP addresses) available for the
63077 current set of addresses (for example, from multiple MX records), they are
63078 tried in this run for any undelivered addresses, subject of course to their
63079 own retry data. In other words, recipient error retry data does not take effect
63080 until the next delivery attempt.
63081 </para>
63082 <para>
63083 Some hosts have been observed to give temporary error responses to every
63084 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
63085 would be nice if such circumstances could be recognized, and defer data for the
63086 host itself created, but this is not possible within the current Exim design.
63087 What actually happens is that retry data for every (host, message) combination
63088 is created.
63089 </para>
63090 <para>
63091 The reason that timeouts after MAIL and RCPT are treated specially is that
63092 these can sometimes arise as a result of the remote host&#x2019;s verification
63093 procedures. Exim makes this assumption, and treats them as if a temporary error
63094 response had been received. A timeout after <quote>.</quote> is treated specially because
63095 it is known that some broken implementations fail to recognize the end of the
63096 message if the last character of the last line is a binary zero. Thus, it is
63097 helpful to treat this case as a message error.
63098 </para>
63099 <para>
63100 Timeouts at other times are treated as host errors, assuming a problem with the
63101 host, or the connection to it. If a timeout after MAIL, RCPT,
63102 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
63103 the timeout is likely to occur at some other point in the dialogue, causing it
63104 then to be treated as a host error.
63105 </para>
63106 <para>
63107 There is experimental evidence that some MTAs drop the connection after the
63108 terminating <quote>.</quote> if they do not like the contents of the message for some
63109 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
63110 should be given. That is why Exim treats this case as a message rather than a
63111 host error, in order not to delay other messages to the same host.
63112 </para>
63113 </section>
63114 <section id="SECID233">
63115 <title>Incoming SMTP messages over TCP/IP</title>
63116 <para>
63117 <indexterm role="concept">
63118 <primary>SMTP</primary>
63119 <secondary>incoming over TCP/IP</secondary>
63120 </indexterm>
63121 <indexterm role="concept">
63122 <primary>incoming SMTP over TCP/IP</primary>
63123 </indexterm>
63124 <indexterm role="concept">
63125 <primary>inetd</primary>
63126 </indexterm>
63127 <indexterm role="concept">
63128 <primary>daemon</primary>
63129 </indexterm>
63130 Incoming SMTP messages can be accepted in one of two ways: by running a
63131 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
63132 <filename>/etc/inetd.conf</filename> should be like this:
63133 </para>
63134 <literallayout class="monospaced">
63135 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
63136 </literallayout>
63137 <para>
63138 Exim distinguishes between this case and the case of a locally running user
63139 agent using the <option>-bs</option> option by checking whether or not the standard input is
63140 a socket. When it is, either the port must be privileged (less than 1024), or
63141 the caller must be root or the Exim user. If any other user passes a socket
63142 with an unprivileged port number, Exim prints a message on the standard error
63143 stream and exits with an error code.
63144 </para>
63145 <para>
63146 By default, Exim does not make a log entry when a remote host connects or
63147 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
63148 unexpected. It can be made to write such log entries by setting the
63149 <option>smtp_connection</option> log selector.
63150 </para>
63151 <para>
63152 <indexterm role="concept">
63153 <primary>carriage return</primary>
63154 </indexterm>
63155 <indexterm role="concept">
63156 <primary>linefeed</primary>
63157 </indexterm>
63158 Commands from the remote host are supposed to be terminated by CR followed by
63159 LF. However, there are known to be hosts that do not send CR characters. In
63160 order to be able to interwork with such hosts, Exim treats LF on its own as a
63161 line terminator.
63162 Furthermore, because common code is used for receiving messages from all
63163 sources, a CR on its own is also interpreted as a line terminator. However, the
63164 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
63165 </para>
63166 <para>
63167 <indexterm role="concept">
63168 <primary>EHLO</primary>
63169 <secondary>invalid data</secondary>
63170 </indexterm>
63171 <indexterm role="concept">
63172 <primary>HELO</primary>
63173 <secondary>invalid data</secondary>
63174 </indexterm>
63175 One area that sometimes gives rise to problems concerns the EHLO or
63176 HELO commands. Some clients send syntactically invalid versions of these
63177 commands, which Exim rejects by default. (This is nothing to do with verifying
63178 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
63179 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
63180 match the broken hosts that send invalid commands.
63181 </para>
63182 <para>
63183 <indexterm role="concept">
63184 <primary>SIZE option on MAIL command</primary>
63185 </indexterm>
63186 <indexterm role="concept">
63187 <primary>MAIL</primary>
63188 <secondary>SIZE option</secondary>
63189 </indexterm>
63190 The amount of disk space available is checked whenever SIZE is received on
63191 a MAIL command, independently of whether <option>message_size_limit</option> or
63192 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
63193 false. A temporary error is given if there is not enough space. If
63194 <option>check_spool_space</option> is set, the check is for that amount of space plus the
63195 value given with SIZE, that is, it checks that the addition of the incoming
63196 message will not reduce the space below the threshold.
63197 </para>
63198 <para>
63199 When a message is successfully received, Exim includes the local message id in
63200 its response to the final <quote>.</quote> that terminates the data. If the remote host
63201 logs this text it can help with tracing what has happened to a message.
63202 </para>
63203 <para>
63204 The Exim daemon can limit the number of simultaneous incoming connections it is
63205 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
63206 number of simultaneous incoming connections from a single remote host (see the
63207 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
63208 rejected using the SMTP temporary error code 421.
63209 </para>
63210 <para>
63211 The Exim daemon does not rely on the SIGCHLD signal to detect when a
63212 subprocess has finished, as this can get lost at busy times. Instead, it looks
63213 for completed subprocesses every time it wakes up. Provided there are other
63214 things happening (new incoming calls, starts of queue runs), completed
63215 processes will be noticed and tidied away. On very quiet systems you may
63216 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
63217 it will be noticed when the daemon next wakes up.
63218 </para>
63219 <para>
63220 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
63221 and can also be set up to reject SMTP calls from non-reserved hosts at times of
63222 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
63223 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
63224 applies in both the daemon and <emphasis>inetd</emphasis> cases.
63225 </para>
63226 <para>
63227 Exim normally starts a delivery process for each message received, though this
63228 can be varied by means of the <option>-odq</option> command line option and the
63229 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
63230 number of simultaneously running delivery processes started in this way from
63231 SMTP input can be limited by the <option>smtp_accept_queue</option> and
63232 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
63233 subsequently received messages are just put on the input queue without starting
63234 a delivery process.
63235 </para>
63236 <para>
63237 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
63238 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
63239 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
63240 handled by an entirely independent Exim process. Control by load average is,
63241 however, available with <emphasis>inetd</emphasis>.
63242 </para>
63243 <para>
63244 Exim can be configured to verify addresses in incoming SMTP commands as they
63245 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
63246 to rewrite addresses at this time &ndash; before any syntax checking is done. See
63247 section <xref linkend="SECTrewriteS"/>.
63248 </para>
63249 <para>
63250 Exim can also be configured to limit the rate at which a client host submits
63251 MAIL and RCPT commands in a single SMTP session. See the
63252 <option>smtp_ratelimit_hosts</option> option.
63253 </para>
63254 </section>
63255 <section id="SECID234">
63256 <title>Unrecognized SMTP commands</title>
63257 <para>
63258 <indexterm role="concept">
63259 <primary>SMTP</primary>
63260 <secondary>unrecognized commands</secondary>
63261 </indexterm>
63262 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
63263 commands during a single SMTP connection, it drops the connection after sending
63264 the error response to the last command. The default value for
63265 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
63266 abuse that subvert web servers into making connections to SMTP ports; in these
63267 circumstances, a number of non-SMTP lines are sent first.
63268 </para>
63269 </section>
63270 <section id="SECID235">
63271 <title>Syntax and protocol errors in SMTP commands</title>
63272 <para>
63273 <indexterm role="concept">
63274 <primary>SMTP</primary>
63275 <secondary>syntax errors</secondary>
63276 </indexterm>
63277 <indexterm role="concept">
63278 <primary>SMTP</primary>
63279 <secondary>protocol errors</secondary>
63280 </indexterm>
63281 A syntax error is detected if an SMTP command is recognized, but there is
63282 something syntactically wrong with its data, for example, a malformed email
63283 address in a RCPT command. Protocol errors include invalid command
63284 sequencing such as RCPT before MAIL. If Exim receives more than
63285 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
63286 drops the connection after sending the error response to the last command. The
63287 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
63288 broken clients that loop sending bad commands (yes, it has been seen).
63289 </para>
63290 </section>
63291 <section id="SECID236">
63292 <title>Use of non-mail SMTP commands</title>
63293 <para>
63294 <indexterm role="concept">
63295 <primary>SMTP</primary>
63296 <secondary>non-mail commands</secondary>
63297 </indexterm>
63298 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
63299 DATA. Exim counts such commands, and drops the connection if there are too
63300 many of them in a single SMTP session. This action catches some
63301 denial-of-service attempts and things like repeated failing AUTHs, or a mad
63302 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
63303 defines what <quote>too many</quote> means. Its default value is 10.
63304 </para>
63305 <para>
63306 When a new message is expected, one occurrence of RSET is not counted. This
63307 allows a client to send one RSET between messages (this is not necessary,
63308 but some clients do it). Exim also allows one uncounted occurrence of HELO
63309 or EHLO, and one occurrence of STARTTLS between messages. After
63310 starting up a TLS session, another EHLO is expected, and so it too is not
63311 counted.
63312 </para>
63313 <para>
63314 The first occurrence of AUTH in a connection, or immediately following
63315 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
63316 RCPT, DATA, and QUIT are counted.
63317 </para>
63318 <para>
63319 You can control which hosts are subject to the limit set by
63320 <option>smtp_accept_max_nonmail</option> by setting
63321 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
63322 the limit apply to all hosts. This option means that you can exclude any
63323 specific badly-behaved hosts that you have to live with.
63324 </para>
63325 </section>
63326 <section id="SECID237">
63327 <title>The VRFY and EXPN commands</title>
63328 <para>
63329 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
63330 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
63331 appropriate) in order to decide whether the command should be accepted or not.
63332 </para>
63333 <para>
63334 <indexterm role="concept">
63335 <primary>VRFY</primary>
63336 <secondary>processing</secondary>
63337 </indexterm>
63338 When no ACL is defined for VRFY, or if it rejects without
63339 setting an explicit response code, the command is accepted
63340 (with a 252 SMTP response code)
63341 in order to support awkward clients that do a VRFY before every RCPT.
63342 When VRFY is accepted, it runs exactly the same code as when Exim is
63343 called with the <option>-bv</option> option, and returns 250/451/550
63344 SMTP response codes.
63345 </para>
63346 <para>
63347 <indexterm role="concept">
63348 <primary>EXPN</primary>
63349 <secondary>processing</secondary>
63350 </indexterm>
63351 If no ACL for EXPN is defined, the command is rejected.
63352 When EXPN is accepted, a single-level expansion of the address is done.
63353 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
63354 than a verification (the <option>-bv</option> option). If an unqualified local part is given
63355 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
63356 of VRFY and EXPN commands are logged on the main and reject logs, and
63357 VRFY verification failures are logged on the main log for consistency with
63358 RCPT failures.
63359 </para>
63360 </section>
63361 <section id="SECTETRN">
63362 <title>The ETRN command</title>
63363 <para>
63364 <indexterm role="concept">
63365 <primary>ETRN</primary>
63366 <secondary>processing</secondary>
63367 </indexterm>
63368 RFC 1985 describes an SMTP command called ETRN that is designed to
63369 overcome the security problems of the TURN command (which has fallen into
63370 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
63371 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
63372 should be accepted or not. If no ACL is defined, the command is rejected.
63373 </para>
63374 <para>
63375 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
63376 delivery to certain hosts. As Exim does not organize its message queue by host,
63377 the only form of ETRN that is supported by default is the one where the
63378 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
63379 specific to the SMTP server. A valid ETRN command causes a run of Exim with
63380 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
63381 argument. For example,
63382 </para>
63383 <literallayout class="monospaced">
63384 ETRN #brigadoon
63385 </literallayout>
63386 <para>
63387 runs the command
63388 </para>
63389 <literallayout class="monospaced">
63390 exim -R brigadoon
63391 </literallayout>
63392 <para>
63393 which causes a delivery attempt on all messages with undelivered addresses
63394 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
63395 default), Exim prevents the simultaneous execution of more than one queue run
63396 for the same argument string as a result of an ETRN command. This stops
63397 a misbehaving client from starting more than one queue runner at once.
63398 </para>
63399 <para>
63400 <indexterm role="concept">
63401 <primary>hints database</primary>
63402 <secondary>ETRN serialization</secondary>
63403 </indexterm>
63404 Exim implements the serialization by means of a hints database in which a
63405 record is written whenever a process is started by ETRN, and deleted when
63406 the process completes. However, Exim does not keep the SMTP session waiting for
63407 the ETRN process to complete. Once ETRN is accepted, the client is sent
63408 a <quote>success</quote> return code. Obviously there is scope for hints records to get
63409 left lying around if there is a system or program crash. To guard against this,
63410 Exim ignores any records that are more than six hours old.
63411 </para>
63412 <para>
63413 <indexterm role="option">
63414 <primary><option>smtp_etrn_command</option></primary>
63415 </indexterm>
63416 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
63417 used. This specifies a command that is run whenever ETRN is received,
63418 whatever the form of its argument. For
63419 example:
63420 </para>
63421 <literallayout class="monospaced">
63422 smtp_etrn_command = /etc/etrn_command $domain \
63423                     $sender_host_address
63424 </literallayout>
63425 <para>
63426 <indexterm role="variable">
63427 <primary><varname>$domain</varname></primary>
63428 </indexterm>
63429 The string is split up into arguments which are independently expanded. The
63430 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
63431 and no syntax checking is done on the contents of this argument. Exim does not
63432 wait for the command to complete, so its status code is not checked. Exim runs
63433 under its own uid and gid when receiving incoming SMTP, so it is not possible
63434 for it to change them before running the command.
63435 </para>
63436 </section>
63437 <section id="SECID238">
63438 <title>Incoming local SMTP</title>
63439 <para>
63440 <indexterm role="concept">
63441 <primary>SMTP</primary>
63442 <secondary>local incoming</secondary>
63443 </indexterm>
63444 Some user agents use SMTP to pass messages to their local MTA using the
63445 standard input and output, as opposed to passing the envelope on the command
63446 line and writing the message to the standard input. This is supported by the
63447 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
63448 messages over TCP/IP (including the use of ACLs), except that the envelope
63449 sender given in a MAIL command is ignored unless the caller is trusted. In
63450 an ACL you can detect this form of SMTP input by testing for an empty host
63451 identification. It is common to have this as the first line in the ACL that
63452 runs for RCPT commands:
63453 </para>
63454 <literallayout class="monospaced">
63455 accept hosts = :
63456 </literallayout>
63457 <para>
63458 This accepts SMTP messages from local processes without doing any other tests.
63459 </para>
63460 </section>
63461 <section id="SECTbatchSMTP">
63462 <title>Outgoing batched SMTP</title>
63463 <para>
63464 <indexterm role="concept">
63465 <primary>SMTP</primary>
63466 <secondary>batched outgoing</secondary>
63467 </indexterm>
63468 <indexterm role="concept">
63469 <primary>batched SMTP output</primary>
63470 </indexterm>
63471 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
63472 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
63473 be output in BSMTP format. No SMTP responses are possible for this form of
63474 delivery. All it is doing is using SMTP commands as a way of transmitting the
63475 envelope along with the message.
63476 </para>
63477 <para>
63478 The message is written to the file or pipe preceded by the SMTP commands
63479 MAIL and RCPT, and followed by a line containing a single dot. Lines in
63480 the message that start with a dot have an extra dot added. The SMTP command
63481 HELO is not normally used. If it is required, the <option>message_prefix</option> option
63482 can be used to specify it.
63483 </para>
63484 <para>
63485 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
63486 one recipient address at a time by default. However, you can arrange for them
63487 to handle several addresses at once by setting the <option>batch_max</option> option. When
63488 this is done for BSMTP, messages may contain multiple RCPT commands. See
63489 chapter <xref linkend="CHAPbatching"/> for more details.
63490 </para>
63491 <para>
63492 <indexterm role="variable">
63493 <primary><varname>$host</varname></primary>
63494 </indexterm>
63495 When one or more addresses are routed to a BSMTP transport by a router that
63496 sets up a host list, the name of the first host on the list is available to the
63497 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
63498 router:
63499 </para>
63500 <literallayout class="monospaced">
63501 begin routers
63502 route_append:
63503   driver = manualroute
63504   transport = smtp_appendfile
63505   route_list = domain.example  batch.host.example
63506
63507 begin transports
63508 smtp_appendfile:
63509   driver = appendfile
63510   directory = /var/bsmtp/$host
63511   batch_max = 1000
63512   use_bsmtp
63513   user = exim
63514 </literallayout>
63515 <para>
63516 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
63517 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
63518 message (unless there are more than 1000 recipients).
63519 </para>
63520 </section>
63521 <section id="SECTincomingbatchedSMTP">
63522 <title>Incoming batched SMTP</title>
63523 <para>
63524 <indexterm role="concept">
63525 <primary>SMTP</primary>
63526 <secondary>batched incoming</secondary>
63527 </indexterm>
63528 <indexterm role="concept">
63529 <primary>batched SMTP input</primary>
63530 </indexterm>
63531 The <option>-bS</option> command line option causes Exim to accept one or more messages by
63532 reading SMTP on the standard input, but to generate no responses. If the caller
63533 is trusted, the senders in the MAIL commands are believed; otherwise the
63534 sender is always the caller of Exim. Unqualified senders and receivers are not
63535 rejected (there seems little point) but instead just get qualified. HELO
63536 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
63537 as NOOP; QUIT quits.
63538 </para>
63539 <para>
63540 Minimal policy checking is done for BSMTP input. Only the non-SMTP
63541 ACL is run in the same way as for non-SMTP local input.
63542 </para>
63543 <para>
63544 If an error is detected while reading a message, including a missing <quote>.</quote> at
63545 the end, Exim gives up immediately. It writes details of the error to the
63546 standard output in a stylized way that the calling program should be able to
63547 make some use of automatically, for example:
63548 </para>
63549 <literallayout class="monospaced">
63550 554 Unexpected end of file
63551 Transaction started in line 10
63552 Error detected in line 14
63553 </literallayout>
63554 <para>
63555 It writes a more verbose version, for human consumption, to the standard error
63556 file, for example:
63557 </para>
63558 <literallayout class="monospaced">
63559 An error was detected while processing a file of BSMTP input.
63560 The error message was:
63561
63562 501 '&gt;' missing at end of address
63563
63564 The SMTP transaction started in line 10.
63565 The error was detected in line 12.
63566 The SMTP command at fault was:
63567
63568 rcpt to:&lt;malformed@in.com.plete
63569
63570 1 previous message was successfully processed.
63571 The rest of the batch was abandoned.
63572 </literallayout>
63573 <para>
63574 The return code from Exim is zero only if there were no errors. It is 1 if some
63575 messages were accepted before an error was detected, and 2 if no messages were
63576 accepted.
63577 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
63578 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
63579 </para>
63580 </section>
63581 </chapter>
63582
63583 <chapter id="CHAPemsgcust">
63584 <title>Customizing bounce and warning messages</title>
63585 <titleabbrev>Customizing messages</titleabbrev>
63586 <para>
63587 When a message fails to be delivered, or remains on the queue for more than a
63588 configured amount of time, Exim sends a message to the original sender, or
63589 to an alternative configured address. The text of these messages is built into
63590 the code of Exim, but it is possible to change it, either by adding a single
63591 string, or by replacing each of the paragraphs by text supplied in a file.
63592 </para>
63593 <para>
63594 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
63595 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
63596 option. Exim also adds the line
63597 </para>
63598 <literallayout class="monospaced">
63599 Auto-Submitted: auto-generated
63600 </literallayout>
63601 <para>
63602 to all warning and bounce messages,
63603 </para>
63604 <section id="SECID239">
63605 <title>Customizing bounce messages</title>
63606 <para>
63607 <indexterm role="concept">
63608 <primary>customizing</primary>
63609 <secondary>bounce message</secondary>
63610 </indexterm>
63611 <indexterm role="concept">
63612 <primary>bounce message</primary>
63613 <secondary>customizing</secondary>
63614 </indexterm>
63615 If <option>bounce_message_text</option> is set, its contents are included in the default
63616 message immediately after <quote>This message was created automatically by mail
63617 delivery software.</quote> The string is not expanded. It is not used if
63618 <option>bounce_message_file</option> is set.
63619 </para>
63620 <para>
63621 When <option>bounce_message_file</option> is set, it must point to a template file for
63622 constructing error messages. The file consists of a series of text items,
63623 separated by lines consisting of exactly four asterisks. If the file cannot be
63624 opened, default text is used and a message is written to the main and panic
63625 logs. If any text item in the file is empty, default text is used for that
63626 item.
63627 </para>
63628 <para>
63629 <indexterm role="variable">
63630 <primary><varname>$bounce_recipient</varname></primary>
63631 </indexterm>
63632 <indexterm role="variable">
63633 <primary><varname>$bounce_return_size_limit</varname></primary>
63634 </indexterm>
63635 Each item of text that is read from the file is expanded, and there are two
63636 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
63637 the recipient of an error message while it is being created, and
63638 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
63639 option, rounded to a whole number.
63640 </para>
63641 <para>
63642 The items must appear in the file in the following order:
63643 </para>
63644 <itemizedlist>
63645 <listitem>
63646 <para>
63647 The first item is included in the headers, and should include at least a
63648 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
63649 </para>
63650 </listitem>
63651 <listitem>
63652 <para>
63653 The second item forms the start of the error message. After it, Exim lists the
63654 failing addresses with their error messages.
63655 </para>
63656 </listitem>
63657 <listitem>
63658 <para>
63659 The third item is used to introduce any text from pipe transports that is to be
63660 returned to the sender. It is omitted if there is no such text.
63661 </para>
63662 </listitem>
63663 <listitem>
63664 <para>
63665 The fourth, fifth and sixth items will be ignored and may be empty.
63666 The fields exist for back-compatibility
63667 </para>
63668 </listitem>
63669 </itemizedlist>
63670 <para>
63671 The default state (<option>bounce_message_file</option> unset) is equivalent to the
63672 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
63673 other lines have been split in order to fit them on the page:
63674 </para>
63675 <literallayout class="monospaced">
63676 Subject: Mail delivery failed
63677   ${if eq{$sender_address}{$bounce_recipient}
63678   {: returning message to sender}}
63679 ****
63680 This message was created automatically by mail delivery software.
63681
63682 A message ${if eq{$sender_address}{$bounce_recipient}
63683   {that you sent }{sent by
63684
63685 &lt;$sender_address&gt;
63686
63687 }}could not be delivered to all of its recipients.
63688 This is a permanent error. The following address(es) failed:
63689 ****
63690 The following text was generated during the delivery attempt(s):
63691 ****
63692 ------ This is a copy of the message, including all the headers.
63693   ------
63694 ****
63695 ------ The body of the message is $message_size characters long;
63696   only the first
63697 ------ $bounce_return_size_limit or so are included here.
63698 ****
63699 </literallayout>
63700 </section>
63701 <section id="SECTcustwarn">
63702 <title>Customizing warning messages</title>
63703 <para>
63704 <indexterm role="concept">
63705 <primary>customizing</primary>
63706 <secondary>warning message</secondary>
63707 </indexterm>
63708 <indexterm role="concept">
63709 <primary>warning of delay</primary>
63710 <secondary>customizing the message</secondary>
63711 </indexterm>
63712 The option <option>warn_message_file</option> can be pointed at a template file for use when
63713 warnings about message delays are created. In this case there are only three
63714 text sections:
63715 </para>
63716 <itemizedlist>
63717 <listitem>
63718 <para>
63719 The first item is included in the headers, and should include at least a
63720 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
63721 </para>
63722 </listitem>
63723 <listitem>
63724 <para>
63725 The second item forms the start of the warning message. After it, Exim lists
63726 the delayed addresses.
63727 </para>
63728 </listitem>
63729 <listitem>
63730 <para>
63731 The third item then ends the message.
63732 </para>
63733 </listitem>
63734 </itemizedlist>
63735 <para>
63736 The default state is equivalent to the following file, except that some lines
63737 have been split here, in order to fit them on the page:
63738 </para>
63739 <literallayout class="monospaced">
63740 Subject: Warning: message $message_exim_id delayed
63741   $warn_message_delay
63742 ****
63743 This message was created automatically by mail delivery software.
63744
63745 A message ${if eq{$sender_address}{$warn_message_recipients}
63746 {that you sent }{sent by
63747
63748 &lt;$sender_address&gt;
63749
63750 }}has not been delivered to all of its recipients after
63751 more than $warn_message_delay on the queue on $primary_hostname.
63752
63753 The message identifier is:     $message_exim_id
63754 The subject of the message is: $h_subject
63755 The date of the message is:    $h_date
63756
63757 The following address(es) have not yet been delivered:
63758 ****
63759 No action is required on your part. Delivery attempts will
63760 continue for some time, and this warning may be repeated at
63761 intervals if the message remains undelivered. Eventually the
63762 mail delivery software will give up, and when that happens,
63763 the message will be returned to you.
63764 </literallayout>
63765 <para>
63766 <indexterm role="variable">
63767 <primary><varname>$warn_message_delay</varname></primary>
63768 </indexterm>
63769 <indexterm role="variable">
63770 <primary><varname>$warn_message_recipients</varname></primary>
63771 </indexterm>
63772 However, in the default state the subject and date lines are omitted if no
63773 appropriate headers exist. During the expansion of this file,
63774 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
63775 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
63776 of recipients for the warning message. There may be more than one if there are
63777 multiple addresses with different <option>errors_to</option> settings on the routers that
63778 handled them.
63779 </para>
63780 </section>
63781 </chapter>
63782
63783 <chapter id="CHAPcomconreq">
63784 <title>Some common configuration settings</title>
63785 <para>
63786 This chapter discusses some configuration settings that seem to be fairly
63787 common. More examples and discussion can be found in the Exim book.
63788 </para>
63789 <section id="SECID240">
63790 <title>Sending mail to a smart host</title>
63791 <para>
63792 <indexterm role="concept">
63793 <primary>smart host</primary>
63794 <secondary>example router</secondary>
63795 </indexterm>
63796 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
63797 should replace the default <command>dnslookup</command> router with a router which does the
63798 routing explicitly:
63799 </para>
63800 <literallayout class="monospaced">
63801 send_to_smart_host:
63802   driver = manualroute
63803   route_list = !+local_domains smart.host.name
63804   transport = remote_smtp
63805 </literallayout>
63806 <para>
63807 You can use the smart host&#x2019;s IP address instead of the name if you wish.
63808 If you are using Exim only to submit messages to a smart host, and not for
63809 receiving incoming messages, you can arrange for it to do the submission
63810 synchronously by setting the <option>mua_wrapper</option> option (see chapter
63811 <xref linkend="CHAPnonqueueing"/>).
63812 </para>
63813 </section>
63814 <section id="SECTmailinglists">
63815 <title>Using Exim to handle mailing lists</title>
63816 <para>
63817 <indexterm role="concept">
63818 <primary>mailing lists</primary>
63819 </indexterm>
63820 Exim can be used to run simple mailing lists, but for large and/or complicated
63821 requirements, the use of additional specialized mailing list software such as
63822 Majordomo or Mailman is recommended.
63823 </para>
63824 <para>
63825 The <command>redirect</command> router can be used to handle mailing lists where each list
63826 is maintained in a separate file, which can therefore be managed by an
63827 independent manager. The <option>domains</option> router option can be used to run these
63828 lists in a separate domain from normal mail. For example:
63829 </para>
63830 <literallayout class="monospaced">
63831 lists:
63832   driver = redirect
63833   domains = lists.example
63834   file = /usr/lists/$local_part
63835   forbid_pipe
63836   forbid_file
63837   errors_to = $local_part-request@lists.example
63838   no_more
63839 </literallayout>
63840 <para>
63841 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
63842 in that domain, it looks for a file that matches the local part. If there is no
63843 such file, the router declines, but because <option>no_more</option> is set, no subsequent
63844 routers are tried, and so the whole delivery fails.
63845 </para>
63846 <para>
63847 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
63848 expanded into a file name or a pipe delivery, which is usually inappropriate in
63849 a mailing list.
63850 </para>
63851 <para>
63852 <indexterm role="option">
63853 <primary><option>errors_to</option></primary>
63854 </indexterm>
63855 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
63856 taken from a mailing list are to be sent to the given address rather than the
63857 original sender of the message. However, before acting on this, Exim verifies
63858 the error address, and ignores it if verification fails.
63859 </para>
63860 <para>
63861 For example, using the configuration above, mail sent to
63862 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
63863 <filename>/usr/lists/dicts</filename>, with error reports directed to
63864 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
63865 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
63866 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
63867 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
63868 or <option>local_part_suffix</option> options) to handle addresses of the form
63869 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
63870 </para>
63871 </section>
63872 <section id="SECID241">
63873 <title>Syntax errors in mailing lists</title>
63874 <para>
63875 <indexterm role="concept">
63876 <primary>mailing lists</primary>
63877 <secondary>syntax errors in</secondary>
63878 </indexterm>
63879 If an entry in redirection data contains a syntax error, Exim normally defers
63880 delivery of the original address. That means that a syntax error in a mailing
63881 list holds up all deliveries to the list. This may not be appropriate when a
63882 list is being maintained automatically from data supplied by users, and the
63883 addresses are not rigorously checked.
63884 </para>
63885 <para>
63886 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
63887 entries that fail to parse, noting the incident in the log. If in addition
63888 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
63889 whenever a broken address is skipped. It is usually appropriate to set
63890 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
63891 </para>
63892 </section>
63893 <section id="SECID242">
63894 <title>Re-expansion of mailing lists</title>
63895 <para>
63896 <indexterm role="concept">
63897 <primary>mailing lists</primary>
63898 <secondary>re-expansion of</secondary>
63899 </indexterm>
63900 Exim remembers every individual address to which a message has been delivered,
63901 in order to avoid duplication, but it normally stores only the original
63902 recipient addresses with a message. If all the deliveries to a mailing list
63903 cannot be done at the first attempt, the mailing list is re-expanded when the
63904 delivery is next tried. This means that alterations to the list are taken into
63905 account at each delivery attempt, so addresses that have been added to
63906 the list since the message arrived will therefore receive a copy of the
63907 message, even though it pre-dates their subscription.
63908 </para>
63909 <para>
63910 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
63911 on the <command>redirect</command> router. If this is done, any addresses generated by the
63912 router that fail to deliver at the first attempt are added to the message as
63913 <quote>top level</quote> addresses, and the parent address that generated them is marked
63914 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
63915 subsequent delivery attempts. The disadvantage of this is that if any of the
63916 failing addresses are incorrect, correcting them in the file has no effect on
63917 pre-existing messages.
63918 </para>
63919 <para>
63920 The original top-level address is remembered with each of the generated
63921 addresses, and is output in any log messages. However, any intermediate parent
63922 addresses are not recorded. This makes a difference to the log only if the
63923 <option>all_parents</option> selector is set, but for mailing lists there is normally only
63924 one level of expansion anyway.
63925 </para>
63926 </section>
63927 <section id="SECID243">
63928 <title>Closed mailing lists</title>
63929 <para>
63930 <indexterm role="concept">
63931 <primary>mailing lists</primary>
63932 <secondary>closed</secondary>
63933 </indexterm>
63934 The examples so far have assumed open mailing lists, to which anybody may
63935 send mail. It is also possible to set up closed lists, where mail is accepted
63936 from specified senders only. This is done by making use of the generic
63937 <option>senders</option> option to restrict the router that handles the list.
63938 </para>
63939 <para>
63940 The following example uses the same file as a list of recipients and as a list
63941 of permitted senders. It requires three routers:
63942 </para>
63943 <literallayout class="monospaced">
63944 lists_request:
63945   driver = redirect
63946   domains = lists.example
63947   local_part_suffix = -request
63948   file = /usr/lists/$local_part$local_part_suffix
63949   no_more
63950
63951 lists_post:
63952   driver = redirect
63953   domains = lists.example
63954   senders = ${if exists {/usr/lists/$local_part}\
63955              {lsearch;/usr/lists/$local_part}{*}}
63956   file = /usr/lists/$local_part
63957   forbid_pipe
63958   forbid_file
63959   errors_to = $local_part-request@lists.example
63960   no_more
63961
63962 lists_closed:
63963   driver = redirect
63964   domains = lists.example
63965   allow_fail
63966   data = :fail: $local_part@lists.example is a closed mailing list
63967 </literallayout>
63968 <para>
63969 All three routers have the same <option>domains</option> setting, so for any other domains,
63970 they are all skipped. The first router runs only if the local part ends in
63971 <option>-request</option>. It handles messages to the list manager(s) by means of an open
63972 mailing list.
63973 </para>
63974 <para>
63975 The second router runs only if the <option>senders</option> precondition is satisfied. It
63976 checks for the existence of a list that corresponds to the local part, and then
63977 checks that the sender is on the list by means of a linear search. It is
63978 necessary to check for the existence of the file before trying to search it,
63979 because otherwise Exim thinks there is a configuration error. If the file does
63980 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
63981 means that the router runs, but because there is no list, declines, and
63982 <option>no_more</option> ensures that no further routers are run. The address fails with an
63983 <quote>unrouteable address</quote> error.
63984 </para>
63985 <para>
63986 The third router runs only if the second router is skipped, which happens when
63987 a mailing list exists, but the sender is not on it. This router forcibly fails
63988 the address, giving a suitable error message.
63989 </para>
63990 </section>
63991 <section id="SECTverp">
63992 <title>Variable Envelope Return Paths (VERP)</title>
63993 <para>
63994 <indexterm role="concept">
63995 <primary>VERP</primary>
63996 </indexterm>
63997 <indexterm role="concept">
63998 <primary>Variable Envelope Return Paths</primary>
63999 </indexterm>
64000 <indexterm role="concept">
64001 <primary>envelope sender</primary>
64002 </indexterm>
64003 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;
64004 are a way of helping mailing list administrators discover which subscription
64005 address is the cause of a particular delivery failure. The idea is to encode
64006 the original recipient address in the outgoing envelope sender address, so that
64007 if the message is forwarded by another host and then subsequently bounces, the
64008 original recipient can be extracted from the recipient address of the bounce.
64009 </para>
64010 <para>
64011 <indexterm role="option">
64012 <primary><option>errors_to</option></primary>
64013 </indexterm>
64014 <indexterm role="option">
64015 <primary><option>return_path</option></primary>
64016 </indexterm>
64017 Envelope sender addresses can be modified by Exim using two different
64018 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
64019 list examples), or the <option>return_path</option> option on a transport. The second of
64020 these is effective only if the message is successfully delivered to another
64021 host; it is not used for errors detected on the local host (see the description
64022 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
64023 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
64024 </para>
64025 <literallayout class="monospaced">
64026 verp_smtp:
64027   driver = smtp
64028   max_rcpt = 1
64029   return_path = \
64030     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
64031       {$1-request+$local_part=$domain@your.dom.example}fail}
64032 </literallayout>
64033 <para>
64034 This has the effect of rewriting the return path (envelope sender) on outgoing
64035 SMTP messages, if the local part of the original return path ends in
64036 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
64037 local part and domain of the recipient into the return path. Suppose, for
64038 example, that a message whose return path has been set to
64039 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
64040 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
64041 rewritten as
64042 </para>
64043 <literallayout class="monospaced">
64044 somelist-request+subscriber=other.dom.example@your.dom.example
64045 </literallayout>
64046 <para>
64047 <indexterm role="variable">
64048 <primary><varname>$local_part</varname></primary>
64049 </indexterm>
64050 For this to work, you must tell Exim to send multiple copies of messages that
64051 have more than one recipient, so that each copy has just one recipient. This is
64052 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
64053 might be sent to several different recipients in the same domain, in which case
64054 <varname>$local_part</varname> is not available in the transport, because it is not unique.
64055 </para>
64056 <para>
64057 Unless your host is doing nothing but mailing list deliveries, you should
64058 probably use a separate transport for the VERP deliveries, so as not to use
64059 extra resources in making one-per-recipient copies for other deliveries. This
64060 can easily be done by expanding the <option>transport</option> option in the router:
64061 </para>
64062 <literallayout class="monospaced">
64063 dnslookup:
64064   driver = dnslookup
64065   domains = ! +local_domains
64066   transport = \
64067     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
64068       {verp_smtp}{remote_smtp}}
64069   no_more
64070 </literallayout>
64071 <para>
64072 If you want to change the return path using <option>errors_to</option> in a router instead
64073 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
64074 routers that handle mailing list addresses. This will ensure that all delivery
64075 errors, including those detected on the local host, are sent to the VERP
64076 address.
64077 </para>
64078 <para>
64079 On a host that does no local deliveries and has no manual routing, only the
64080 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
64081 SMTP deliveries. Every mailing list recipient has its own return path value,
64082 and so Exim must hand them to the transport one at a time. Here is an example
64083 of a <command>dnslookup</command> router that implements VERP:
64084 </para>
64085 <literallayout class="monospaced">
64086 verp_dnslookup:
64087   driver = dnslookup
64088   domains = ! +local_domains
64089   transport = remote_smtp
64090   errors_to = \
64091     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
64092      {$1-request+$local_part=$domain@your.dom.example}fail}
64093   no_more
64094 </literallayout>
64095 <para>
64096 Before you start sending out messages with VERPed return paths, you must also
64097 configure Exim to accept the bounce messages that come back to those paths.
64098 Typically this is done by setting a <option>local_part_suffix</option> option for a
64099 router, and using this to route the messages to wherever you want to handle
64100 them.
64101 </para>
64102 <para>
64103 The overhead incurred in using VERP depends very much on the size of the
64104 message, the number of recipient addresses that resolve to the same remote
64105 host, and the speed of the connection over which the message is being sent. If
64106 a lot of addresses resolve to the same host and the connection is slow, sending
64107 a separate copy of the message for each address may take substantially longer
64108 than sending a single copy with many recipients (for which VERP cannot be
64109 used).
64110 </para>
64111 </section>
64112 <section id="SECTvirtualdomains">
64113 <title>Virtual domains</title>
64114 <para>
64115 <indexterm role="concept">
64116 <primary>virtual domains</primary>
64117 </indexterm>
64118 <indexterm role="concept">
64119 <primary>domain</primary>
64120 <secondary>virtual</secondary>
64121 </indexterm>
64122 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
64123 meanings:
64124 </para>
64125 <itemizedlist>
64126 <listitem>
64127 <para>
64128 A domain for which there are no real mailboxes; all valid local parts are
64129 aliases for other email addresses. Common examples are organizational
64130 top-level domains and <quote>vanity</quote> domains.
64131 </para>
64132 </listitem>
64133 <listitem>
64134 <para>
64135 One of a number of independent domains that are all handled by the same host,
64136 with mailboxes on that host, but where the mailbox owners do not necessarily
64137 have login accounts on that host.
64138 </para>
64139 </listitem>
64140 </itemizedlist>
64141 <para>
64142 The first usage is probably more common, and does seem more <quote>virtual</quote> than
64143 the second. This kind of domain can be handled in Exim with a straightforward
64144 aliasing router. One approach is to create a separate alias file for each
64145 virtual domain. Exim can test for the existence of the alias file to determine
64146 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
64147 to a router of this form:
64148 </para>
64149 <literallayout class="monospaced">
64150 virtual:
64151   driver = redirect
64152   domains = dsearch;/etc/mail/virtual
64153   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
64154   no_more
64155 </literallayout>
64156 <para>
64157 The <option>domains</option> option specifies that the router is to be skipped, unless there
64158 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
64159 domain that is being processed. When the router runs, it looks up the local
64160 part in the file to find a new address (or list of addresses). The <option>no_more</option>
64161 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
64162 string), Exim gives up on the address without trying any subsequent routers.
64163 </para>
64164 <para>
64165 This one router can handle all the virtual domains because the alias file names
64166 follow a fixed pattern. Permissions can be arranged so that appropriate people
64167 can edit the different alias files. A successful aliasing operation results in
64168 a new envelope recipient address, which is then routed from scratch.
64169 </para>
64170 <para>
64171 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
64172 way. One approach is to create a file for each domain containing a list of
64173 valid local parts, and use it in a router like this:
64174 </para>
64175 <literallayout class="monospaced">
64176 my_domains:
64177   driver = accept
64178   domains = dsearch;/etc/mail/domains
64179   local_parts = lsearch;/etc/mail/domains/$domain
64180   transport = my_mailboxes
64181 </literallayout>
64182 <para>
64183 The address is accepted if there is a file for the domain, and the local part
64184 can be found in the file. The <option>domains</option> option is used to check for the
64185 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
64186 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
64187 because that option is tested after <option>local_parts</option>. The transport is as
64188 follows:
64189 </para>
64190 <literallayout class="monospaced">
64191 my_mailboxes:
64192   driver = appendfile
64193   file = /var/mail/$domain/$local_part
64194   user = mail
64195 </literallayout>
64196 <para>
64197 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
64198 required, to specify which uid is to be used for writing to the mailboxes.
64199 </para>
64200 <para>
64201 The configuration shown here is just one example of how you might support this
64202 requirement. There are many other ways this kind of configuration can be set
64203 up, for example, by using a database instead of separate files to hold all the
64204 information about the domains.
64205 </para>
64206 </section>
64207 <section id="SECTmulbox">
64208 <title>Multiple user mailboxes</title>
64209 <para>
64210 <indexterm role="concept">
64211 <primary>multiple mailboxes</primary>
64212 </indexterm>
64213 <indexterm role="concept">
64214 <primary>mailbox</primary>
64215 <secondary>multiple</secondary>
64216 </indexterm>
64217 <indexterm role="concept">
64218 <primary>local part</primary>
64219 <secondary>prefix</secondary>
64220 </indexterm>
64221 <indexterm role="concept">
64222 <primary>local part</primary>
64223 <secondary>suffix</secondary>
64224 </indexterm>
64225 Heavy email users often want to operate with multiple mailboxes, into which
64226 incoming mail is automatically sorted. A popular way of handling this is to
64227 allow users to use multiple sender addresses, so that replies can easily be
64228 identified. Users are permitted to add prefixes or suffixes to their local
64229 parts for this purpose. The wildcard facility of the generic router options
64230 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
64231 example, consider this router:
64232 </para>
64233 <literallayout class="monospaced">
64234 userforward:
64235   driver = redirect
64236   check_local_user
64237   file = $home/.forward
64238   local_part_suffix = -*
64239   local_part_suffix_optional
64240   allow_filter
64241 </literallayout>
64242 <para>
64243 <indexterm role="variable">
64244 <primary><varname>$local_part_suffix</varname></primary>
64245 </indexterm>
64246 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
64247 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
64248 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
64249 </para>
64250 <literallayout class="monospaced">
64251 if $local_part_suffix contains -special then
64252 save /home/$local_part/Mail/special
64253 endif
64254 </literallayout>
64255 <para>
64256 If the filter file does not exist, or does not deal with such addresses, they
64257 fall through to subsequent routers, and, assuming no subsequent use of the
64258 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
64259 control over which suffixes are valid.
64260 </para>
64261 <para>
64262 Alternatively, a suffix can be used to trigger the use of a different
64263 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
64264 another MTA:
64265 </para>
64266 <literallayout class="monospaced">
64267 userforward:
64268   driver = redirect
64269   check_local_user
64270   file = $home/.forward$local_part_suffix
64271   local_part_suffix = -*
64272   local_part_suffix_optional
64273   allow_filter
64274 </literallayout>
64275 <para>
64276 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
64277 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
64278 does not exist, or does not deal with the address, it is passed on to
64279 subsequent routers, which could, if required, look for an unqualified
64280 <filename>.forward</filename> file to use as a default.
64281 </para>
64282 </section>
64283 <section id="SECID244">
64284 <title>Simplified vacation processing</title>
64285 <para>
64286 <indexterm role="concept">
64287 <primary>vacation processing</primary>
64288 </indexterm>
64289 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
64290 a pipe command in a <filename>.forward</filename> file
64291 (see section <xref linkend="SECTspecitredli"/> for syntax details).
64292 This is prone to error by inexperienced users. There are two features of Exim
64293 that can be used to make this process simpler for users:
64294 </para>
64295 <itemizedlist>
64296 <listitem>
64297 <para>
64298 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
64299 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
64300 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
64301 <filename>.forward</filename> file are then much simpler. For example:
64302 </para>
64303 <literallayout class="monospaced">
64304 spqr, vacation-spqr
64305 </literallayout>
64306 </listitem>
64307 <listitem>
64308 <para>
64309 The <option>require_files</option> generic router option can be used to trigger a
64310 vacation delivery by checking for the existence of a certain file in the
64311 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
64312 ensure that the original delivery also proceeds. In this case, all the user has
64313 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
64314 message.
64315 </para>
64316 </listitem>
64317 </itemizedlist>
64318 <para>
64319 Another advantage of both these methods is that they both work even when the
64320 use of arbitrary pipes by users is locked out.
64321 </para>
64322 </section>
64323 <section id="SECID245">
64324 <title>Taking copies of mail</title>
64325 <para>
64326 <indexterm role="concept">
64327 <primary>message</primary>
64328 <secondary>copying every</secondary>
64329 </indexterm>
64330 Some installations have policies that require archive copies of all messages to
64331 be made. A single copy of each message can easily be taken by an appropriate
64332 command in a system filter, which could, for example, use a different file for
64333 each day&#x2019;s messages.
64334 </para>
64335 <para>
64336 There is also a shadow transport mechanism that can be used to take copies of
64337 messages that are successfully delivered by local transports, one copy per
64338 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
64339 notification of delivery by sites that insist on doing such things.
64340 </para>
64341 </section>
64342 <section id="SECID246">
64343 <title>Intermittently connected hosts</title>
64344 <para>
64345 <indexterm role="concept">
64346 <primary>intermittently connected hosts</primary>
64347 </indexterm>
64348 It has become quite common (because it is cheaper) for hosts to connect to the
64349 Internet periodically rather than remain connected all the time. The normal
64350 arrangement is that mail for such hosts accumulates on a system that is
64351 permanently connected.
64352 </para>
64353 <para>
64354 Exim was designed for use on permanently connected hosts, and so it is not
64355 particularly well-suited to use in an intermittently connected environment.
64356 Nevertheless there are some features that can be used.
64357 </para>
64358 </section>
64359 <section id="SECID247">
64360 <title>Exim on the upstream server host</title>
64361 <para>
64362 It is tempting to arrange for incoming mail for the intermittently connected
64363 host to remain on Exim&#x2019;s queue until the client connects. However, this
64364 approach does not scale very well. Two different kinds of waiting message are
64365 being mixed up in the same queue &ndash; those that cannot be delivered because of
64366 some temporary problem, and those that are waiting for their destination host
64367 to connect. This makes it hard to manage the queue, as well as wasting
64368 resources, because each queue runner scans the entire queue.
64369 </para>
64370 <para>
64371 A better approach is to separate off those messages that are waiting for an
64372 intermittently connected host. This can be done by delivering these messages
64373 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
64374 format, from where they are transmitted by other software when their
64375 destination connects. This makes it easy to collect all the mail for one host
64376 in a single directory, and to apply local timeout rules on a per-message basis
64377 if required.
64378 </para>
64379 <para>
64380 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
64381 you are doing this, you should configure Exim with a long retry period for the
64382 intermittent host. For example:
64383 </para>
64384 <literallayout class="monospaced">
64385 cheshire.wonderland.fict.example    *   F,5d,24h
64386 </literallayout>
64387 <para>
64388 This stops a lot of failed delivery attempts from occurring, but Exim remembers
64389 which messages it has queued up for that host. Once the intermittent host comes
64390 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
64391 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
64392 causes all the queued up messages to be delivered, often down a single SMTP
64393 connection. While the host remains connected, any new messages get delivered
64394 immediately.
64395 </para>
64396 <para>
64397 If the connecting hosts do not have fixed IP addresses, that is, if a host is
64398 issued with a different IP address each time it connects, Exim&#x2019;s retry
64399 mechanisms on the holding host get confused, because the IP address is normally
64400 used as part of the key string for holding retry information. This can be
64401 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
64402 Since this has disadvantages for permanently connected hosts, it is best to
64403 arrange a separate transport for the intermittently connected ones.
64404 </para>
64405 </section>
64406 <section id="SECID248">
64407 <title>Exim on the intermittently connected client host</title>
64408 <para>
64409 The value of <option>smtp_accept_queue_per_connection</option> should probably be
64410 increased, or even set to zero (that is, disabled) on the intermittently
64411 connected host, so that all incoming messages down a single connection get
64412 delivered immediately.
64413 </para>
64414 <para>
64415 <indexterm role="concept">
64416 <primary>SMTP</primary>
64417 <secondary>passed connection</secondary>
64418 </indexterm>
64419 <indexterm role="concept">
64420 <primary>SMTP</primary>
64421 <secondary>multiple deliveries</secondary>
64422 </indexterm>
64423 <indexterm role="concept">
64424 <primary>multiple SMTP deliveries</primary>
64425 </indexterm>
64426 Mail waiting to be sent from an intermittently connected host will probably
64427 not have been routed, because without a connection DNS lookups are not
64428 possible. This means that if a normal queue run is done at connection time,
64429 each message is likely to be sent in a separate SMTP session. This can be
64430 avoided by starting the queue run with a command line option beginning with
64431 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
64432 first pass, routing is done but no deliveries take place. The second pass is a
64433 normal queue run; since all the messages have been previously routed, those
64434 destined for the same host are likely to get sent as multiple deliveries in a
64435 single SMTP connection.
64436 </para>
64437 </section>
64438 </chapter>
64439
64440 <chapter id="CHAPnonqueueing">
64441 <title>Using Exim as a non-queueing client</title>
64442 <titleabbrev>Exim as a non-queueing client</titleabbrev>
64443 <para>
64444 <indexterm role="concept">
64445 <primary>client, non-queueing</primary>
64446 </indexterm>
64447 <indexterm role="concept">
64448 <primary>smart host</primary>
64449 <secondary>suppressing queueing</secondary>
64450 </indexterm>
64451 On a personal computer, it is a common requirement for all
64452 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
64453 configured to operate that way, for all the popular operating systems.
64454 However, there are some MUAs for Unix-like systems that cannot be so
64455 configured: they submit messages using the command line interface of
64456 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
64457 messages this way.
64458 </para>
64459 <para>
64460 If the personal computer runs continuously, there is no problem, because it can
64461 run a conventional MTA that handles delivery to the smart host, and deal with
64462 any delays via its queueing mechanism. However, if the computer does not run
64463 continuously or runs different operating systems at different times, queueing
64464 email is not desirable.
64465 </para>
64466 <para>
64467 There is therefore a requirement for something that can provide the
64468 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
64469 any queueing or retrying facilities. Furthermore, the delivery to the smart
64470 host should be synchronous, so that if it fails, the sending MUA is immediately
64471 informed. In other words, we want something that extends an MUA that submits
64472 to a local MTA via the command line so that it behaves like one that submits
64473 to a remote smart host using TCP/SMTP.
64474 </para>
64475 <para>
64476 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
64477 that do this job. However, people have found them to be lacking in various
64478 ways. For instance, you might want to allow aliasing and forwarding to be done
64479 before sending a message to the smart host.
64480 </para>
64481 <para>
64482 Exim already had the necessary infrastructure for doing this job. Just a few
64483 tweaks were needed to make it behave as required, though it is somewhat of an
64484 overkill to use a fully-featured MTA for this purpose.
64485 </para>
64486 <para>
64487 <indexterm role="option">
64488 <primary><option>mua_wrapper</option></primary>
64489 </indexterm>
64490 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
64491 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
64492 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
64493 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
64494 compatible router and transport configuration. Typically there will be just one
64495 router and one transport, sending everything to a smart host.
64496 </para>
64497 <para>
64498 When run in MUA wrapping mode, the behaviour of Exim changes in the
64499 following ways:
64500 </para>
64501 <itemizedlist>
64502 <listitem>
64503 <para>
64504 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
64505 In other words, the only way to submit messages is via the command line.
64506 </para>
64507 </listitem>
64508 <listitem>
64509 <para>
64510 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
64511 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
64512 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
64513 does not finish until the delivery attempt is complete. If the delivery is
64514 successful, a zero return code is given.
64515 </para>
64516 </listitem>
64517 <listitem>
64518 <para>
64519 Address redirection is permitted, but the final routing for all addresses must
64520 be to the same remote transport, and to the same list of hosts. Furthermore,
64521 the return address (envelope sender) must be the same for all recipients, as
64522 must any added or deleted header lines. In other words, it must be possible to
64523 deliver the message in a single SMTP transaction, however many recipients there
64524 are.
64525 </para>
64526 </listitem>
64527 <listitem>
64528 <para>
64529 If these conditions are not met, or if routing any address results in a
64530 failure or defer status, or if Exim is unable to deliver all the recipients
64531 successfully to one of the smart hosts, delivery of the entire message fails.
64532 </para>
64533 </listitem>
64534 <listitem>
64535 <para>
64536 Because no queueing is allowed, all failures are treated as permanent; there
64537 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
64538 smart host. Furthermore, because only a single yes/no response can be given to
64539 the caller, it is not possible to deliver to some recipients and not others. If
64540 there is an error (temporary or permanent) for any recipient, all are failed.
64541 </para>
64542 </listitem>
64543 <listitem>
64544 <para>
64545 If more than one smart host is listed, Exim will try another host after a
64546 connection failure or a timeout, in the normal way. However, if this kind of
64547 failure happens for all the hosts, the delivery fails.
64548 </para>
64549 </listitem>
64550 <listitem>
64551 <para>
64552 When delivery fails, an error message is written to the standard error stream
64553 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
64554 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
64555 are ever generated.
64556 </para>
64557 </listitem>
64558 <listitem>
64559 <para>
64560 No retry data is maintained, and any retry rules are ignored.
64561 </para>
64562 </listitem>
64563 <listitem>
64564 <para>
64565 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
64566 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
64567 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
64568 </para>
64569 </listitem>
64570 </itemizedlist>
64571 <para>
64572 The overall effect is that Exim makes a single synchronous attempt to deliver
64573 the message, failing if there is any kind of problem. Because no local
64574 deliveries are done and no daemon can be run, Exim does not need root
64575 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
64576 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
64577 the advantages and disadvantages of running without root privilege.
64578 </para>
64579 </chapter>
64580
64581 <chapter id="CHAPlog">
64582 <title>Log files</title>
64583 <para>
64584 <indexterm role="concept" id="IIDloggen" class="startofrange">
64585 <primary>log</primary>
64586 <secondary>general description</secondary>
64587 </indexterm>
64588 <indexterm role="concept">
64589 <primary>log</primary>
64590 <secondary>types of</secondary>
64591 </indexterm>
64592 Exim writes three different logs, referred to as the main log, the reject log,
64593 and the panic log:
64594 </para>
64595 <itemizedlist>
64596 <listitem>
64597 <para>
64598 <indexterm role="concept">
64599 <primary>main log</primary>
64600 </indexterm>
64601 The main log records the arrival of each message and each delivery in a single
64602 line in each case. The format is as compact as possible, in an attempt to keep
64603 down the size of log files. Two-character flag sequences make it easy to pick
64604 out these lines. A number of other events are recorded in the main log. Some of
64605 them are optional, in which case the <option>log_selector</option> option controls whether
64606 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
64607 analysis of main log files, is provided in the Exim distribution (see section
64608 <xref linkend="SECTmailstat"/>).
64609 </para>
64610 </listitem>
64611 <listitem>
64612 <para>
64613 <indexterm role="concept">
64614 <primary>reject log</primary>
64615 </indexterm>
64616 The reject log records information from messages that are rejected as a result
64617 of a configuration option (that is, for policy reasons).
64618 The first line of each rejection is a copy of the line that is also written to
64619 the main log. Then, if the message&#x2019;s header has been read at the time the log
64620 is written, its contents are written to this log. Only the original header
64621 lines are available; header lines added by ACLs are not logged. You can use the
64622 reject log to check that your policy controls are working correctly; on a busy
64623 host this may be easier than scanning the main log for rejection messages. You
64624 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
64625 false.
64626 </para>
64627 </listitem>
64628 <listitem>
64629 <para>
64630 <indexterm role="concept">
64631 <primary>panic log</primary>
64632 </indexterm>
64633 <indexterm role="concept">
64634 <primary>system log</primary>
64635 </indexterm>
64636 When certain serious errors occur, Exim writes entries to its panic log. If the
64637 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
64638 are usually written to the main log as well, but can get lost amid the mass of
64639 other entries. The panic log should be empty under normal circumstances. It is
64640 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
64641 regularly, in order to become aware of any problems. When Exim cannot open its
64642 panic log, it tries as a last resort to write to the system log (syslog). This
64643 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
64644 message itself is written at priority LOG_CRIT.
64645 </para>
64646 </listitem>
64647 </itemizedlist>
64648 <para>
64649 Every log line starts with a timestamp, in the format shown in the following
64650 example. Note that many of the examples shown in this chapter are line-wrapped.
64651 In the log file, this would be all on one line:
64652 </para>
64653 <literallayout class="monospaced">
64654 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
64655   by QUIT
64656 </literallayout>
64657 <para>
64658 By default, the timestamps are in the local timezone. There are two
64659 ways of changing this:
64660 </para>
64661 <itemizedlist>
64662 <listitem>
64663 <para>
64664 You can set the <option>timezone</option> option to a different time zone; in particular, if
64665 you set
64666 </para>
64667 <literallayout class="monospaced">
64668 timezone = UTC
64669 </literallayout>
64670 <para>
64671 the timestamps will be in UTC (aka GMT).
64672 </para>
64673 </listitem>
64674 <listitem>
64675 <para>
64676 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
64677 example:
64678 </para>
64679 <literallayout class="monospaced">
64680 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
64681 </literallayout>
64682 </listitem>
64683 </itemizedlist>
64684 <para>
64685 <indexterm role="concept">
64686 <primary>log</primary>
64687 <secondary>process ids in</secondary>
64688 </indexterm>
64689 <indexterm role="concept">
64690 <primary>pid (process id)</primary>
64691 <secondary>in log lines</secondary>
64692 </indexterm>
64693 Exim does not include its process id in log lines by default, but you can
64694 request that it does so by specifying the <literal>pid</literal> log selector (see section
64695 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
64696 brackets, immediately after the time and date.
64697 </para>
64698 <section id="SECTwhelogwri">
64699 <title>Where the logs are written</title>
64700 <para>
64701 <indexterm role="concept">
64702 <primary>log</primary>
64703 <secondary>destination</secondary>
64704 </indexterm>
64705 <indexterm role="concept">
64706 <primary>log</primary>
64707 <secondary>to file</secondary>
64708 </indexterm>
64709 <indexterm role="concept">
64710 <primary>log</primary>
64711 <secondary>to syslog</secondary>
64712 </indexterm>
64713 <indexterm role="concept">
64714 <primary>syslog</primary>
64715 </indexterm>
64716 The logs may be written to local files, or to syslog, or both. However, it
64717 should be noted that many syslog implementations use UDP as a transport, and
64718 are therefore unreliable in the sense that messages are not guaranteed to
64719 arrive at the loghost, nor is the ordering of messages necessarily maintained.
64720 It has also been reported that on large log files (tens of megabytes) you may
64721 need to tweak syslog to prevent it syncing the file with each write &ndash; on
64722 Linux this has been seen to make syslog take 90% plus of CPU time.
64723 </para>
64724 <para>
64725 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
64726 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
64727 configuration. This latter string is expanded, so it can contain, for example,
64728 references to the host name:
64729 </para>
64730 <literallayout class="monospaced">
64731 log_file_path = /var/log/$primary_hostname/exim_%slog
64732 </literallayout>
64733 <para>
64734 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
64735 rather than at run time, because then the setting is available right from the
64736 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
64737 before it has read the configuration file (for example, an error in the
64738 configuration file) it will not use the path you want, and may not be able to
64739 log at all.
64740 </para>
64741 <para>
64742 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
64743 list, currently limited to at most two items. This is one option where the
64744 facility for changing a list separator may not be used. The list must always be
64745 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
64746 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
64747 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
64748 implying the use of a default path.
64749 </para>
64750 <para>
64751 When Exim encounters an empty item in the list, it searches the list defined by
64752 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
64753 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
64754 mean <quote>use the path specified at build time</quote>. It no such item exists, log
64755 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
64756 equivalent to the setting:
64757 </para>
64758 <literallayout class="monospaced">
64759 log_file_path = $spool_directory/log/%slog
64760 </literallayout>
64761 <para>
64762 If you do not specify anything at build time or run time,
64763 or if you unset the option at run time (i.e. <literal>log_file_path = </literal>),
64764 that is where the logs are written.
64765 </para>
64766 <para>
64767 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log file names
64768 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
64769 </para>
64770 <para>
64771 Here are some examples of possible settings:
64772 </para>
64773 <literallayout>
64774 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
64775 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
64776 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
64777 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
64778 </literallayout>
64779 <para>
64780 If there are more than two paths in the list, the first is used and a panic
64781 error is logged.
64782 </para>
64783 </section>
64784 <section id="SECID285">
64785 <title>Logging to local files that are periodically <quote>cycled</quote></title>
64786 <para>
64787 <indexterm role="concept">
64788 <primary>log</primary>
64789 <secondary>cycling local files</secondary>
64790 </indexterm>
64791 <indexterm role="concept">
64792 <primary>cycling logs</primary>
64793 </indexterm>
64794 <indexterm role="concept">
64795 <primary><emphasis>exicyclog</emphasis></primary>
64796 </indexterm>
64797 <indexterm role="concept">
64798 <primary>log</primary>
64799 <secondary>local files; writing to</secondary>
64800 </indexterm>
64801 Some operating systems provide centralized and standardized methods for cycling
64802 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
64803 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
64804 main and reject logs each time it is called. The maximum number of old logs to
64805 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
64806 </para>
64807 <para>
64808 An Exim delivery process opens the main log when it first needs to write to it,
64809 and it keeps the file open in case subsequent entries are required &ndash; for
64810 example, if a number of different deliveries are being done for the same
64811 message. However, remote SMTP deliveries can take a long time, and this means
64812 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
64813 something similar is being used to rename log files on a regular basis. To
64814 ensure that a switch of log files is noticed as soon as possible, Exim calls
64815 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
64816 does not exist, or its inode has changed, the old file is closed and Exim
64817 tries to open the main log from scratch. Thus, an old log file may remain open
64818 for quite some time, but no Exim processes should write to it once it has been
64819 renamed.
64820 </para>
64821 </section>
64822 <section id="SECTdatlogfil">
64823 <title>Datestamped log files</title>
64824 <para>
64825 <indexterm role="concept">
64826 <primary>log</primary>
64827 <secondary>datestamped files</secondary>
64828 </indexterm>
64829 Instead of cycling the main and reject log files by renaming them
64830 periodically, some sites like to use files whose names contain a datestamp,
64831 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
64832 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
64833 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
64834 point where the datestamp is required. For example:
64835 </para>
64836 <literallayout class="monospaced">
64837 log_file_path = /var/spool/exim/log/%slog-%D
64838 log_file_path = /var/log/exim-%s-%D.log
64839 log_file_path = /var/spool/exim/log/%D-%slog
64840 log_file_path = /var/log/exim/%s.%M
64841 </literallayout>
64842 <para>
64843 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
64844 examples of names generated by the above examples:
64845 </para>
64846 <literallayout class="monospaced">
64847 /var/spool/exim/log/mainlog-20021225
64848 /var/log/exim-reject-20021225.log
64849 /var/spool/exim/log/20021225-mainlog
64850 /var/log/exim/main.200212
64851 </literallayout>
64852 <para>
64853 When this form of log file is specified, Exim automatically switches to new
64854 files at midnight. It does not make any attempt to compress old logs; you
64855 will need to write your own script if you require this. You should not
64856 run <emphasis>exicyclog</emphasis> with this form of logging.
64857 </para>
64858 <para>
64859 The location of the panic log is also determined by <option>log_file_path</option>, but it
64860 is not datestamped, because rotation of the panic log does not make sense.
64861 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
64862 the string. In addition, if it immediately follows a slash, a following
64863 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
64864 character is removed. Thus, the four examples above would give these panic
64865 log names:
64866 </para>
64867 <literallayout class="monospaced">
64868 /var/spool/exim/log/paniclog
64869 /var/log/exim-panic.log
64870 /var/spool/exim/log/paniclog
64871 /var/log/exim/panic
64872 </literallayout>
64873 </section>
64874 <section id="SECID249">
64875 <title>Logging to syslog</title>
64876 <para>
64877 <indexterm role="concept">
64878 <primary>log</primary>
64879 <secondary>syslog; writing to</secondary>
64880 </indexterm>
64881 The use of syslog does not change what Exim logs or the format of its messages,
64882 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
64883 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
64884 that, the same strings are written to syslog as to log files. The syslog
64885 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
64886 by default, but you can change these by setting the <option>syslog_facility</option> and
64887 <option>syslog_processname</option> options, respectively. If Exim was compiled with
64888 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
64889 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
64890 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
64891 the time and host name to each line.
64892 The three log streams are mapped onto syslog priorities as follows:
64893 </para>
64894 <itemizedlist>
64895 <listitem>
64896 <para>
64897 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
64898 </para>
64899 </listitem>
64900 <listitem>
64901 <para>
64902 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
64903 </para>
64904 </listitem>
64905 <listitem>
64906 <para>
64907 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
64908 </para>
64909 </listitem>
64910 </itemizedlist>
64911 <para>
64912 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
64913 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
64914 these are routed by syslog to the same place. You can suppress this duplication
64915 by setting <option>syslog_duplication</option> false.
64916 </para>
64917 <para>
64918 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
64919 entries contain multiple lines when headers are included. To cope with both
64920 these cases, entries written to syslog are split into separate <function>syslog()</function>
64921 calls at each internal newline, and also after a maximum of
64922 870 data characters. (This allows for a total syslog line length of 1024, when
64923 additions such as timestamps are added.) If you are running a syslog
64924 replacement that can handle lines longer than the 1024 characters allowed by
64925 RFC 3164, you should set
64926 </para>
64927 <literallayout class="monospaced">
64928 SYSLOG_LONG_LINES=yes
64929 </literallayout>
64930 <para>
64931 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
64932 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
64933 </para>
64934 <para>
64935 To make it easy to re-assemble split lines later, each component of a split
64936 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;]
64937 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
64938 components in the entry. The / delimiter is used when the line was split
64939 because it was too long; if it was split because of an internal newline, the \
64940 delimiter is used. For example, supposing the length limit to be 50 instead of
64941 870, the following would be the result of a typical rejection message to
64942 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
64943 name, and pid as added by syslog:
64944 </para>
64945 <literallayout class="monospaced">
64946 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
64947 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
64948 [3/5]  when scanning for sender: missing or malformed lo
64949 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
64950 [5/5] mple&gt;)
64951 </literallayout>
64952 <para>
64953 The same error might cause the following lines to be written to <quote>rejectlog</quote>
64954 (LOG_NOTICE):
64955 </para>
64956 <literallayout class="monospaced">
64957 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
64958 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
64959 [3/18] er when scanning for sender: missing or malformed
64960 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
64961 [5\18] .example&gt;)
64962 [6\18] Recipients: ph10@some.domain.cam.example
64963 [7\18] P Received: from [127.0.0.1] (ident=ph10)
64964 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
64965 [9\18]        id 16RdAL-0006pc-00
64966 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
64967 [11\18] 09:43 +0100
64968 [12\18] F From: &lt;&gt;
64969 [13\18]   Subject: this is a test header
64970 [18\18]   X-something: this is another header
64971 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
64972 [16\18] le&gt;
64973 [17\18] B Bcc:
64974 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
64975 </literallayout>
64976 <para>
64977 Log lines that are neither too long nor contain newlines are written to syslog
64978 without modification.
64979 </para>
64980 <para>
64981 If only syslog is being used, the Exim monitor is unable to provide a log tail
64982 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
64983 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
64984 where it is.
64985 </para>
64986 </section>
64987 <section id="SECID250">
64988 <title>Log line flags</title>
64989 <para>
64990 One line is written to the main log for each message received, and for each
64991 successful, unsuccessful, and delayed delivery. These lines can readily be
64992 picked out by the distinctive two-character flags that immediately follow the
64993 timestamp. The flags are:
64994 </para>
64995 <literallayout>
64996 <literal>&lt;=</literal>     message arrival
64997 <literal>(=</literal>     message fakereject
64998 <literal>=&gt;</literal>     normal message delivery
64999 <literal>-&gt;</literal>     additional address in same delivery
65000 <literal>&gt;&gt;</literal>     cutthrough message delivery
65001 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
65002 <literal>**</literal>     delivery failed; address bounced
65003 <literal>==</literal>     delivery deferred; temporary problem
65004 </literallayout>
65005 </section>
65006 <section id="SECID251">
65007 <title>Logging message reception</title>
65008 <para>
65009 <indexterm role="concept">
65010 <primary>log</primary>
65011 <secondary>reception line</secondary>
65012 </indexterm>
65013 The format of the single-line entry in the main log that is written for every
65014 message received is shown in the basic example below, which is split over
65015 several lines in order to fit it on the page:
65016 </para>
65017 <literallayout class="monospaced">
65018 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
65019   H=mailer.fict.example [192.168.123.123] U=exim
65020   P=smtp S=5678 id=&lt;incoming message id&gt;
65021 </literallayout>
65022 <para>
65023 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
65024 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
65025 generated, this is followed by an item of the form
65026 </para>
65027 <literallayout class="monospaced">
65028 R=&lt;message id&gt;
65029 </literallayout>
65030 <para>
65031 which is a reference to the message that caused the bounce to be sent.
65032 </para>
65033 <para>
65034 <indexterm role="concept">
65035 <primary>HELO</primary>
65036 </indexterm>
65037 <indexterm role="concept">
65038 <primary>EHLO</primary>
65039 </indexterm>
65040 For messages from other hosts, the H and U fields identify the remote host and
65041 record the RFC 1413 identity of the user that sent the message, if one was
65042 received. The number given in square brackets is the IP address of the sending
65043 host. If there is a single, unparenthesized  host name in the H field, as
65044 above, it has been verified to correspond to the IP address (see the
65045 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
65046 by the remote host in the SMTP HELO or EHLO command, and has not been
65047 verified. If verification yields a different name to that given for HELO or
65048 EHLO, the verified name appears first, followed by the HELO or EHLO
65049 name in parentheses.
65050 </para>
65051 <para>
65052 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
65053 without brackets, in the HELO or EHLO command, leading to entries in
65054 the log containing text like these examples:
65055 </para>
65056 <literallayout class="monospaced">
65057 H=(10.21.32.43) [192.168.8.34]
65058 H=([10.21.32.43]) [192.168.8.34]
65059 </literallayout>
65060 <para>
65061 This can be confusing. Only the final address in square brackets can be relied
65062 on.
65063 </para>
65064 <para>
65065 For locally generated messages (that is, messages not received over TCP/IP),
65066 the H field is omitted, and the U field contains the login name of the caller
65067 of Exim.
65068 </para>
65069 <para>
65070 <indexterm role="concept">
65071 <primary>authentication</primary>
65072 <secondary>logging</secondary>
65073 </indexterm>
65074 <indexterm role="concept">
65075 <primary>AUTH</primary>
65076 <secondary>logging</secondary>
65077 </indexterm>
65078 For all messages, the P field specifies the protocol used to receive the
65079 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
65080 of incoming SMTP messages, the value indicates whether or not any SMTP
65081 extensions (ESMTP), encryption, or authentication were used. If the SMTP
65082 session was encrypted, there is an additional X field that records the cipher
65083 suite that was used.
65084 </para>
65085 <para>
65086 <indexterm role="concept">
65087 <primary>log</primary>
65088 <secondary>protocol</secondary>
65089 </indexterm>
65090 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
65091 hosts that have authenticated themselves using the SMTP AUTH command. The first
65092 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
65093 there is an additional item A= followed by the name of the authenticator that
65094 was used. If an authenticated identification was set up by the authenticator&#x2019;s
65095 <option>server_set_id</option> option, this is logged too, separated by a colon from the
65096 authenticator name.
65097 </para>
65098 <para>
65099 <indexterm role="concept">
65100 <primary>size</primary>
65101 <secondary>of message</secondary>
65102 </indexterm>
65103 The id field records the existing message id, if present. The size of the
65104 received message is given by the S field. When the message is delivered,
65105 headers may be removed or added, so that the size of delivered copies of the
65106 message may not correspond with this value (and indeed may be different to each
65107 other).
65108 </para>
65109 <para>
65110 The <option>log_selector</option> option can be used to request the logging of additional
65111 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
65112 </para>
65113 </section>
65114 <section id="SECID252">
65115 <title>Logging deliveries</title>
65116 <para>
65117 <indexterm role="concept">
65118 <primary>log</primary>
65119 <secondary>delivery line</secondary>
65120 </indexterm>
65121 The format of the single-line entry in the main log that is written for every
65122 delivery is shown in one of the examples below, for local and remote
65123 deliveries, respectively. Each example has been split into multiple lines in order
65124 to fit it on the page:
65125 </para>
65126 <literallayout class="monospaced">
65127 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
65128   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
65129 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
65130   monk@holistic.fict.example R=dnslookup T=remote_smtp
65131   H=holistic.fict.example [192.168.234.234]
65132 </literallayout>
65133 <para>
65134 For ordinary local deliveries, the original address is given in angle brackets
65135 after the final delivery address, which might be a pipe or a file. If
65136 intermediate address(es) exist between the original and the final address, the
65137 last of these is given in parentheses after the final address. The R and T
65138 fields record the router and transport that were used to process the address.
65139 </para>
65140 <para>
65141 If SMTP AUTH was used for the delivery there is an additional item A=
65142 followed by the name of the authenticator that was used.
65143 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
65144 option, this is logged too, separated by a colon from the authenticator name.
65145 </para>
65146 <para>
65147 If a shadow transport was run after a successful local delivery, the log line
65148 for the successful delivery has an item added on the end, of the form
65149 </para>
65150 <literallayout>
65151 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
65152 </literallayout>
65153 <para>
65154 If the shadow transport did not succeed, the error message is put in
65155 parentheses afterwards.
65156 </para>
65157 <para>
65158 <indexterm role="concept">
65159 <primary>asterisk</primary>
65160 <secondary>after IP address</secondary>
65161 </indexterm>
65162 When more than one address is included in a single delivery (for example, two
65163 SMTP RCPT commands in one transaction) the second and subsequent addresses are
65164 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
65165 down a single SMTP connection, an asterisk follows the IP address in the log
65166 lines for the second and subsequent messages.
65167 </para>
65168 <para>
65169 <indexterm role="concept">
65170 <primary>delivery</primary>
65171 <secondary>cutthrough; logging</secondary>
65172 </indexterm>
65173 <indexterm role="concept">
65174 <primary>cutthrough</primary>
65175 <secondary>logging</secondary>
65176 </indexterm>
65177 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
65178 line precedes the reception line, since cutthrough waits for a possible
65179 rejection from the destination in case it can reject the sourced item.
65180 </para>
65181 <para>
65182 The generation of a reply message by a filter file gets logged as a
65183 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
65184 </para>
65185 <para>
65186 The <option>log_selector</option> option can be used to request the logging of additional
65187 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
65188 </para>
65189 </section>
65190 <section id="SECID253">
65191 <title>Discarded deliveries</title>
65192 <para>
65193 <indexterm role="concept">
65194 <primary>discarded messages</primary>
65195 </indexterm>
65196 <indexterm role="concept">
65197 <primary>message</primary>
65198 <secondary>discarded</secondary>
65199 </indexterm>
65200 <indexterm role="concept">
65201 <primary>delivery</primary>
65202 <secondary>discarded; logging</secondary>
65203 </indexterm>
65204 When a message is discarded as a result of the command <quote>seen finish</quote> being
65205 obeyed in a filter file which generates no deliveries, a log entry of the form
65206 </para>
65207 <literallayout class="monospaced">
65208 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
65209   &lt;low.club@bridge.example&gt; R=userforward
65210 </literallayout>
65211 <para>
65212 is written, to record why no deliveries are logged. When a message is discarded
65213 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
65214 </para>
65215 <literallayout class="monospaced">
65216 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
65217   &lt;hole@nowhere.example&gt; R=blackhole_router
65218 </literallayout>
65219 </section>
65220 <section id="SECID254">
65221 <title>Deferred deliveries</title>
65222 <para>
65223 When a delivery is deferred, a line of the following form is logged:
65224 </para>
65225 <literallayout class="monospaced">
65226 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
65227   R=dnslookup T=smtp defer (146): Connection refused
65228 </literallayout>
65229 <para>
65230 In the case of remote deliveries, the error is the one that was given for the
65231 last IP address that was tried. Details of individual SMTP failures are also
65232 written to the log, so the above line would be preceded by something like
65233 </para>
65234 <literallayout class="monospaced">
65235 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
65236   mail1.endrest.example [192.168.239.239]: Connection refused
65237 </literallayout>
65238 <para>
65239 When a deferred address is skipped because its retry time has not been reached,
65240 a message is written to the log, but this can be suppressed by setting an
65241 appropriate value in <option>log_selector</option>.
65242 </para>
65243 </section>
65244 <section id="SECID255">
65245 <title>Delivery failures</title>
65246 <para>
65247 <indexterm role="concept">
65248 <primary>delivery</primary>
65249 <secondary>failure; logging</secondary>
65250 </indexterm>
65251 If a delivery fails because an address cannot be routed, a line of the
65252 following form is logged:
65253 </para>
65254 <literallayout class="monospaced">
65255 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
65256   &lt;jim@trek99.example&gt;: unknown mail domain
65257 </literallayout>
65258 <para>
65259 If a delivery fails at transport time, the router and transport are shown, and
65260 the response from the remote host is included, as in this example:
65261 </para>
65262 <literallayout class="monospaced">
65263 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
65264   R=dnslookup T=remote_smtp: SMTP error from remote mailer
65265   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
65266   pbmail3.py.example [192.168.63.111]: 553 5.3.0
65267   &lt;ace400@pb.example&gt;...Addressee unknown
65268 </literallayout>
65269 <para>
65270 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
65271 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
65272 disabling PIPELINING. The log lines for all forms of delivery failure are
65273 flagged with <literal>**</literal>.
65274 </para>
65275 </section>
65276 <section id="SECID256">
65277 <title>Fake deliveries</title>
65278 <para>
65279 <indexterm role="concept">
65280 <primary>delivery</primary>
65281 <secondary>fake; logging</secondary>
65282 </indexterm>
65283 If a delivery does not actually take place because the <option>-N</option> option has been
65284 used to suppress it, a normal delivery line is written to the log, except that
65285 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
65286 </para>
65287 </section>
65288 <section id="SECID257">
65289 <title>Completion</title>
65290 <para>
65291 A line of the form
65292 </para>
65293 <literallayout class="monospaced">
65294 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
65295 </literallayout>
65296 <para>
65297 is written to the main log when a message is about to be removed from the spool
65298 at the end of its processing.
65299 </para>
65300 </section>
65301 <section id="SECID258">
65302 <title>Summary of Fields in Log Lines</title>
65303 <para>
65304 <indexterm role="concept">
65305 <primary>log</primary>
65306 <secondary>summary of fields</secondary>
65307 </indexterm>
65308 A summary of the field identifiers that are used in log lines is shown in
65309 the following table:
65310 </para>
65311 <literallayout>
65312 <literal>A   </literal>        authenticator name (and optional id and sender)
65313 <literal>C   </literal>        SMTP confirmation on delivery
65314 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
65315 <literal>CV  </literal>        certificate verification status
65316 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
65317 <literal>DN  </literal>        distinguished name from peer certificate
65318 <literal>DS  </literal>        DNSSEC secured lookups
65319 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
65320 <literal>F   </literal>        sender address (on delivery lines)
65321 <literal>H   </literal>        host name and IP address
65322 <literal>I   </literal>        local interface used
65323 <literal>K   </literal>        CHUNKING extension used
65324 <literal>id  </literal>        message id for incoming message
65325 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
65326 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
65327 <literal>PRDR</literal>        PRDR extension used
65328 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
65329 <literal>Q   </literal>        alternate queue name
65330 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
65331 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
65332 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
65333 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
65334 <literal>S   </literal>        size of message in bytes
65335 <literal>SNI </literal>        server name indication from TLS client hello
65336 <literal>ST  </literal>        shadow transport name
65337 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
65338 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
65339 <literal>U   </literal>        local user or RFC 1413 identity
65340 <literal>X   </literal>        TLS cipher suite
65341 </literallayout>
65342 </section>
65343 <section id="SECID259">
65344 <title>Other log entries</title>
65345 <para>
65346 Various other types of log entry are written from time to time. Most should be
65347 self-explanatory. Among the more common are:
65348 </para>
65349 <itemizedlist>
65350 <listitem>
65351 <para>
65352 <indexterm role="concept">
65353 <primary>retry</primary>
65354 <secondary>time not reached</secondary>
65355 </indexterm>
65356 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
65357 during routing or local delivery, and the time to retry has not yet arrived.
65358 This message is not written to an individual message log file unless it happens
65359 during the first delivery attempt.
65360 </para>
65361 </listitem>
65362 <listitem>
65363 <para>
65364 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
65365 temporary errors during remote delivery, and the retry time has not yet arrived
65366 for any of the hosts to which it is routed.
65367 </para>
65368 </listitem>
65369 <listitem>
65370 <para>
65371 <indexterm role="concept">
65372 <primary>spool directory</primary>
65373 <secondary>file locked</secondary>
65374 </indexterm>
65375 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
65376 some other Exim process is already working on the message. This can be quite
65377 common if queue running processes are started at frequent intervals. The
65378 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
65379 doing.
65380 </para>
65381 </listitem>
65382 <listitem>
65383 <para>
65384 <indexterm role="concept">
65385 <primary>error</primary>
65386 <secondary>ignored</secondary>
65387 </indexterm>
65388 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
65389 message:
65390 </para>
65391 <orderedlist numeration="arabic">
65392 <listitem>
65393 <para>
65394 Exim failed to deliver a bounce message whose age was greater than
65395 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
65396 </para>
65397 </listitem>
65398 <listitem>
65399 <para>
65400 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
65401 failed. The delivery was discarded.
65402 </para>
65403 </listitem>
65404 <listitem>
65405 <para>
65406 A delivery set up by a router configured with
65407 </para>
65408 <literallayout class="monospaced">
65409     errors_to = &lt;&gt;
65410 </literallayout>
65411 <para>
65412 failed. The delivery was discarded.
65413 </para>
65414 </listitem>
65415 </orderedlist>
65416 </listitem>
65417 </itemizedlist>
65418 </section>
65419 <section id="SECTlogselector">
65420 <title>Reducing or increasing what is logged</title>
65421 <para>
65422 <indexterm role="concept">
65423 <primary>log</primary>
65424 <secondary>selectors</secondary>
65425 </indexterm>
65426 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
65427 default logging, or you can request additional logging. The value of
65428 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
65429 example:
65430 </para>
65431 <literallayout class="monospaced">
65432 log_selector = +arguments -retry_defer
65433 </literallayout>
65434 <para>
65435 The list of optional log items is in the following table, with the default
65436 selection marked by asterisks:
65437 </para>
65438 <literallayout>
65439 <literal> 8bitmime                   </literal>  received 8BITMIME status
65440 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
65441 <literal> address_rewrite            </literal>  address rewriting
65442 <literal> all_parents                </literal>  all parents in =&gt; lines
65443 <literal> arguments                  </literal>  command line arguments
65444 <literal>*connection_reject          </literal>  connection rejections
65445 <literal>*delay_delivery             </literal>  immediate delivery delayed
65446 <literal> deliver_time               </literal>  time taken to perform delivery
65447 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
65448 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
65449 <literal> dnssec                     </literal>  DNSSEC secured lookups
65450 <literal>*etrn                       </literal>  ETRN commands
65451 <literal>*host_lookup_failed         </literal>  as it says
65452 <literal> ident_timeout              </literal>  timeout for ident connection
65453 <literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
65454 <literal> incoming_port              </literal>  remote port on &lt;= lines
65455 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
65456 <literal> outgoing_interface         </literal>  local interface on =&gt; lines
65457 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
65458 <literal>*queue_run                  </literal>  start and end queue runs
65459 <literal> queue_time                 </literal>  time on queue for one recipient
65460 <literal> queue_time_overall         </literal>  time on queue for whole message
65461 <literal> pid                        </literal>  Exim process id
65462 <literal> proxy                      </literal>  proxy address on &lt;= and =&gt; lines
65463 <literal> received_recipients        </literal>  recipients on &lt;= lines
65464 <literal> received_sender            </literal>  sender on &lt;= lines
65465 <literal>*rejected_header            </literal>  header contents on reject log
65466 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
65467 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
65468 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
65469 <literal>*sender_verify_fail         </literal>  sender verification failures
65470 <literal>*size_reject                </literal>  rejection because too big
65471 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
65472 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
65473 <literal> smtp_connection            </literal>  incoming SMTP connections
65474 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
65475 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
65476 <literal> smtp_no_mail               </literal>  session with no MAIL commands
65477 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
65478 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
65479 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
65480 <literal>*tls_certificate_verified   </literal>  certificate verification status
65481 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
65482 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
65483 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
65484 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
65485
65486 <literal> all                        </literal>  all of the above
65487 </literallayout>
65488 <para>
65489 See also the <option>slow_lookup_log</option> main configuration option,
65490 section <xref linkend="SECID99"/>
65491 </para>
65492 <para>
65493 More details on each of these items follows:
65494 </para>
65495 <itemizedlist>
65496 <listitem>
65497 <para>
65498 <indexterm role="concept">
65499 <primary>8BITMIME</primary>
65500 </indexterm>
65501 <indexterm role="concept">
65502 <primary>log</primary>
65503 <secondary>8BITMIME</secondary>
65504 </indexterm>
65505 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
65506 which may help in tracking down interoperability issues with ancient MTAs
65507 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
65508 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
65509 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
65510 </para>
65511 </listitem>
65512 <listitem>
65513 <para>
65514 <indexterm role="concept">
65515 <primary><option>warn</option> ACL verb</primary>
65516 <secondary>log when skipping</secondary>
65517 </indexterm>
65518 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
65519 its conditions cannot be evaluated, a log line to this effect is written if
65520 this log selector is set.
65521 </para>
65522 </listitem>
65523 <listitem>
65524 <para>
65525 <indexterm role="concept">
65526 <primary>log</primary>
65527 <secondary>rewriting</secondary>
65528 </indexterm>
65529 <indexterm role="concept">
65530 <primary>rewriting</primary>
65531 <secondary>logging</secondary>
65532 </indexterm>
65533 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
65534 rewrites, but not to rewrites in filters run as an unprivileged user (because
65535 such users cannot access the log).
65536 </para>
65537 </listitem>
65538 <listitem>
65539 <para>
65540 <indexterm role="concept">
65541 <primary>log</primary>
65542 <secondary>full parentage</secondary>
65543 </indexterm>
65544 <option>all_parents</option>: Normally only the original and final addresses are logged on
65545 delivery lines; with this selector, intermediate parents are given in
65546 parentheses between them.
65547 </para>
65548 </listitem>
65549 <listitem>
65550 <para>
65551 <indexterm role="concept">
65552 <primary>log</primary>
65553 <secondary>Exim arguments</secondary>
65554 </indexterm>
65555 <indexterm role="concept">
65556 <primary>Exim arguments, logging</primary>
65557 </indexterm>
65558 <option>arguments</option>: This causes Exim to write the arguments with which it was called
65559 to the main log, preceded by the current working directory. This is a debugging
65560 feature, added to make it easier to find out how certain MUAs call
65561 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
65562 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
65563 that are empty or that contain white space are quoted. Non-printing characters
65564 are shown as escape sequences. This facility cannot log unrecognized arguments,
65565 because the arguments are checked before the configuration file is read. The
65566 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
65567 between the caller and Exim.
65568 </para>
65569 </listitem>
65570 <listitem>
65571 <para>
65572 <indexterm role="concept">
65573 <primary>log</primary>
65574 <secondary>connection rejections</secondary>
65575 </indexterm>
65576 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
65577 connection is rejected, for whatever reason.
65578 </para>
65579 </listitem>
65580 <listitem>
65581 <para>
65582 <indexterm role="concept">
65583 <primary>log</primary>
65584 <secondary>delayed delivery</secondary>
65585 </indexterm>
65586 <indexterm role="concept">
65587 <primary>delayed delivery, logging</primary>
65588 </indexterm>
65589 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
65590 started for an incoming message because the load is too high or too many
65591 messages were received on one connection. Logging does not occur if no delivery
65592 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
65593 </para>
65594 </listitem>
65595 <listitem>
65596 <para>
65597 <indexterm role="concept">
65598 <primary>log</primary>
65599 <secondary>delivery duration</secondary>
65600 </indexterm>
65601 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
65602 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
65603 </para>
65604 </listitem>
65605 <listitem>
65606 <para>
65607 <indexterm role="concept">
65608 <primary>log</primary>
65609 <secondary>message size on delivery</secondary>
65610 </indexterm>
65611 <indexterm role="concept">
65612 <primary>size</primary>
65613 <secondary>of message</secondary>
65614 </indexterm>
65615 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
65616 the <quote>=&gt;</quote> line, tagged with S=.
65617 </para>
65618 </listitem>
65619 <listitem>
65620 <para>
65621 <indexterm role="concept">
65622 <primary>log</primary>
65623 <secondary>dnslist defer</secondary>
65624 </indexterm>
65625 <indexterm role="concept">
65626 <primary>DNS list</primary>
65627 <secondary>logging defer</secondary>
65628 </indexterm>
65629 <indexterm role="concept">
65630 <primary>black list (DNS)</primary>
65631 </indexterm>
65632 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
65633 DNS black list suffers a temporary error.
65634 </para>
65635 </listitem>
65636 <listitem>
65637 <para>
65638 <indexterm role="concept">
65639 <primary>log</primary>
65640 <secondary>dnssec</secondary>
65641 </indexterm>
65642 <indexterm role="concept">
65643 <primary>dnssec</primary>
65644 <secondary>logging</secondary>
65645 </indexterm>
65646 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
65647 dns lookups gave secure results a tag of DS is added.
65648 For acceptance this covers the reverse and forward lookups for host name verification.
65649 It does not cover helo-name verification.
65650 For delivery this covers the SRV, MX, A and/or AAAA lookups.
65651 </para>
65652 </listitem>
65653 <listitem>
65654 <para>
65655 <indexterm role="concept">
65656 <primary>log</primary>
65657 <secondary>ETRN commands</secondary>
65658 </indexterm>
65659 <indexterm role="concept">
65660 <primary>ETRN</primary>
65661 <secondary>logging</secondary>
65662 </indexterm>
65663 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
65664 is run to determine whether or not it is actually accepted. An invalid ETRN
65665 command, or one received within a message transaction is not logged by this
65666 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
65667 </para>
65668 </listitem>
65669 <listitem>
65670 <para>
65671 <indexterm role="concept">
65672 <primary>log</primary>
65673 <secondary>host lookup failure</secondary>
65674 </indexterm>
65675 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
65676 any addresses, or when a lookup of an IP address fails to find a host name, a
65677 log line is written. This logging does not apply to direct DNS lookups when
65678 routing email addresses, but it does apply to <quote>byname</quote> lookups.
65679 </para>
65680 </listitem>
65681 <listitem>
65682 <para>
65683 <indexterm role="concept">
65684 <primary>log</primary>
65685 <secondary>ident timeout</secondary>
65686 </indexterm>
65687 <indexterm role="concept">
65688 <primary>RFC 1413</primary>
65689 <secondary>logging timeout</secondary>
65690 </indexterm>
65691 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
65692 client&#x2019;s ident port times out.
65693 </para>
65694 </listitem>
65695 <listitem>
65696 <para>
65697 <indexterm role="concept">
65698 <primary>log</primary>
65699 <secondary>incoming interface</secondary>
65700 </indexterm>
65701 <indexterm role="concept">
65702 <primary>log</primary>
65703 <secondary>local interface</secondary>
65704 </indexterm>
65705 <indexterm role="concept">
65706 <primary>log</primary>
65707 <secondary>local address and port</secondary>
65708 </indexterm>
65709 <indexterm role="concept">
65710 <primary>TCP/IP</primary>
65711 <secondary>logging local address and port</secondary>
65712 </indexterm>
65713 <indexterm role="concept">
65714 <primary>interface</primary>
65715 <secondary>logging</secondary>
65716 </indexterm>
65717 <option>incoming_interface</option>: The interface on which a message was received is added
65718 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
65719 followed by a colon and the port number. The local interface and port are also
65720 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, to
65721 rejection lines, and (despite the name) to outgoing <quote>=&gt;</quote> and <quote>-&gt;</quote> lines.
65722 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
65723 </para>
65724 </listitem>
65725 <listitem>
65726 <para>
65727 <indexterm role="concept">
65728 <primary>log</primary>
65729 <secondary>incoming proxy address</secondary>
65730 </indexterm>
65731 <indexterm role="concept">
65732 <primary>proxy</primary>
65733 <secondary>logging proxy address</secondary>
65734 </indexterm>
65735 <indexterm role="concept">
65736 <primary>TCP/IP</primary>
65737 <secondary>logging proxy address</secondary>
65738 </indexterm>
65739 <option>proxy</option>: The internal (closest to the system running Exim) IP address
65740 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
65741 on a proxied connection
65742 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
65743 See <xref linkend="SECTproxyInbound"/> for more information.
65744 </para>
65745 </listitem>
65746 <listitem>
65747 <para>
65748 <indexterm role="concept">
65749 <primary>log</primary>
65750 <secondary>incoming remote port</secondary>
65751 </indexterm>
65752 <indexterm role="concept">
65753 <primary>port</primary>
65754 <secondary>logging remote</secondary>
65755 </indexterm>
65756 <indexterm role="concept">
65757 <primary>TCP/IP</primary>
65758 <secondary>logging incoming remote port</secondary>
65759 </indexterm>
65760 <indexterm role="variable">
65761 <primary><varname>$sender_fullhost</varname></primary>
65762 </indexterm>
65763 <indexterm role="variable">
65764 <primary><varname>$sender_rcvhost</varname></primary>
65765 </indexterm>
65766 <option>incoming_port</option>: The remote port number from which a message was received is
65767 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
65768 in square brackets, and separated from it by a colon. This is implemented by
65769 changing the value that is put in the <varname>$sender_fullhost</varname> and
65770 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
65771 important with the widening use of NAT (see RFC 2505).
65772 </para>
65773 </listitem>
65774 <listitem>
65775 <para>
65776 <indexterm role="concept">
65777 <primary>log</primary>
65778 <secondary>dropped connection</secondary>
65779 </indexterm>
65780 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
65781 connection is unexpectedly dropped.
65782 </para>
65783 </listitem>
65784 <listitem>
65785 <para>
65786 <indexterm role="concept">
65787 <primary>log</primary>
65788 <secondary>outgoing interface</secondary>
65789 </indexterm>
65790 <indexterm role="concept">
65791 <primary>log</primary>
65792 <secondary>local interface</secondary>
65793 </indexterm>
65794 <indexterm role="concept">
65795 <primary>log</primary>
65796 <secondary>local address and port</secondary>
65797 </indexterm>
65798 <indexterm role="concept">
65799 <primary>TCP/IP</primary>
65800 <secondary>logging local address and port</secondary>
65801 </indexterm>
65802 <indexterm role="concept">
65803 <primary>interface</primary>
65804 <secondary>logging</secondary>
65805 </indexterm>
65806 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
65807 interface on which a message was sent is added to delivery lines as an I= tag
65808 followed by IP address in square brackets. You can disable this by turning
65809 off the <option>outgoing_interface</option> option.
65810 </para>
65811 </listitem>
65812 <listitem>
65813 <para>
65814 <indexterm role="concept">
65815 <primary>log</primary>
65816 <secondary>outgoing remote port</secondary>
65817 </indexterm>
65818 <indexterm role="concept">
65819 <primary>port</primary>
65820 <secondary>logging outgoint remote</secondary>
65821 </indexterm>
65822 <indexterm role="concept">
65823 <primary>TCP/IP</primary>
65824 <secondary>logging outgoing remote port</secondary>
65825 </indexterm>
65826 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
65827 containing =&gt; tags) following the IP address.
65828 The local port is also added if <option>incoming_interface</option> and
65829 <option>outgoing_interface</option> are both enabled.
65830 This option is not included in the default setting, because for most ordinary
65831 configurations, the remote port number is always 25 (the SMTP port), and the
65832 local port is a random ephemeral port.
65833 </para>
65834 </listitem>
65835 <listitem>
65836 <para>
65837 <indexterm role="concept">
65838 <primary>log</primary>
65839 <secondary>process ids in</secondary>
65840 </indexterm>
65841 <indexterm role="concept">
65842 <primary>pid (process id)</primary>
65843 <secondary>in log lines</secondary>
65844 </indexterm>
65845 <option>pid</option>: The current process id is added to every log line, in square brackets,
65846 immediately after the time and date.
65847 </para>
65848 </listitem>
65849 <listitem>
65850 <para>
65851 <indexterm role="concept">
65852 <primary>log</primary>
65853 <secondary>queue run</secondary>
65854 </indexterm>
65855 <indexterm role="concept">
65856 <primary>queue runner</primary>
65857 <secondary>logging</secondary>
65858 </indexterm>
65859 <option>queue_run</option>: The start and end of every queue run are logged.
65860 </para>
65861 </listitem>
65862 <listitem>
65863 <para>
65864 <indexterm role="concept">
65865 <primary>log</primary>
65866 <secondary>queue time</secondary>
65867 </indexterm>
65868 <option>queue_time</option>: The amount of time the message has been in the queue on the
65869 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
65870 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
65871 includes reception time as well as the delivery time for the current address.
65872 This means that it may be longer than the difference between the arrival and
65873 delivery log line times, because the arrival log line is not written until the
65874 message has been successfully received.
65875 </para>
65876 </listitem>
65877 <listitem>
65878 <para>
65879 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
65880 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
65881 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
65882 message, so it includes reception time as well as the total delivery time.
65883 </para>
65884 </listitem>
65885 <listitem>
65886 <para>
65887 <indexterm role="concept">
65888 <primary>log</primary>
65889 <secondary>recipients</secondary>
65890 </indexterm>
65891 <option>received_recipients</option>: The recipients of a message are listed in the main log
65892 as soon as the message is received. The list appears at the end of the log line
65893 that is written when a message is received, preceded by the word <quote>for</quote>. The
65894 addresses are listed after they have been qualified, but before any rewriting
65895 has taken place.
65896 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
65897 in the list.
65898 </para>
65899 </listitem>
65900 <listitem>
65901 <para>
65902 <indexterm role="concept">
65903 <primary>log</primary>
65904 <secondary>sender reception</secondary>
65905 </indexterm>
65906 <option>received_sender</option>: The unrewritten original sender of a message is added to
65907 the end of the log line that records the message&#x2019;s arrival, after the word
65908 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
65909 </para>
65910 </listitem>
65911 <listitem>
65912 <para>
65913 <indexterm role="concept">
65914 <primary>log</primary>
65915 <secondary>header lines for rejection</secondary>
65916 </indexterm>
65917 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
65918 rejection is written to the reject log, the complete header is added to the
65919 log. Header logging can be turned off individually for messages that are
65920 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
65921 </para>
65922 </listitem>
65923 <listitem>
65924 <para>
65925 <indexterm role="concept">
65926 <primary>log</primary>
65927 <secondary>retry defer</secondary>
65928 </indexterm>
65929 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
65930 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
65931 message is always omitted from individual message logs after the first delivery
65932 attempt.
65933 </para>
65934 </listitem>
65935 <listitem>
65936 <para>
65937 <indexterm role="concept">
65938 <primary>log</primary>
65939 <secondary>return path</secondary>
65940 </indexterm>
65941 <option>return_path_on_delivery</option>: The return path that is being transmitted with
65942 the message is included in delivery and bounce lines, using the tag P=.
65943 This is omitted if no delivery actually happens, for example, if routing fails,
65944 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
65945 </para>
65946 </listitem>
65947 <listitem>
65948 <para>
65949 <indexterm role="concept">
65950 <primary>log</primary>
65951 <secondary>sender on delivery</secondary>
65952 </indexterm>
65953 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
65954 and bounce line, tagged by F= (for <quote>from</quote>).
65955 This is the original sender that was received with the message; it is not
65956 necessarily the same as the outgoing return path.
65957 </para>
65958 </listitem>
65959 <listitem>
65960 <para>
65961 <indexterm role="concept">
65962 <primary>log</primary>
65963 <secondary>sender verify failure</secondary>
65964 </indexterm>
65965 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
65966 gives details of a sender verification failure is not written. Log lines for
65967 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
65968 detail is lost.
65969 </para>
65970 </listitem>
65971 <listitem>
65972 <para>
65973 <indexterm role="concept">
65974 <primary>log</primary>
65975 <secondary>size rejection</secondary>
65976 </indexterm>
65977 <option>size_reject</option>: A log line is written whenever a message is rejected because
65978 it is too big.
65979 </para>
65980 </listitem>
65981 <listitem>
65982 <para>
65983 <indexterm role="concept">
65984 <primary>log</primary>
65985 <secondary>frozen messages; skipped</secondary>
65986 </indexterm>
65987 <indexterm role="concept">
65988 <primary>frozen messages</primary>
65989 <secondary>logging skipping</secondary>
65990 </indexterm>
65991 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
65992 queue run because it is frozen or because another process is already delivering
65993 it.
65994 <indexterm role="concept">
65995 <primary><quote>spool file is locked</quote></primary>
65996 </indexterm>
65997 The message that is written is <quote>spool file is locked</quote>.
65998 </para>
65999 </listitem>
66000 <listitem>
66001 <para>
66002 <indexterm role="concept">
66003 <primary>log</primary>
66004 <secondary>smtp confirmation</secondary>
66005 </indexterm>
66006 <indexterm role="concept">
66007 <primary>SMTP</primary>
66008 <secondary>logging confirmation</secondary>
66009 </indexterm>
66010 <indexterm role="concept">
66011 <primary>LMTP</primary>
66012 <secondary>logging confirmation</secondary>
66013 </indexterm>
66014 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
66015 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
66016 A number of MTAs (including Exim) return an identifying string in this
66017 response.
66018 </para>
66019 </listitem>
66020 <listitem>
66021 <para>
66022 <indexterm role="concept">
66023 <primary>log</primary>
66024 <secondary>SMTP connections</secondary>
66025 </indexterm>
66026 <indexterm role="concept">
66027 <primary>SMTP</primary>
66028 <secondary>logging connections</secondary>
66029 </indexterm>
66030 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
66031 established or closed, unless the connection is from a host that matches
66032 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
66033 only when the closure is unexpected.) This applies to connections from local
66034 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
66035 dropped in the middle of a message, a log line is always written, whether or
66036 not this selector is set, but otherwise nothing is written at the start and end
66037 of connections unless this selector is enabled.
66038 </para>
66039 <para>
66040 For TCP/IP connections to an Exim daemon, the current number of connections is
66041 included in the log message for each new connection, but note that the count is
66042 reset if the daemon is restarted.
66043 Also, because connections are closed (and the closure is logged) in
66044 subprocesses, the count may not include connections that have been closed but
66045 whose termination the daemon has not yet noticed. Thus, while it is possible to
66046 match up the opening and closing of connections in the log, the value of the
66047 logged counts may not be entirely accurate.
66048 </para>
66049 </listitem>
66050 <listitem>
66051 <para>
66052 <indexterm role="concept">
66053 <primary>log</primary>
66054 <secondary>SMTP transaction; incomplete</secondary>
66055 </indexterm>
66056 <indexterm role="concept">
66057 <primary>SMTP</primary>
66058 <secondary>logging incomplete transactions</secondary>
66059 </indexterm>
66060 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
66061 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
66062 and the message sender plus any accepted recipients are included in the log
66063 line. This can provide evidence of dictionary attacks.
66064 </para>
66065 </listitem>
66066 <listitem>
66067 <para>
66068 <indexterm role="concept">
66069 <primary>log</primary>
66070 <secondary>non-MAIL SMTP sessions</secondary>
66071 </indexterm>
66072 <indexterm role="concept">
66073 <primary>MAIL</primary>
66074 <secondary>logging session without</secondary>
66075 </indexterm>
66076 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
66077 connection terminates without having issued a MAIL command. This includes both
66078 the case when the connection is dropped, and the case when QUIT is used. It
66079 does not include cases where the connection is rejected right at the start (by
66080 an ACL, or because there are too many connections, or whatever). These cases
66081 already have their own log lines.
66082 </para>
66083 <para>
66084 The log line that is written contains the identity of the client in the usual
66085 way, followed by D= and a time, which records the duration of the connection.
66086 If the connection was authenticated, this fact is logged exactly as it is for
66087 an incoming message, with an A= item. If the connection was encrypted, CV=,
66088 DN=, and X= items may appear as they do for an incoming message, controlled by
66089 the same logging options.
66090 </para>
66091 <para>
66092 Finally, if any SMTP commands were issued during the connection, a C= item
66093 is added to the line, listing the commands that were used. For example,
66094 </para>
66095 <literallayout class="monospaced">
66096 C=EHLO,QUIT
66097 </literallayout>
66098 <para>
66099 shows that the client issued QUIT straight after EHLO. If there were fewer
66100 than 20 commands, they are all listed. If there were more than 20 commands,
66101 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
66102 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
66103 have been aborted before 20 non-mail commands are processed.
66104 </para>
66105 </listitem>
66106 <listitem>
66107 <para>
66108 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
66109 colon-separated, is appended to the A= item for a message arrival or delivery
66110 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
66111 was accepted or used.
66112 </para>
66113 </listitem>
66114 <listitem>
66115 <para>
66116 <indexterm role="concept">
66117 <primary>log</primary>
66118 <secondary>SMTP protocol error</secondary>
66119 </indexterm>
66120 <indexterm role="concept">
66121 <primary>SMTP</primary>
66122 <secondary>logging protocol error</secondary>
66123 </indexterm>
66124 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
66125 encountered. Exim does not have perfect detection of all protocol errors
66126 because of transmission delays and the use of pipelining. If PIPELINING has
66127 been advertised to a client, an Exim server assumes that the client will use
66128 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
66129 received after rejecting MAIL) as protocol errors.
66130 </para>
66131 </listitem>
66132 <listitem>
66133 <para>
66134 <indexterm role="concept">
66135 <primary>SMTP</primary>
66136 <secondary>logging syntax errors</secondary>
66137 </indexterm>
66138 <indexterm role="concept">
66139 <primary>SMTP</primary>
66140 <secondary>syntax errors; logging</secondary>
66141 </indexterm>
66142 <indexterm role="concept">
66143 <primary>SMTP</primary>
66144 <secondary>unknown command; logging</secondary>
66145 </indexterm>
66146 <indexterm role="concept">
66147 <primary>log</primary>
66148 <secondary>unknown SMTP command</secondary>
66149 </indexterm>
66150 <indexterm role="concept">
66151 <primary>log</primary>
66152 <secondary>SMTP syntax error</secondary>
66153 </indexterm>
66154 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
66155 encountered. An unrecognized command is treated as a syntax error. For an
66156 external connection, the host identity is given; for an internal connection
66157 using <option>-bs</option> the sender identification (normally the calling user) is given.
66158 </para>
66159 </listitem>
66160 <listitem>
66161 <para>
66162 <indexterm role="concept">
66163 <primary>log</primary>
66164 <secondary>subject</secondary>
66165 </indexterm>
66166 <indexterm role="concept">
66167 <primary>subject, logging</primary>
66168 </indexterm>
66169 <option>subject</option>: The subject of the message is added to the arrival log line,
66170 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
66171 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
66172 specifies whether characters with values greater than 127 should be logged
66173 unchanged, or whether they should be rendered as escape sequences.
66174 </para>
66175 </listitem>
66176 <listitem>
66177 <para>
66178 <indexterm role="concept">
66179 <primary>log</primary>
66180 <secondary>certificate verification</secondary>
66181 </indexterm>
66182 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
66183 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
66184 verified, and <literal>CV=no</literal> if not.
66185 </para>
66186 </listitem>
66187 <listitem>
66188 <para>
66189 <indexterm role="concept">
66190 <primary>log</primary>
66191 <secondary>TLS cipher</secondary>
66192 </indexterm>
66193 <indexterm role="concept">
66194 <primary>TLS</primary>
66195 <secondary>logging cipher</secondary>
66196 </indexterm>
66197 <option>tls_cipher</option>: When a message is sent or received over an encrypted
66198 connection, the cipher suite used is added to the log line, preceded by X=.
66199 </para>
66200 </listitem>
66201 <listitem>
66202 <para>
66203 <indexterm role="concept">
66204 <primary>log</primary>
66205 <secondary>TLS peer DN</secondary>
66206 </indexterm>
66207 <indexterm role="concept">
66208 <primary>TLS</primary>
66209 <secondary>logging peer DN</secondary>
66210 </indexterm>
66211 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
66212 connection, and a certificate is supplied by the remote host, the peer DN is
66213 added to the log line, preceded by DN=.
66214 </para>
66215 </listitem>
66216 <listitem>
66217 <para>
66218 <indexterm role="concept">
66219 <primary>log</primary>
66220 <secondary>TLS SNI</secondary>
66221 </indexterm>
66222 <indexterm role="concept">
66223 <primary>TLS</primary>
66224 <secondary>logging SNI</secondary>
66225 </indexterm>
66226 <option>tls_sni</option>: When a message is received over an encrypted connection, and
66227 the remote host provided the Server Name Indication extension, the SNI is
66228 added to the log line, preceded by SNI=.
66229 </para>
66230 </listitem>
66231 <listitem>
66232 <para>
66233 <indexterm role="concept">
66234 <primary>log</primary>
66235 <secondary>DNS failure in list</secondary>
66236 </indexterm>
66237 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
66238 result of a list match is failure because a DNS lookup failed.
66239 </para>
66240 </listitem>
66241 </itemizedlist>
66242 </section>
66243 <section id="SECID260">
66244 <title>Message log</title>
66245 <para>
66246 <indexterm role="concept">
66247 <primary>message</primary>
66248 <secondary>log file for</secondary>
66249 </indexterm>
66250 <indexterm role="concept">
66251 <primary>log</primary>
66252 <secondary>message log; description of</secondary>
66253 </indexterm>
66254 <indexterm role="concept">
66255 <primary><filename>msglog</filename> directory</primary>
66256 </indexterm>
66257 <indexterm role="option">
66258 <primary><option>preserve_message_logs</option></primary>
66259 </indexterm>
66260 In addition to the general log files, Exim writes a log file for each message
66261 that it handles. The names of these per-message logs are the message ids, and
66262 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
66263 message log contains copies of the log lines that apply to the message. This
66264 makes it easier to inspect the status of an individual message without having
66265 to search the main log. A message log is deleted when processing of the message
66266 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
66267 only with great care because they can fill up your disk very quickly.
66268 </para>
66269 <para>
66270 On a heavily loaded system, it may be desirable to disable the use of
66271 per-message logs, in order to reduce disk I/O. This can be done by setting the
66272 <option>message_logs</option> option false.
66273 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
66274 </para>
66275 </section>
66276 </chapter>
66277
66278 <chapter id="CHAPutils">
66279 <title>Exim utilities</title>
66280 <para>
66281 <indexterm role="concept" id="IIDutils" class="startofrange">
66282 <primary>utilities</primary>
66283 </indexterm>
66284 A number of utility scripts and programs are supplied with Exim and are
66285 described in this chapter. There is also the Exim Monitor, which is covered in
66286 the next chapter. The utilities described here are:
66287 </para>
66288 <informaltable frame="none">
66289 <tgroup cols="3" colsep="0" rowsep="0">
66290 <colspec colwidth="7*" align="left"/>
66291 <colspec colwidth="15*" align="left"/>
66292 <colspec colwidth="40*" align="left"/>
66293 <tbody>
66294 <row>
66295 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
66296 <entry><emphasis>exiwhat</emphasis></entry>
66297 <entry>list what Exim processes are doing</entry>
66298 </row>
66299 <row>
66300 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
66301 <entry><emphasis>exiqgrep</emphasis></entry>
66302 <entry>grep the queue</entry>
66303 </row>
66304 <row>
66305 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
66306 <entry><emphasis>exiqsumm</emphasis></entry>
66307 <entry>summarize the queue</entry>
66308 </row>
66309 <row>
66310 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
66311 <entry><emphasis>exigrep</emphasis></entry>
66312 <entry>search the main log</entry>
66313 </row>
66314 <row>
66315 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
66316 <entry><emphasis>exipick</emphasis></entry>
66317 <entry>select messages on various criteria</entry>
66318 </row>
66319 <row>
66320 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
66321 <entry><emphasis>exicyclog</emphasis></entry>
66322 <entry>cycle (rotate) log files</entry>
66323 </row>
66324 <row>
66325 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
66326 <entry><emphasis>eximstats</emphasis></entry>
66327 <entry>extract statistics from the log</entry>
66328 </row>
66329 <row>
66330 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
66331 <entry><emphasis>exim_checkaccess</emphasis></entry>
66332 <entry>check address acceptance from given IP</entry>
66333 </row>
66334 <row>
66335 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
66336 <entry><emphasis>exim_dbmbuild</emphasis></entry>
66337 <entry>build a DBM file</entry>
66338 </row>
66339 <row>
66340 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
66341 <entry><emphasis>exinext</emphasis></entry>
66342 <entry>extract retry information</entry>
66343 </row>
66344 <row>
66345 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66346 <entry><emphasis>exim_dumpdb</emphasis></entry>
66347 <entry>dump a hints database</entry>
66348 </row>
66349 <row>
66350 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66351 <entry><emphasis>exim_tidydb</emphasis></entry>
66352 <entry>clean up a hints database</entry>
66353 </row>
66354 <row>
66355 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECThindatmai"/></entry>
66356 <entry><emphasis>exim_fixdb</emphasis></entry>
66357 <entry>patch a hints database</entry>
66358 </row>
66359 <row>
66360 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
66361 <entry><emphasis>exim_lock</emphasis></entry>
66362 <entry>lock a mailbox file</entry>
66363 </row>
66364 </tbody>
66365 </tgroup>
66366 </informaltable>
66367 <para>
66368 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
66369 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
66370 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
66371 </para>
66372 <section id="SECTfinoutwha">
66373 <title>Finding out what Exim processes are doing (exiwhat)</title>
66374 <para>
66375 <indexterm role="concept">
66376 <primary><emphasis>exiwhat</emphasis></primary>
66377 </indexterm>
66378 <indexterm role="concept">
66379 <primary>process, querying</primary>
66380 </indexterm>
66381 <indexterm role="concept">
66382 <primary>SIGUSR1</primary>
66383 </indexterm>
66384 On operating systems that can restart a system call after receiving a signal
66385 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
66386 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
66387 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
66388 processes it can find, having first emptied the file. It then waits for one
66389 second to allow the Exim processes to react before displaying the results. In
66390 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
66391 send the signal to the Exim processes, so it is normally run as root.
66392 </para>
66393 <para>
66394 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
66395 use by system administrators. It is not sensible, for example, to set up a
66396 script that sends SIGUSR1 signals to Exim processes at short intervals.
66397 </para>
66398 <para>
66399 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
66400 varies in different operating systems. Not only are different options used,
66401 but the format of the output is different. For this reason, there are some
66402 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
66403 it doesn&#x2019;t seem to be working for you, check the following compile-time
66404 options:
66405 </para>
66406 <literallayout>
66407 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
66408 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
66409 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
66410 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
66411 </literallayout>
66412 <para>
66413 An example of typical output from <emphasis>exiwhat</emphasis> is
66414 </para>
66415 <literallayout class="monospaced">
66416 164 daemon: -q1h, listening on port 25
66417 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
66418 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
66419   [10.19.42.42] (editor@ref.example)
66420 10592 handling incoming call from [192.168.243.242]
66421 10628 accepting a local non-SMTP message
66422 </literallayout>
66423 <para>
66424 The first number in the output line is the process number. The third line has
66425 been split here, in order to fit it on the page.
66426 </para>
66427 </section>
66428 <section id="SECTgreptheque">
66429 <title>Selective queue listing (exiqgrep)</title>
66430 <para>
66431 <indexterm role="concept">
66432 <primary><emphasis>exiqgrep</emphasis></primary>
66433 </indexterm>
66434 <indexterm role="concept">
66435 <primary>queue</primary>
66436 <secondary>grepping</secondary>
66437 </indexterm>
66438 This utility is a Perl script contributed by Matt Hubbard. It runs
66439 </para>
66440 <literallayout class="monospaced">
66441 exim -bpu
66442 </literallayout>
66443 <para>
66444 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
66445 </para>
66446 <literallayout class="monospaced">
66447 exim -bp
66448 </literallayout>
66449 <para>
66450 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
66451 contain alternate exim configuration the queue management might be using.
66452 </para>
66453 <para>
66454 to obtain a queue listing, and then greps the output to select messages
66455 that match given criteria. The following selection options are available:
66456 </para>
66457 <variablelist>
66458 <varlistentry>
66459 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66460 <listitem>
66461 <para>
66462 Match the sender address using a case-insensitive search. The field that is
66463 tested is enclosed in angle brackets, so you can test for bounce messages with
66464 </para>
66465 <literallayout class="monospaced">
66466 exiqgrep -f '^&lt;&gt;$'
66467 </literallayout>
66468 </listitem></varlistentry>
66469 <varlistentry>
66470 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66471 <listitem>
66472 <para>
66473 Match a recipient address using a case-insensitive search. The field that is
66474 tested is not enclosed in angle brackets.
66475 </para>
66476 </listitem></varlistentry>
66477 <varlistentry>
66478 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
66479 <listitem>
66480 <para>
66481 Match against the size field.
66482 </para>
66483 </listitem></varlistentry>
66484 <varlistentry>
66485 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
66486 <listitem>
66487 <para>
66488 Match messages that are younger than the given time.
66489 </para>
66490 </listitem></varlistentry>
66491 <varlistentry>
66492 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
66493 <listitem>
66494 <para>
66495 Match messages that are older than the given time.
66496 </para>
66497 </listitem></varlistentry>
66498 <varlistentry>
66499 <term><emphasis role="bold">-z</emphasis></term>
66500 <listitem>
66501 <para>
66502 Match only frozen messages.
66503 </para>
66504 </listitem></varlistentry>
66505 <varlistentry>
66506 <term><emphasis role="bold">-x</emphasis></term>
66507 <listitem>
66508 <para>
66509 Match only non-frozen messages.
66510 </para>
66511 </listitem></varlistentry>
66512 </variablelist>
66513 <para>
66514 The following options control the format of the output:
66515 </para>
66516 <variablelist>
66517 <varlistentry>
66518 <term><emphasis role="bold">-c</emphasis></term>
66519 <listitem>
66520 <para>
66521 Display only the count of matching messages.
66522 </para>
66523 </listitem></varlistentry>
66524 <varlistentry>
66525 <term><emphasis role="bold">-l</emphasis></term>
66526 <listitem>
66527 <para>
66528 Long format &ndash; display the full message information as output by Exim. This is
66529 the default.
66530 </para>
66531 </listitem></varlistentry>
66532 <varlistentry>
66533 <term><emphasis role="bold">-i</emphasis></term>
66534 <listitem>
66535 <para>
66536 Display message ids only.
66537 </para>
66538 </listitem></varlistentry>
66539 <varlistentry>
66540 <term><emphasis role="bold">-b</emphasis></term>
66541 <listitem>
66542 <para>
66543 Brief format &ndash; one line per message.
66544 </para>
66545 </listitem></varlistentry>
66546 <varlistentry>
66547 <term><emphasis role="bold">-R</emphasis></term>
66548 <listitem>
66549 <para>
66550 Display messages in reverse order.
66551 </para>
66552 </listitem></varlistentry>
66553 <varlistentry>
66554 <term><emphasis role="bold">-a</emphasis></term>
66555 <listitem>
66556 <para>
66557 Include delivered recipients in queue listing.
66558 </para>
66559 </listitem></varlistentry>
66560 </variablelist>
66561 <para>
66562 There is one more option, <option>-h</option>, which outputs a list of options.
66563 </para>
66564 </section>
66565 <section id="SECTsumtheque">
66566 <title>Summarizing the queue (exiqsumm)</title>
66567 <para>
66568 <indexterm role="concept">
66569 <primary><emphasis>exiqsumm</emphasis></primary>
66570 </indexterm>
66571 <indexterm role="concept">
66572 <primary>queue</primary>
66573 <secondary>summary</secondary>
66574 </indexterm>
66575 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
66576 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
66577 running a command such as
66578 </para>
66579 <literallayout class="monospaced">
66580 exim -bp | exiqsumm
66581 </literallayout>
66582 <para>
66583 The output consists of one line for each domain that has messages waiting for
66584 it, as in the following example:
66585 </para>
66586 <literallayout class="monospaced">
66587 3   2322   74m   66m  msn.com.example
66588 </literallayout>
66589 <para>
66590 Each line lists the number of pending deliveries for a domain, their total
66591 volume, and the length of time that the oldest and the newest messages have
66592 been waiting. Note that the number of pending deliveries is greater than the
66593 number of messages when messages have more than one recipient.
66594 </para>
66595 <para>
66596 A summary line is output at the end. By default the output is sorted on the
66597 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
66598 the output to be sorted by oldest message and by count of messages,
66599 respectively. There are also three options that split the messages for each
66600 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
66601 separates frozen messages, and <option>-s</option> separates messages according to their
66602 sender.
66603 </para>
66604 <para>
66605 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
66606 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
66607 generated by aliasing or forwarding are included (unless the <option>one_time</option>
66608 option of the <command>redirect</command> router has been used to convert them into <quote>top
66609 level</quote> addresses).
66610 </para>
66611 </section>
66612 <section id="SECTextspeinf">
66613 <title>Extracting specific information from the log (exigrep)</title>
66614 <para>
66615 <indexterm role="concept">
66616 <primary><emphasis>exigrep</emphasis></primary>
66617 </indexterm>
66618 <indexterm role="concept">
66619 <primary>log</primary>
66620 <secondary>extracts; grepping for</secondary>
66621 </indexterm>
66622 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
66623 files for entries that match a given pattern. When it finds a match, it
66624 extracts all the log entries for the relevant message, not just those that
66625 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
66626 given message, or all mail for a given user, or for a given host, for example.
66627 The input files can be in Exim log format or syslog format.
66628 If a matching log line is not associated with a specific message, it is
66629 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
66630 </para>
66631 <literallayout>
66632 <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>
66633 </literallayout>
66634 <para>
66635 If no log file names are given on the command line, the standard input is read.
66636 </para>
66637 <para>
66638 The <option>-t</option> argument specifies a number of seconds. It adds an additional
66639 condition for message selection. Messages that are complete are shown only if
66640 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
66641 </para>
66642 <para>
66643 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
66644 makes it case-sensitive. This may give a performance improvement when searching
66645 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
66646 option; with <option>-I</option> they do not. In both cases it is possible to change the
66647 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
66648 </para>
66649 <para>
66650 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
66651 pattern as standing for themselves. Otherwise the pattern must be a Perl
66652 regular expression.
66653 </para>
66654 <para>
66655 The <option>-v</option> option inverts the matching condition. That is, a line is selected
66656 if it does <emphasis>not</emphasis> match the pattern.
66657 </para>
66658 <para>
66659 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
66660 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
66661 normally.
66662 </para>
66663 <para>
66664 Example of <option>-M</option>:
66665 user_a sends a message to user_b, which generates a bounce back to user_b. If
66666 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
66667 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
66668 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
66669 when searching for <quote>user_a</quote> will show both messages since the bounce is
66670 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
66671 search term.
66672 </para>
66673 <para>
66674 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
66675 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
66676 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
66677 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
66678 autodetection of some well known compression extensions.
66679 </para>
66680 </section>
66681 <section id="SECTexipick">
66682 <title>Selecting messages by various criteria (exipick)</title>
66683 <para>
66684 <indexterm role="concept">
66685 <primary><emphasis>exipick</emphasis></primary>
66686 </indexterm>
66687 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
66688 lists messages from the queue according to a variety of criteria. For details
66689 of <emphasis>exipick</emphasis>&#x2019;s facilities, visit the web page at
66690 <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
66691 the <option>--help</option> option.
66692 </para>
66693 </section>
66694 <section id="SECTcyclogfil">
66695 <title>Cycling log files (exicyclog)</title>
66696 <para>
66697 <indexterm role="concept">
66698 <primary>log</primary>
66699 <secondary>cycling local files</secondary>
66700 </indexterm>
66701 <indexterm role="concept">
66702 <primary>cycling logs</primary>
66703 </indexterm>
66704 <indexterm role="concept">
66705 <primary><emphasis>exicyclog</emphasis></primary>
66706 </indexterm>
66707 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
66708 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
66709 you are using log files with datestamps in their names (see section
66710 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
66711 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
66712 There are two command line options for <emphasis>exicyclog</emphasis>:
66713 </para>
66714 <itemizedlist>
66715 <listitem>
66716 <para>
66717 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
66718 default that is set when Exim is built. The default default is 10.
66719 </para>
66720 </listitem>
66721 <listitem>
66722 <para>
66723 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
66724 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
66725 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
66726 configuration.
66727 </para>
66728 </listitem>
66729 </itemizedlist>
66730 <para>
66731 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
66732 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
66733 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
66734 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
66735 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
66736 logs are handled similarly.
66737 </para>
66738 <para>
66739 If the limit is greater than 99, the script uses 3-digit numbers such as
66740 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
66741 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
66742 any existing log files.
66743 </para>
66744 <para>
66745 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
66746 the end are deleted. All files with numbers greater than 01 are compressed,
66747 using a compression command which is configured by the COMPRESS_COMMAND
66748 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
66749 root <option>crontab</option> entry of the form
66750 </para>
66751 <literallayout class="monospaced">
66752 1 0 * * * su exim -c /usr/exim/bin/exicyclog
66753 </literallayout>
66754 <para>
66755 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
66756 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
66757 </para>
66758 </section>
66759 <section id="SECTmailstat">
66760 <title>Mail statistics (eximstats)</title>
66761 <para>
66762 <indexterm role="concept">
66763 <primary>statistics</primary>
66764 </indexterm>
66765 <indexterm role="concept">
66766 <primary><emphasis>eximstats</emphasis></primary>
66767 </indexterm>
66768 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
66769 information from log files. The output is either plain text, or HTML.
66770 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
66771 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
66772 </para>
66773 <para>
66774 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
66775 latest version is the result of some extensive revision by Steve Campbell. A
66776 lot of information is given by default, but there are options for suppressing
66777 various parts of it. Following any options, the arguments to the script are a
66778 list of files, which should be main log files. For example:
66779 </para>
66780 <literallayout class="monospaced">
66781 eximstats -nr /var/spool/exim/log/mainlog.01
66782 </literallayout>
66783 <para>
66784 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
66785 messages received from or delivered to various hosts. The information is sorted
66786 both by message count and by volume, and the top fifty hosts in each category
66787 are listed on the standard output. Similar information, based on email
66788 addresses or domains instead of hosts can be requested by means of various
66789 options. For messages delivered and received locally, similar statistics are
66790 also produced per user.
66791 </para>
66792 <para>
66793 The output also includes total counts and statistics about delivery errors, and
66794 histograms showing the number of messages received and deliveries made in each
66795 hour of the day. A delivery with more than one address in its envelope (for
66796 example, an SMTP transaction with more than one RCPT command) is counted
66797 as a single delivery by <emphasis>eximstats</emphasis>.
66798 </para>
66799 <para>
66800 Though normally more deliveries than receipts are reported (as messages may
66801 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
66802 messages received than delivered, even though the queue is empty at the start
66803 and end of the period in question. If an incoming message contains no valid
66804 recipients, no deliveries are recorded for it. A bounce message is handled as
66805 an entirely separate message.
66806 </para>
66807 <para>
66808 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
66809 of messages received and deliveries made, and the number of hosts involved in
66810 each case. It also outputs the number of messages that were delayed (that is,
66811 not completely delivered at the first attempt), and the number that had at
66812 least one address that failed.
66813 </para>
66814 <para>
66815 The remainder of the output is in sections that can be independently disabled
66816 or modified by various options. It consists of a summary of deliveries by
66817 transport, histograms of messages received and delivered per time interval
66818 (default per hour), information about the time messages spent on the queue,
66819 a list of relayed messages, lists of the top fifty sending hosts, local
66820 senders, destination hosts, and destination local users by count and by volume,
66821 and a list of delivery errors that occurred.
66822 </para>
66823 <para>
66824 The relay information lists messages that were actually relayed, that is, they
66825 came from a remote host and were directly delivered to some other remote host,
66826 without being processed (for example, for aliasing or forwarding) locally.
66827 </para>
66828 <para>
66829 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
66830 outputs. These are documented in the Perl script itself, and can be extracted
66831 by running the command <command>perldoc</command> on the script. For example:
66832 </para>
66833 <literallayout class="monospaced">
66834 perldoc /usr/exim/bin/eximstats
66835 </literallayout>
66836 </section>
66837 <section id="SECTcheckaccess">
66838 <title>Checking access policy (exim_checkaccess)</title>
66839 <para>
66840 <indexterm role="concept">
66841 <primary><emphasis>exim_checkaccess</emphasis></primary>
66842 </indexterm>
66843 <indexterm role="concept">
66844 <primary>policy control</primary>
66845 <secondary>checking access</secondary>
66846 </indexterm>
66847 <indexterm role="concept">
66848 <primary>checking access</primary>
66849 </indexterm>
66850 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
66851 debugging output, in order to check what Exim is doing when it is applying
66852 policy controls to incoming SMTP mail. However, not everybody is sufficiently
66853 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
66854 sometimes you just want to answer the question <quote>Does this address have
66855 access?</quote> without bothering with any further details.
66856 </para>
66857 <para>
66858 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
66859 two arguments, an IP address and an email address:
66860 </para>
66861 <literallayout class="monospaced">
66862 exim_checkaccess 10.9.8.7 A.User@a.domain.example
66863 </literallayout>
66864 <para>
66865 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
66866 given email address would be accepted in a RCPT command in a TCP/IP
66867 connection from the host with the given IP address. The output of the utility
66868 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
66869 </para>
66870 <literallayout class="monospaced">
66871 Rejected:
66872 550 Relay not permitted
66873 </literallayout>
66874 <para>
66875 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
66876 for the MAIL command, but you can change this by providing additional
66877 options. These are passed directly to the Exim command. For example, to specify
66878 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
66879 you can use:
66880 </para>
66881 <literallayout class="monospaced">
66882 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
66883                  -f himself@there.example
66884 </literallayout>
66885 <para>
66886 Note that these additional Exim command line items must be given after the two
66887 mandatory arguments.
66888 </para>
66889 <para>
66890 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
66891 while running its checks. You can run checks that include callouts by using
66892 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
66893 </para>
66894 </section>
66895 <section id="SECTdbmbuild">
66896 <title>Making DBM files (exim_dbmbuild)</title>
66897 <para>
66898 <indexterm role="concept">
66899 <primary>DBM</primary>
66900 <secondary>building dbm files</secondary>
66901 </indexterm>
66902 <indexterm role="concept">
66903 <primary>building DBM files</primary>
66904 </indexterm>
66905 <indexterm role="concept">
66906 <primary><emphasis>exim_dbmbuild</emphasis></primary>
66907 </indexterm>
66908 <indexterm role="concept">
66909 <primary>lower casing</primary>
66910 </indexterm>
66911 <indexterm role="concept">
66912 <primary>binary zero</primary>
66913 <secondary>in lookup key</secondary>
66914 </indexterm>
66915 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
66916 the format used by the <command>lsearch</command> lookup (see section
66917 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
66918 names as keys and the remainder of the information as data. The lower-casing
66919 can be prevented by calling the program with the <option>-nolc</option> option.
66920 </para>
66921 <para>
66922 A terminating zero is included as part of the key string. This is expected by
66923 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
66924 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
66925 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
66926 files.
66927 </para>
66928 <para>
66929 The program requires two arguments: the name of the input file (which can be a
66930 single hyphen to indicate the standard input), and the name of the output file.
66931 It creates the output under a temporary name, and then renames it if all went
66932 well.
66933 </para>
66934 <para>
66935 <indexterm role="concept">
66936 <primary>USE_DB</primary>
66937 </indexterm>
66938 If the native DB interface is in use (USE_DB is set in a compile-time
66939 configuration file &ndash; this is common in free versions of Unix) the two file
66940 names must be different, because in this mode the Berkeley DB functions create
66941 a single output file using exactly the name given. For example,
66942 </para>
66943 <literallayout class="monospaced">
66944 exim_dbmbuild /etc/aliases /etc/aliases.db
66945 </literallayout>
66946 <para>
66947 reads the system alias file and creates a DBM version of it in
66948 <filename>/etc/aliases.db</filename>.
66949 </para>
66950 <para>
66951 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
66952 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
66953 environment, the suffixes are added to the second argument of
66954 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
66955 when the Berkeley functions are used in compatibility mode (though this is not
66956 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
66957 </para>
66958 <para>
66959 If a duplicate key is encountered, the program outputs a warning, and when it
66960 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
66961 option is used. By default, only the first of a set of duplicates is used &ndash;
66962 this makes it compatible with <command>lsearch</command> lookups. There is an option
66963 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
66964 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
66965 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
66966 return code is 2.
66967 </para>
66968 </section>
66969 <section id="SECTfinindret">
66970 <title>Finding individual retry times (exinext)</title>
66971 <para>
66972 <indexterm role="concept">
66973 <primary>retry</primary>
66974 <secondary>times</secondary>
66975 </indexterm>
66976 <indexterm role="concept">
66977 <primary><emphasis>exinext</emphasis></primary>
66978 </indexterm>
66979 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
66980 fish specific information out of the retry database. Given a mail domain (or a
66981 complete address), it looks up the hosts for that domain, and outputs any retry
66982 information for the hosts or for the domain. At present, the retry information
66983 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
66984 output. For example:
66985 </para>
66986 <literallayout class="monospaced">
66987 $ exinext piglet@milne.fict.example
66988 kanga.milne.example:192.168.8.1 error 146: Connection refused
66989   first failed: 21-Feb-1996 14:57:34
66990   last tried:   21-Feb-1996 14:57:34
66991   next try at:  21-Feb-1996 15:02:34
66992 roo.milne.example:192.168.8.3 error 146: Connection refused
66993   first failed: 20-Jan-1996 13:12:08
66994   last tried:   21-Feb-1996 11:42:03
66995   next try at:  21-Feb-1996 19:42:03
66996   past final cutoff time
66997 </literallayout>
66998 <para>
66999 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
67000 will give any retry information for that local part in your default domain.
67001 A message id can be used to obtain retry information pertaining to a specific
67002 message. This exists only when an attempt to deliver a message to a remote host
67003 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
67004 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
67005 run very often.
67006 </para>
67007 <para>
67008 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
67009 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
67010 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
67011 configuration file, and the second sets macros for use within the configuration
67012 file. These features are mainly to help in testing, but might also be useful in
67013 environments where more than one configuration file is in use.
67014 </para>
67015 </section>
67016 <section id="SECThindatmai">
67017 <title>Hints database maintenance</title>
67018 <para>
67019 <indexterm role="concept">
67020 <primary>hints database</primary>
67021 <secondary>maintenance</secondary>
67022 </indexterm>
67023 <indexterm role="concept">
67024 <primary>maintaining Exim&#x2019;s hints database</primary>
67025 </indexterm>
67026 Three utility programs are provided for maintaining the DBM files that Exim
67027 uses to contain its delivery hint information. Each program requires two
67028 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
67029 second is the name of the database it is to operate on. These are as follows:
67030 </para>
67031 <itemizedlist>
67032 <listitem>
67033 <para>
67034 <emphasis>retry</emphasis>: the database of retry information
67035 </para>
67036 </listitem>
67037 <listitem>
67038 <para>
67039 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
67040 for remote hosts
67041 </para>
67042 </listitem>
67043 <listitem>
67044 <para>
67045 <emphasis>callout</emphasis>: the callout cache
67046 </para>
67047 </listitem>
67048 <listitem>
67049 <para>
67050 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
67051 </para>
67052 </listitem>
67053 <listitem>
67054 <para>
67055 <emphasis>misc</emphasis>: other hints data
67056 </para>
67057 </listitem>
67058 </itemizedlist>
67059 <para>
67060 The <emphasis>misc</emphasis> database is used for
67061 </para>
67062 <itemizedlist>
67063 <listitem>
67064 <para>
67065 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
67066 </para>
67067 </listitem>
67068 <listitem>
67069 <para>
67070 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
67071 <command>smtp</command> transport)
67072 </para>
67073 </listitem>
67074 <listitem>
67075 <para>
67076 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
67077 in a transport)
67078 </para>
67079 </listitem>
67080 </itemizedlist>
67081 </section>
67082 <section id="SECID261">
67083 <title>exim_dumpdb</title>
67084 <para>
67085 <indexterm role="concept">
67086 <primary><emphasis>exim_dumpdb</emphasis></primary>
67087 </indexterm>
67088 The entire contents of a database are written to the standard output by the
67089 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
67090 spool and database names. For example, to dump the retry database:
67091 </para>
67092 <literallayout class="monospaced">
67093 exim_dumpdb /var/spool/exim retry
67094 </literallayout>
67095 <para>
67096 Two lines of output are produced for each entry:
67097 </para>
67098 <literallayout class="monospaced">
67099 T:mail.ref.example:192.168.242.242 146 77 Connection refused
67100 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
67101 </literallayout>
67102 <para>
67103 The first item on the first line is the key of the record. It starts with one
67104 of the letters R, or T, depending on whether it refers to a routing or
67105 transport retry. For a local delivery, the next part is the local address; for
67106 a remote delivery it is the name of the remote host, followed by its failing IP
67107 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
67108 transport). If the remote port is not the standard one (port 25), it is added
67109 to the IP address. Then there follows an error code, an additional error code,
67110 and a textual description of the error.
67111 </para>
67112 <para>
67113 The three times on the second line are the time of first failure, the time of
67114 the last delivery attempt, and the computed time for the next attempt. The line
67115 ends with an asterisk if the cutoff time for the last retry rule has been
67116 exceeded.
67117 </para>
67118 <para>
67119 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
67120 consists of a host name followed by a list of ids for messages that are or were
67121 waiting to be delivered to that host. If there are a very large number for any
67122 one host, continuation records, with a sequence number added to the host name,
67123 may be seen. The data in these records is often out of date, because a message
67124 may be routed to several alternative hosts, and Exim makes no effort to keep
67125 cross-references.
67126 </para>
67127 </section>
67128 <section id="SECID262">
67129 <title>exim_tidydb</title>
67130 <para>
67131 <indexterm role="concept">
67132 <primary><emphasis>exim_tidydb</emphasis></primary>
67133 </indexterm>
67134 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
67135 database. If run with no options, it removes all records that are more than 30
67136 days old. The age is calculated from the date and time that the record was last
67137 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
67138 since the first delivery failure. Information about a host that has been down
67139 for more than 30 days will remain in the database, provided that the record is
67140 updated sufficiently often.
67141 </para>
67142 <para>
67143 The cutoff date can be altered by means of the <option>-t</option> option, which must be
67144 followed by a time. For example, to remove all records older than a week from
67145 the retry database:
67146 </para>
67147 <literallayout class="monospaced">
67148 exim_tidydb -t 7d /var/spool/exim retry
67149 </literallayout>
67150 <para>
67151 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
67152 message ids. In the former these appear as data in records keyed by host &ndash;
67153 they were messages that were waiting for that host &ndash; and in the latter they
67154 are the keys for retry information for messages that have suffered certain
67155 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
67156 message ids in database records are those of messages that are still on the
67157 queue. Message ids for messages that no longer exist are removed from
67158 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
67159 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
67160 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
67161 whenever it removes information from the database.
67162 </para>
67163 <para>
67164 Certain records are automatically removed by Exim when they are no longer
67165 needed, but others are not. For example, if all the MX hosts for a domain are
67166 down, a retry record is created for each one. If the primary MX host comes back
67167 first, its record is removed when Exim successfully delivers to it, but the
67168 records for the others remain because Exim has not tried to use those hosts.
67169 </para>
67170 <para>
67171 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
67172 hints databases. You should do this at a quiet time of day, because it requires
67173 a database to be locked (and therefore inaccessible to Exim) while it does its
67174 work. Removing records from a DBM file does not normally make the file smaller,
67175 but all the common DBM libraries are able to re-use the space that is released.
67176 After an initial phase of increasing in size, the databases normally reach a
67177 point at which they no longer get any bigger, as long as they are regularly
67178 tidied.
67179 </para>
67180 <para>
67181 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
67182 databases is likely to keep on increasing.
67183 </para>
67184 </section>
67185 <section id="SECID263">
67186 <title>exim_fixdb</title>
67187 <para>
67188 <indexterm role="concept">
67189 <primary><emphasis>exim_fixdb</emphasis></primary>
67190 </indexterm>
67191 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
67192 Its main use is for testing Exim, but it might also be occasionally useful for
67193 getting round problems in a live system. It has no options, and its interface
67194 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
67195 key of a database record can then be entered, and the data for that record is
67196 displayed.
67197 </para>
67198 <para>
67199 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
67200 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
67201 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
67202 data for individual fields can be changed by typing the field number followed
67203 by new data, for example:
67204 </para>
67205 <literallayout class="monospaced">
67206 &gt; 4 951102:1000
67207 </literallayout>
67208 <para>
67209 resets the time of the next delivery attempt. Time values are given as a
67210 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
67211 used as optional separators.
67212 </para>
67213 </section>
67214 <section id="SECTmailboxmaint">
67215 <title>Mailbox maintenance (exim_lock)</title>
67216 <para>
67217 <indexterm role="concept">
67218 <primary>mailbox</primary>
67219 <secondary>maintenance</secondary>
67220 </indexterm>
67221 <indexterm role="concept">
67222 <primary><emphasis>exim_lock</emphasis></primary>
67223 </indexterm>
67224 <indexterm role="concept">
67225 <primary>locking mailboxes</primary>
67226 </indexterm>
67227 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
67228 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
67229 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
67230 a user agent while investigating a problem. The utility requires the name of
67231 the file as its first argument. If the locking is successful, the second
67232 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
67233 second argument, the value of the SHELL environment variable is used; if this
67234 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
67235 is unlocked and the utility ends. The following options are available:
67236 </para>
67237 <variablelist>
67238 <varlistentry>
67239 <term><option>-fcntl</option></term>
67240 <listitem>
67241 <para>
67242 Use <function>fcntl()</function> locking on the open mailbox.
67243 </para>
67244 </listitem></varlistentry>
67245 <varlistentry>
67246 <term><option>-flock</option></term>
67247 <listitem>
67248 <para>
67249 Use <function>flock()</function> locking on the open mailbox, provided the operating system
67250 supports it.
67251 </para>
67252 </listitem></varlistentry>
67253 <varlistentry>
67254 <term><option>-interval</option></term>
67255 <listitem>
67256 <para>
67257 This must be followed by a number, which is a number of seconds; it sets the
67258 interval to sleep between retries (default 3).
67259 </para>
67260 </listitem></varlistentry>
67261 <varlistentry>
67262 <term><option>-lockfile</option></term>
67263 <listitem>
67264 <para>
67265 Create a lock file before opening the mailbox.
67266 </para>
67267 </listitem></varlistentry>
67268 <varlistentry>
67269 <term><option>-mbx</option></term>
67270 <listitem>
67271 <para>
67272 Lock the mailbox using MBX rules.
67273 </para>
67274 </listitem></varlistentry>
67275 <varlistentry>
67276 <term><option>-q</option></term>
67277 <listitem>
67278 <para>
67279 Suppress verification output.
67280 </para>
67281 </listitem></varlistentry>
67282 <varlistentry>
67283 <term><option>-retries</option></term>
67284 <listitem>
67285 <para>
67286 This must be followed by a number; it sets the number of times to try to get
67287 the lock (default 10).
67288 </para>
67289 </listitem></varlistentry>
67290 <varlistentry>
67291 <term><option>-restore_time</option></term>
67292 <listitem>
67293 <para>
67294 This option causes <option>exim_lock</option> to restore the modified and read times to the
67295 locked file before exiting. This allows you to access a locked mailbox (for
67296 example, to take a backup copy) without disturbing the times that the user
67297 subsequently sees.
67298 </para>
67299 </listitem></varlistentry>
67300 <varlistentry>
67301 <term><option>-timeout</option></term>
67302 <listitem>
67303 <para>
67304 This must be followed by a number, which is a number of seconds; it sets a
67305 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
67306 default), a non-blocking call is used.
67307 </para>
67308 </listitem></varlistentry>
67309 <varlistentry>
67310 <term><option>-v</option></term>
67311 <listitem>
67312 <para>
67313 Generate verbose output.
67314 </para>
67315 </listitem></varlistentry>
67316 </variablelist>
67317 <para>
67318 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
67319 default is to create a lock file and also to use <function>fcntl()</function> locking on the
67320 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
67321 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
67322 requires that the directory containing the file be writeable. Locking by lock
67323 file does not last for ever; Exim assumes that a lock file is expired if it is
67324 more than 30 minutes old.
67325 </para>
67326 <para>
67327 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
67328 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
67329 to be taken out on the open mailbox, and an exclusive lock on the file
67330 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
67331 number of the mailbox file. When the locking is released, if an exclusive lock
67332 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
67333 </para>
67334 <para>
67335 The default output contains verification of the locking that takes place. The
67336 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
67337 suppresses all output except error messages.
67338 </para>
67339 <para>
67340 A command such as
67341 </para>
67342 <literallayout class="monospaced">
67343 exim_lock /var/spool/mail/spqr
67344 </literallayout>
67345 <para>
67346 runs an interactive shell while the file is locked, whereas
67347 </para>
67348 <literallayout>
67349 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
67350 &lt;<emphasis>some commands</emphasis>&gt;
67351 <literal>End</literal>
67352 </literallayout>
67353 <para>
67354 runs a specific non-interactive sequence of commands while the file is locked,
67355 suppressing all verification output. A single command can be run by a command
67356 such as
67357 </para>
67358 <literallayout class="monospaced">
67359 exim_lock -q /var/spool/mail/spqr \
67360   "cp /var/spool/mail/spqr /some/where"
67361 </literallayout>
67362 <para>
67363 Note that if a command is supplied, it must be entirely contained within the
67364 second argument &ndash; hence the quotes.
67365 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
67366 </para>
67367 </section>
67368 </chapter>
67369
67370 <chapter id="CHAPeximon">
67371 <title>The Exim monitor</title>
67372 <para>
67373 <indexterm role="concept" id="IIDeximon" class="startofrange">
67374 <primary>Exim monitor</primary>
67375 <secondary>description</secondary>
67376 </indexterm>
67377 <indexterm role="concept">
67378 <primary>X-windows</primary>
67379 </indexterm>
67380 <indexterm role="concept">
67381 <primary><emphasis>eximon</emphasis></primary>
67382 </indexterm>
67383 <indexterm role="concept">
67384 <primary>Local/eximon.conf</primary>
67385 </indexterm>
67386 <indexterm role="concept">
67387 <primary><filename>exim_monitor/EDITME</filename></primary>
67388 </indexterm>
67389 The Exim monitor is an application which displays in an X window information
67390 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
67391 perform certain operations on messages from this GUI interface; however all
67392 such facilities are also available from the command line, and indeed, the
67393 monitor itself makes use of the command line to perform any actions requested.
67394 </para>
67395 <section id="SECID264">
67396 <title>Running the monitor</title>
67397 <para>
67398 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
67399 script that sets up a number of environment variables, and then runs the
67400 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
67401 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
67402 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
67403 parameters are for.
67404 </para>
67405 <para>
67406 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
67407 a particular invocation by setting up environment variables of the same names,
67408 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
67409 </para>
67410 <literallayout class="monospaced">
67411 EXIMON_LOG_DEPTH=400 eximon
67412 </literallayout>
67413 <para>
67414 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
67415 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
67416 overrides the Exim log file configuration. This makes it possible to have
67417 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
67418 syslog messages are routed to a file on the local host.
67419 </para>
67420 <para>
67421 X resources can be used to change the appearance of the window in the normal
67422 way. For example, a resource setting of the form
67423 </para>
67424 <literallayout class="monospaced">
67425 Eximon*background: gray94
67426 </literallayout>
67427 <para>
67428 changes the colour of the background to light grey rather than white. The
67429 stripcharts are drawn with both the data lines and the reference lines in
67430 black. This means that the reference lines are not visible when on top of the
67431 data. However, their colour can be changed by setting a resource called
67432 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
67433 For example, if your X server is running Unix, you could set up lighter
67434 reference lines in the stripcharts by obeying
67435 </para>
67436 <literallayout class="monospaced">
67437 xrdb -merge &lt;&lt;End
67438 Eximon*highlight: gray
67439 End
67440 </literallayout>
67441 <para>
67442 <indexterm role="concept">
67443 <primary>admin user</primary>
67444 </indexterm>
67445 In order to see the contents of messages on the queue, and to operate on them,
67446 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
67447 </para>
67448 <para>
67449 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
67450 contain X11 resource parameters interpreted by the X11 library.  In addition,
67451 if the first parameter starts with the string "gdb" then it is removed and the
67452 binary is invoked under gdb (the parameter is used as the gdb command-name, so
67453 versioned variants of gdb can be invoked).
67454 </para>
67455 <para>
67456 The monitor&#x2019;s window is divided into three parts. The first contains one or
67457 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
67458 main log file, and the third is a display of the queue of messages awaiting
67459 delivery, with two more action buttons. The following sections describe these
67460 different parts of the display.
67461 </para>
67462 </section>
67463 <section id="SECID265">
67464 <title>The stripcharts</title>
67465 <para>
67466 <indexterm role="concept">
67467 <primary>stripchart</primary>
67468 </indexterm>
67469 The first stripchart is always a count of messages on the queue. Its name can
67470 be configured by setting QUEUE_STRIPCHART_NAME in the
67471 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
67472 configuration script by regular expression matches on log file entries, making
67473 it possible to display, for example, counts of messages delivered to certain
67474 hosts or using certain transports. The supplied defaults display counts of
67475 received and delivered messages, and of local and SMTP deliveries. The default
67476 period between stripchart updates is one minute; this can be adjusted by a
67477 parameter in the <filename>Local/eximon.conf</filename> file.
67478 </para>
67479 <para>
67480 The stripchart displays rescale themselves automatically as the value they are
67481 displaying changes. There are always 10 horizontal lines in each chart; the
67482 title string indicates the value of each division when it is greater than one.
67483 For example, <quote>x2</quote> means that each division represents a value of 2.
67484 </para>
67485 <para>
67486 It is also possible to have a stripchart which shows the percentage fullness of
67487 a particular disk partition, which is useful when local deliveries are confined
67488 to a single partition.
67489 </para>
67490 <para>
67491 <indexterm role="concept">
67492 <primary><option>statvfs</option> function</primary>
67493 </indexterm>
67494 This relies on the availability of the <function>statvfs()</function> function or equivalent in
67495 the operating system. Most, but not all versions of Unix that support Exim have
67496 this. For this particular stripchart, the top of the chart always represents
67497 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
67498 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
67499 <filename>Local/eximon.conf</filename> file.
67500 </para>
67501 </section>
67502 <section id="SECID266">
67503 <title>Main action buttons</title>
67504 <para>
67505 <indexterm role="concept">
67506 <primary>size</primary>
67507 <secondary>of monitor window</secondary>
67508 </indexterm>
67509 <indexterm role="concept">
67510 <primary>Exim monitor</primary>
67511 <secondary>window size</secondary>
67512 </indexterm>
67513 <indexterm role="concept">
67514 <primary>window size</primary>
67515 </indexterm>
67516 Below the stripcharts there is an action button for quitting the monitor. Next
67517 to this is another button marked <quote>Size</quote>. They are placed here so that
67518 shrinking the window to its default minimum size leaves just the queue count
67519 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
67520 the window to expand to its maximum size, unless it is already at the maximum,
67521 in which case it is reduced to its minimum.
67522 </para>
67523 <para>
67524 When expanding to the maximum, if the window cannot be fully seen where it
67525 currently is, it is moved back to where it was the last time it was at full
67526 size. When it is expanding from its minimum size, the old position is
67527 remembered, and next time it is reduced to the minimum it is moved back there.
67528 </para>
67529 <para>
67530 The idea is that you can keep a reduced window just showing one or two
67531 stripcharts at a convenient place on your screen, easily expand it to show
67532 the full window when required, and just as easily put it back to what it was.
67533 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
67534 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
67535 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
67536 </para>
67537 <para>
67538 Normally, the monitor starts up with the window at its full size, but it can be
67539 built so that it starts up with the window at its smallest size, by setting
67540 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
67541 </para>
67542 </section>
67543 <section id="SECID267">
67544 <title>The log display</title>
67545 <para>
67546 <indexterm role="concept">
67547 <primary>log</primary>
67548 <secondary>tail of; in monitor</secondary>
67549 </indexterm>
67550 The second section of the window is an area in which a display of the tail of
67551 the main log is maintained.
67552 To save space on the screen, the timestamp on each log line is shortened by
67553 removing the date and, if <option>log_timezone</option> is set, the timezone.
67554 The log tail is not available when the only destination for logging data is
67555 syslog, unless the syslog lines are routed to a local file whose name is passed
67556 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
67557 </para>
67558 <para>
67559 The log sub-window has a scroll bar at its lefthand side which can be used to
67560 move back to look at earlier text, and the up and down arrow keys also have a
67561 scrolling effect. The amount of log that is kept depends on the setting of
67562 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
67563 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
67564 much more efficient than throwing it away line by line. The sub-window also has
67565 a horizontal scroll bar for accessing the ends of long log lines. This is the
67566 only means of horizontal scrolling; the right and left arrow keys are not
67567 available. Text can be cut from this part of the window using the mouse in the
67568 normal way. The size of this subwindow is controlled by parameters in the
67569 configuration file <filename>Local/eximon.conf</filename>.
67570 </para>
67571 <para>
67572 Searches of the text in the log window can be carried out by means of the ^R
67573 and ^S keystrokes, which default to a reverse and a forward search,
67574 respectively. The search covers only the text that is displayed in the window.
67575 It cannot go further back up the log.
67576 </para>
67577 <para>
67578 The point from which the search starts is indicated by a caret marker. This is
67579 normally at the end of the text in the window, but can be positioned explicitly
67580 by pointing and clicking with the left mouse button, and is moved automatically
67581 by a successful search. If new text arrives in the window when it is scrolled
67582 back, the caret remains where it is, but if the window is not scrolled back,
67583 the caret is moved to the end of the new text.
67584 </para>
67585 <para>
67586 Pressing ^R or ^S pops up a window into which the search text can be typed.
67587 There are buttons for selecting forward or reverse searching, for carrying out
67588 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
67589 happens and the window remains so that further searches can be done. If the
67590 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
67591 ^C is typed the search is cancelled.
67592 </para>
67593 <para>
67594 The searching facility is implemented using the facilities of the Athena text
67595 widget. By default this pops up a window containing both <quote>search</quote> and
67596 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
67597 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
67598 However, the linkers in BSDI and HP-UX seem unable to handle an externally
67599 provided version of <option>TextPop</option> when the remaining parts of the text widget
67600 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
67601 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
67602 on these systems, at the expense of having unwanted items in the search popup
67603 window.
67604 </para>
67605 </section>
67606 <section id="SECID268">
67607 <title>The queue display</title>
67608 <para>
67609 <indexterm role="concept">
67610 <primary>queue</primary>
67611 <secondary>display in monitor</secondary>
67612 </indexterm>
67613 The bottom section of the monitor window contains a list of all messages that
67614 are on the queue, which includes those currently being received or delivered,
67615 as well as those awaiting delivery. The size of this subwindow is controlled by
67616 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
67617 at which it is updated is controlled by another parameter in the same file &ndash;
67618 the default is 5 minutes, since queue scans can be quite expensive. However,
67619 there is an <quote>Update</quote> action button just above the display which can be used
67620 to force an update of the queue display at any time.
67621 </para>
67622 <para>
67623 When a host is down for some time, a lot of pending mail can build up for it,
67624 and this can make it hard to deal with other messages on the queue. To help
67625 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
67626 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
67627 type anything in here and press <quote>Return</quote>, the text is added to a chain of
67628 such texts, and if every undelivered address in a message matches at least one
67629 of the texts, the message is not displayed.
67630 </para>
67631 <para>
67632 If there is an address that does not match any of the texts, all the addresses
67633 are displayed as normal. The matching happens on the ends of addresses so, for
67634 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
67635 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
67636 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
67637 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
67638 a hide request is automatically cancelled after one hour.
67639 </para>
67640 <para>
67641 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
67642 else to the monitor window. For this reason, if you want to cut text from the
67643 queue display to use in the dialogue box, you have to do the cutting before
67644 pressing the <quote>Hide</quote> button.
67645 </para>
67646 <para>
67647 The queue display contains, for each unhidden queued message, the length of
67648 time it has been on the queue, the size of the message, the message id, the
67649 message sender, and the first undelivered recipient, all on one line. If it is
67650 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
67651 recipient to which the message has not yet been delivered, subsequent ones are
67652 listed on additional lines, up to a maximum configured number, following which
67653 an ellipsis is displayed. Recipients that have already received the message are
67654 not shown.
67655 </para>
67656 <para>
67657 <indexterm role="concept">
67658 <primary>frozen messages</primary>
67659 <secondary>display</secondary>
67660 </indexterm>
67661 If a message is frozen, an asterisk is displayed at the left-hand side.
67662 </para>
67663 <para>
67664 The queue display has a vertical scroll bar, and can also be scrolled by means
67665 of the arrow keys. Text can be cut from it using the mouse in the normal way.
67666 The text searching facilities, as described above for the log window, are also
67667 available, but the caret is always moved to the end of the text when the queue
67668 display is updated.
67669 </para>
67670 </section>
67671 <section id="SECID269">
67672 <title>The queue menu</title>
67673 <para>
67674 <indexterm role="concept">
67675 <primary>queue</primary>
67676 <secondary>menu in monitor</secondary>
67677 </indexterm>
67678 If the <option>shift</option> key is held down and the left button is clicked when the mouse
67679 pointer is over the text for any message, an action menu pops up, and the first
67680 line of the queue display for the message is highlighted. This does not affect
67681 any selected text.
67682 </para>
67683 <para>
67684 If you want to use some other event for popping up the menu, you can set the
67685 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
67686 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
67687 value set in this parameter is a standard X event description. For example, to
67688 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
67689 </para>
67690 <literallayout class="monospaced">
67691 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
67692 </literallayout>
67693 <para>
67694 The title of the menu is the message id, and it contains entries which act as
67695 follows:
67696 </para>
67697 <itemizedlist>
67698 <listitem>
67699 <para>
67700 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
67701 in a new text window.
67702 </para>
67703 </listitem>
67704 <listitem>
67705 <para>
67706 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
67707 information and headers is displayed in a new text window. See chapter
67708 <xref linkend="CHAPspool"/> for a description of the format of spool files.
67709 </para>
67710 </listitem>
67711 <listitem>
67712 <para>
67713 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
67714 displayed in a new text window. There is a default limit of 20,000 bytes to the
67715 amount of data displayed. This can be changed by setting the BODY_MAX
67716 option at compile time, or the EXIMON_BODY_MAX option at run time.
67717 </para>
67718 </listitem>
67719 <listitem>
67720 <para>
67721 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
67722 delivery of the message. This causes an automatic thaw if the message is
67723 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
67724 a new text window. The delivery is run in a separate process, to avoid holding
67725 up the monitor while the delivery proceeds.
67726 </para>
67727 </listitem>
67728 <listitem>
67729 <para>
67730 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
67731 that the message be frozen.
67732 </para>
67733 </listitem>
67734 <listitem>
67735 <para>
67736 <indexterm role="concept">
67737 <primary>thawing messages</primary>
67738 </indexterm>
67739 <indexterm role="concept">
67740 <primary>unfreezing messages</primary>
67741 </indexterm>
67742 <indexterm role="concept">
67743 <primary>frozen messages</primary>
67744 <secondary>thawing</secondary>
67745 </indexterm>
67746 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
67747 that the message be thawed.
67748 </para>
67749 </listitem>
67750 <listitem>
67751 <para>
67752 <indexterm role="concept">
67753 <primary>delivery</primary>
67754 <secondary>forcing failure</secondary>
67755 </indexterm>
67756 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
67757 that Exim gives up trying to deliver the message. A bounce message is generated
67758 for any remaining undelivered addresses.
67759 </para>
67760 </listitem>
67761 <listitem>
67762 <para>
67763 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
67764 that the message be deleted from the system without generating a bounce
67765 message.
67766 </para>
67767 </listitem>
67768 <listitem>
67769 <para>
67770 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
67771 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
67772 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
67773 Otherwise it must be entered as a fully qualified address. Pressing RETURN
67774 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
67775 additional recipient be added to the message, unless the entry box is empty, in
67776 which case no action is taken.
67777 </para>
67778 </listitem>
67779 <listitem>
67780 <para>
67781 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
67782 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
67783 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
67784 Otherwise it must be entered as a fully qualified address. Pressing RETURN
67785 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
67786 recipient address as already delivered, unless the entry box is empty, in which
67787 case no action is taken.
67788 </para>
67789 </listitem>
67790 <listitem>
67791 <para>
67792 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
67793 mark all recipient addresses as already delivered.
67794 </para>
67795 </listitem>
67796 <listitem>
67797 <para>
67798 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
67799 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
67800 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
67801 in which case no action is taken. If you want to set an empty sender (as in
67802 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
67803 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
67804 the address is qualified with that domain.
67805 </para>
67806 </listitem>
67807 </itemizedlist>
67808 <para>
67809 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
67810 other cases when a call to Exim is made, if there is any output from Exim (in
67811 particular, if the command fails) a window containing the command and the
67812 output is displayed. Otherwise, the results of the action are normally apparent
67813 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
67814 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
67815 if no output is generated.
67816 </para>
67817 <para>
67818 The queue display is automatically updated for actions such as freezing and
67819 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
67820 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
67821 force an update of the display after one of these actions.
67822 </para>
67823 <para>
67824 In any text window that is displayed as result of a menu action, the normal
67825 cut-and-paste facility is available, and searching can be carried out using ^R
67826 and ^S, as described above for the log tail window.
67827 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
67828 </para>
67829 </section>
67830 </chapter>
67831
67832 <chapter id="CHAPsecurity">
67833 <title>Security considerations</title>
67834 <para>
67835 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
67836 <primary>security</primary>
67837 <secondary>discussion of</secondary>
67838 </indexterm>
67839 This chapter discusses a number of issues concerned with security, some of
67840 which are also covered in other parts of this manual.
67841 </para>
67842 <para>
67843 For reasons that this author does not understand, some people have promoted
67844 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
67845 existence of this chapter in the documentation. However, the intent of the
67846 chapter is simply to describe the way Exim works in relation to certain
67847 security concerns, not to make any specific claims about the effectiveness of
67848 its security as compared with other MTAs.
67849 </para>
67850 <para>
67851 What follows is a description of the way Exim is supposed to be. Best efforts
67852 have been made to try to ensure that the code agrees with the theory, but an
67853 absence of bugs can never be guaranteed. Any that are reported will get fixed
67854 as soon as possible.
67855 </para>
67856 <section id="SECID286">
67857 <title>Building a more <quote>hardened</quote> Exim</title>
67858 <para>
67859 <indexterm role="concept">
67860 <primary>security</primary>
67861 <secondary>build-time features</secondary>
67862 </indexterm>
67863 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
67864 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
67865 Exim administrator who does not have the root password, or by someone who has
67866 penetrated the Exim (but not the root) account. These options are as follows:
67867 </para>
67868 <itemizedlist>
67869 <listitem>
67870 <para>
67871 ALT_CONFIG_PREFIX can be set to a string that is required to match the
67872 start of any file names used with the <option>-C</option> option. When it is set, these file
67873 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
67874 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
67875 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
67876 default setting for <option>ALT_CONFIG_PREFIX</option>.
67877 </para>
67878 <para>
67879 If the permitted configuration files are confined to a directory to
67880 which only root has access, this guards against someone who has broken
67881 into the Exim account from running a privileged Exim with an arbitrary
67882 configuration file, and using it to break into other accounts.
67883 </para>
67884 </listitem>
67885 <listitem>
67886 <para>
67887 If a non-trusted configuration file (i.e. not the default configuration file
67888 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
67889 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
67890 the next item), then root privilege is retained only if the caller of Exim is
67891 root. This locks out the possibility of testing a configuration using <option>-C</option>
67892 right through message reception and delivery, even if the caller is root. The
67893 reception works, but by that time, Exim is running as the Exim user, so when
67894 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
67895 privilege to be lost. However, root can test reception and delivery using two
67896 separate commands.
67897 </para>
67898 </listitem>
67899 <listitem>
67900 <para>
67901 The WHITELIST_D_MACROS build option declares some macros to be safe to override
67902 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
67903 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
67904 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
67905 the restrictive side.  Requiring build-time selection of safe macros is onerous
67906 but this option is intended solely as a transition mechanism to permit
67907 previously-working configurations to continue to work after release 4.73.
67908 </para>
67909 </listitem>
67910 <listitem>
67911 <para>
67912 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
67913 is disabled.
67914 </para>
67915 </listitem>
67916 <listitem>
67917 <para>
67918 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
67919 never to be used for any deliveries. This is like the <option>never_users</option> runtime
67920 option, but it cannot be overridden; the runtime option adds additional users
67921 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
67922 is permitted to modify the runtime file from using Exim as a way to get root.
67923 </para>
67924 </listitem>
67925 </itemizedlist>
67926 </section>
67927 <section id="SECID270">
67928 <title>Root privilege</title>
67929 <para>
67930 <indexterm role="concept">
67931 <primary>setuid</primary>
67932 </indexterm>
67933 <indexterm role="concept">
67934 <primary>root privilege</primary>
67935 </indexterm>
67936 The Exim binary is normally setuid to root, which means that it gains root
67937 privilege (runs as root) when it starts execution. In some special cases (for
67938 example, when the daemon is not in use and there are no local deliveries), it
67939 may be possible to run Exim setuid to some user other than root. This is
67940 discussed in the next section. However, in most installations, root privilege
67941 is required for two things:
67942 </para>
67943 <itemizedlist>
67944 <listitem>
67945 <para>
67946 To set up a socket connected to the standard SMTP port (25) when initialising
67947 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
67948 not required.
67949 </para>
67950 </listitem>
67951 <listitem>
67952 <para>
67953 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
67954 perform local deliveries as the receiving user or as specified in the
67955 configuration.
67956 </para>
67957 </listitem>
67958 </itemizedlist>
67959 <para>
67960 It is not necessary to be root to do any of the other things Exim does, such as
67961 receiving messages and delivering them externally over SMTP, and it is
67962 obviously more secure if Exim does not run as root except when necessary.
67963 For this reason, a user and group for Exim to use must be defined in
67964 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
67965 group</quote>. Their values can be changed by the run time configuration, though this
67966 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
67967 <emphasis>mail</emphasis> or another user name altogether.
67968 </para>
67969 <para>
67970 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
67971 abdication; the process cannot regain root afterwards. Prior to release 4.00,
67972 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
67973 </para>
67974 <para>
67975 After a new Exim process has interpreted its command line options, it changes
67976 uid and gid in the following cases:
67977 </para>
67978 <itemizedlist>
67979 <listitem>
67980 <para>
67981 <indexterm role="option">
67982 <primary><option>-C</option></primary>
67983 </indexterm>
67984 <indexterm role="option">
67985 <primary><option>-D</option></primary>
67986 </indexterm>
67987 If the <option>-C</option> option is used to specify an alternate configuration file, or if
67988 the <option>-D</option> option is used to define macro values for the configuration, and the
67989 calling process is not running as root, the uid and gid are changed to those of
67990 the calling process.
67991 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
67992 option may not be used at all.
67993 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
67994 can be supplied if the calling process is running as root, the Exim run-time
67995 user or CONFIGURE_OWNER, if defined.
67996 </para>
67997 </listitem>
67998 <listitem>
67999 <para>
68000 <indexterm role="option">
68001 <primary><option>-be</option></primary>
68002 </indexterm>
68003 <indexterm role="option">
68004 <primary><option>-bf</option></primary>
68005 </indexterm>
68006 <indexterm role="option">
68007 <primary><option>-bF</option></primary>
68008 </indexterm>
68009 If the expansion test option (<option>-be</option>) or one of the filter testing options
68010 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
68011 calling process.
68012 </para>
68013 </listitem>
68014 <listitem>
68015 <para>
68016 If the process is not a daemon process or a queue runner process or a delivery
68017 process or a process for testing address routing (started with <option>-bt</option>), the
68018 uid and gid are changed to the Exim user and group. This means that Exim always
68019 runs under its own uid and gid when receiving messages. This also applies when
68020 testing address verification
68021 <indexterm role="option">
68022 <primary><option>-bv</option></primary>
68023 </indexterm>
68024 <indexterm role="option">
68025 <primary><option>-bh</option></primary>
68026 </indexterm>
68027 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
68028 option).
68029 </para>
68030 </listitem>
68031 <listitem>
68032 <para>
68033 For a daemon, queue runner, delivery, or address testing process, the uid
68034 remains as root at this stage, but the gid is changed to the Exim group.
68035 </para>
68036 </listitem>
68037 </itemizedlist>
68038 <para>
68039 The processes that initially retain root privilege behave as follows:
68040 </para>
68041 <itemizedlist>
68042 <listitem>
68043 <para>
68044 A daemon process changes the gid to the Exim group and the uid to the Exim
68045 user after setting up one or more listening sockets. The <function>initgroups()</function>
68046 function is called, so that if the Exim user is in any additional groups, they
68047 will be used during message reception.
68048 </para>
68049 </listitem>
68050 <listitem>
68051 <para>
68052 A queue runner process retains root privilege throughout its execution. Its
68053 job is to fork a controlled sequence of delivery processes.
68054 </para>
68055 </listitem>
68056 <listitem>
68057 <para>
68058 A delivery process retains root privilege throughout most of its execution,
68059 but any actual deliveries (that is, the transports themselves) are run in
68060 subprocesses which always change to a non-root uid and gid. For local
68061 deliveries this is typically the uid and gid of the owner of the mailbox; for
68062 remote deliveries, the Exim uid and gid are used. Once all the delivery
68063 subprocesses have been run, a delivery process changes to the Exim uid and gid
68064 while doing post-delivery tidying up such as updating the retry database and
68065 generating bounce and warning messages.
68066 </para>
68067 <para>
68068 While the recipient addresses in a message are being routed, the delivery
68069 process runs as root. However, if a user&#x2019;s filter file has to be processed,
68070 this is done in a subprocess that runs under the individual user&#x2019;s uid and
68071 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
68072 </para>
68073 </listitem>
68074 <listitem>
68075 <para>
68076 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
68077 the routing is done in the same environment as a message delivery.
68078 </para>
68079 </listitem>
68080 </itemizedlist>
68081 </section>
68082 <section id="SECTrunexiwitpri">
68083 <title>Running Exim without privilege</title>
68084 <para>
68085 <indexterm role="concept">
68086 <primary>privilege, running without</primary>
68087 </indexterm>
68088 <indexterm role="concept">
68089 <primary>unprivileged running</primary>
68090 </indexterm>
68091 <indexterm role="concept">
68092 <primary>root privilege</primary>
68093 <secondary>running without</secondary>
68094 </indexterm>
68095 Some installations like to run Exim in an unprivileged state for more of its
68096 operation, for added security. Support for this mode of operation is provided
68097 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
68098 gid are changed to the Exim user and group at the start of a delivery process
68099 (and also queue runner and address testing processes). This means that address
68100 routing is no longer run as root, and the deliveries themselves cannot change
68101 to any other uid.
68102 </para>
68103 <para>
68104 <indexterm role="concept">
68105 <primary>SIGHUP</primary>
68106 </indexterm>
68107 <indexterm role="concept">
68108 <primary>daemon</primary>
68109 <secondary>restarting</secondary>
68110 </indexterm>
68111 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
68112 that the daemon can still be started in the usual way, and it can respond
68113 correctly to SIGHUP because the re-invocation regains root privilege.
68114 </para>
68115 <para>
68116 An alternative approach is to make Exim setuid to the Exim user and also setgid
68117 to the Exim group. If you do this, the daemon must be started from a root
68118 process. (Calling Exim from a root process makes it behave in the way it does
68119 when it is setuid root.) However, the daemon cannot restart itself after a
68120 SIGHUP signal because it cannot regain privilege.
68121 </para>
68122 <para>
68123 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
68124 stops Exim from trying to re-invoke itself to do a delivery after a message has
68125 been received. Such a re-invocation is a waste of resources because it has no
68126 effect.
68127 </para>
68128 <para>
68129 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
68130 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
68131 to the Exim user seems a clean approach, but there is one complication:
68132 </para>
68133 <para>
68134 In this style of operation, Exim is running with the real uid and gid set to
68135 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
68136 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
68137 that is, the real uid/gid should be reset to the effective values so as to
68138 discard any privileges that the caller may have. While some operating systems
68139 have a function that permits this action for a non-root effective uid, quite a
68140 number of them do not. Because of this lack of standardization, Exim does not
68141 address this problem at this time.
68142 </para>
68143 <para>
68144 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
68145 is to keep the Exim binary setuid to root, and to set
68146 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
68147 be used in the most straightforward way.
68148 </para>
68149 <para>
68150 If you configure Exim not to run delivery processes as root, there are a
68151 number of restrictions on what you can do:
68152 </para>
68153 <itemizedlist>
68154 <listitem>
68155 <para>
68156 You can deliver only as the Exim user/group. You should  explicitly use the
68157 <option>user</option> and <option>group</option> options to override routers or local transports that
68158 normally deliver as the recipient. This makes sure that configurations that
68159 work in this mode function the same way in normal mode. Any implicit or
68160 explicit specification of another user causes an error.
68161 </para>
68162 </listitem>
68163 <listitem>
68164 <para>
68165 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
68166 not worthwhile to include them in the configuration.
68167 </para>
68168 </listitem>
68169 <listitem>
68170 <para>
68171 Users who wish to use <filename>.forward</filename> would have to make their home directory and
68172 the file itself accessible to the Exim user. Pipe and append-to-file entries,
68173 and their equivalents in Exim filters, cannot be used. While they could be
68174 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
68175 </para>
68176 </listitem>
68177 <listitem>
68178 <para>
68179 Unless the local user mailboxes are all owned by the Exim user (possible in
68180 some POP3 or IMAP-only environments):
68181 </para>
68182 <orderedlist numeration="arabic">
68183 <listitem>
68184 <para>
68185 They must be owned by the Exim group and be writeable by that group. This
68186 implies you must set <option>mode</option> in the appendfile configuration, as well as the
68187 mode of the mailbox files themselves.
68188 </para>
68189 </listitem>
68190 <listitem>
68191 <para>
68192 You must set <option>no_check_owner</option>, since most or all of the files will not be
68193 owned by the Exim user.
68194 </para>
68195 </listitem>
68196 <listitem>
68197 <para>
68198 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
68199 on a newly created mailbox when unprivileged. This also implies that new
68200 mailboxes need to be created manually.
68201 </para>
68202 </listitem>
68203 </orderedlist>
68204 </listitem>
68205 </itemizedlist>
68206 <para>
68207 These restrictions severely restrict what can be done in local deliveries.
68208 However, there are no restrictions on remote deliveries. If you are running a
68209 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
68210 gives more security at essentially no cost.
68211 </para>
68212 <para>
68213 If you are using the <option>mua_wrapper</option> facility (see chapter
68214 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
68215 </para>
68216 </section>
68217 <section id="SECID271">
68218 <title>Delivering to local files</title>
68219 <para>
68220 Full details of the checks applied by <command>appendfile</command> before it writes to a file
68221 are given in chapter <xref linkend="CHAPappendfile"/>.
68222 </para>
68223 </section>
68224 <section id="SECTsecconslocalcmds">
68225 <title>Running local commands</title>
68226 <para>
68227 <indexterm role="concept">
68228 <primary>security</primary>
68229 <secondary>local commands</secondary>
68230 </indexterm>
68231 <indexterm role="concept">
68232 <primary>security</primary>
68233 <secondary>command injection attacks</secondary>
68234 </indexterm>
68235 There are a number of ways in which an administrator can configure Exim to run
68236 commands based upon received, untrustworthy, data. Further, in some
68237 configurations a user who can control a <filename>.forward</filename> file can also arrange to
68238 run commands. Configuration to check includes, but is not limited to:
68239 </para>
68240 <itemizedlist>
68241 <listitem>
68242 <para>
68243 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
68244 injection may be possible with this option present. It is dangerous and should
68245 be used only with considerable caution. Consider constraints which whitelist
68246 allowed characters in a variable which is to be used in a pipe transport that
68247 has <option>use_shell</option> enabled.
68248 </para>
68249 </listitem>
68250 <listitem>
68251 <para>
68252 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
68253 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
68254 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
68255 hub to which ordinary users do not have shell access, but home directories are
68256 NFS mounted (for instance) then administrators should review the list of these
68257 forbid options available, and should bear in mind that the options that may
68258 need forbidding can change as new features are added between releases.
68259 </para>
68260 </listitem>
68261 <listitem>
68262 <para>
68263 The <option>${run...}</option> expansion item does not use a shell by default, but
68264 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
68265 Such invocations should be viewed with prejudicial suspicion.
68266 </para>
68267 </listitem>
68268 <listitem>
68269 <para>
68270 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
68271 taint checking might apply to their usage.
68272 </para>
68273 </listitem>
68274 <listitem>
68275 <para>
68276 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
68277 administrators are well advised to view its use with suspicion, in case (for
68278 instance) it allows a local-part to contain embedded Exim directives.
68279 </para>
68280 </listitem>
68281 <listitem>
68282 <para>
68283 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
68284 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
68285 each can reference arbitrary lists and files, rather than just being a list
68286 of opaque strings.
68287 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
68288 real-world security vulnerabilities caused by its use with untrustworthy data
68289 injected in, for SQL injection attacks.
68290 Consider the use of the <option>inlisti</option> expansion condition instead.
68291 </para>
68292 </listitem>
68293 </itemizedlist>
68294 </section>
68295 <section id="SECTsecconfdata">
68296 <title>Trust in configuration data</title>
68297 <para>
68298 <indexterm role="concept">
68299 <primary>security</primary>
68300 <secondary>data sources</secondary>
68301 </indexterm>
68302 <indexterm role="concept">
68303 <primary>security</primary>
68304 <secondary>regular expressions</secondary>
68305 </indexterm>
68306 <indexterm role="concept">
68307 <primary>regular expressions</primary>
68308 <secondary>security</secondary>
68309 </indexterm>
68310 <indexterm role="concept">
68311 <primary>PCRE</primary>
68312 <secondary>security</secondary>
68313 </indexterm>
68314 If configuration data for Exim can come from untrustworthy sources, there
68315 are some issues to be aware of:
68316 </para>
68317 <itemizedlist>
68318 <listitem>
68319 <para>
68320 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
68321 </para>
68322 </listitem>
68323 <listitem>
68324 <para>
68325 Letting untrusted data provide a regular expression is unwise.
68326 </para>
68327 </listitem>
68328 <listitem>
68329 <para>
68330 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
68331 data may result in pathological behaviour within PCRE.  Be aware of what
68332 "backtracking" means and consider options for being more strict with a regular
68333 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
68334 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
68335 possessive quantifiers or just not using regular expressions against untrusted
68336 data.
68337 </para>
68338 </listitem>
68339 <listitem>
68340 <para>
68341 It can be important to correctly use <option>${quote:...}</option>,
68342 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
68343 items to ensure that data is correctly constructed.
68344 </para>
68345 </listitem>
68346 <listitem>
68347 <para>
68348 Some lookups might return multiple results, even though normal usage is only
68349 expected to yield one result.
68350 </para>
68351 </listitem>
68352 </itemizedlist>
68353 </section>
68354 <section id="SECID272">
68355 <title>IPv4 source routing</title>
68356 <para>
68357 <indexterm role="concept">
68358 <primary>source routing</primary>
68359 <secondary>in IP packets</secondary>
68360 </indexterm>
68361 <indexterm role="concept">
68362 <primary>IP source routing</primary>
68363 </indexterm>
68364 Many operating systems suppress IP source-routed packets in the kernel, but
68365 some cannot be made to do this, so Exim does its own check. It logs incoming
68366 IPv4 source-routed TCP calls, and then drops them. Things are all different in
68367 IPv6. No special checking is currently done.
68368 </para>
68369 </section>
68370 <section id="SECID273">
68371 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
68372 <para>
68373 Support for these SMTP commands is disabled by default. If required, they can
68374 be enabled by defining suitable ACLs.
68375 </para>
68376 </section>
68377 <section id="SECID274">
68378 <title>Privileged users</title>
68379 <para>
68380 <indexterm role="concept">
68381 <primary>trusted users</primary>
68382 </indexterm>
68383 <indexterm role="concept">
68384 <primary>admin user</primary>
68385 </indexterm>
68386 <indexterm role="concept">
68387 <primary>privileged user</primary>
68388 </indexterm>
68389 <indexterm role="concept">
68390 <primary>user</primary>
68391 <secondary>trusted</secondary>
68392 </indexterm>
68393 <indexterm role="concept">
68394 <primary>user</primary>
68395 <secondary>admin</secondary>
68396 </indexterm>
68397 Exim recognizes two sets of users with special privileges. Trusted users are
68398 able to submit new messages to Exim locally, but supply their own sender
68399 addresses and information about a sending host. For other users submitting
68400 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
68401 permit a remote host to be specified.
68402 </para>
68403 <para>
68404 <indexterm role="option">
68405 <primary><option>-f</option></primary>
68406 </indexterm>
68407 However, an untrusted user is permitted to use the <option>-f</option> command line option
68408 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
68409 message should not cause an error report. This affects the message&#x2019;s envelope,
68410 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
68411 permitted to use specific forms of address with the <option>-f</option> option by setting
68412 the <option>untrusted_set_sender</option> option.
68413 </para>
68414 <para>
68415 Trusted users are used to run processes that receive mail messages from some
68416 other mail domain and pass them on to Exim for delivery either locally, or over
68417 the Internet. Exim trusts a caller that is running as root, as the Exim user,
68418 as any user listed in the <option>trusted_users</option> configuration option, or under any
68419 group listed in the <option>trusted_groups</option> option.
68420 </para>
68421 <para>
68422 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
68423 can freeze or thaw messages, cause them to be returned to their senders, remove
68424 them entirely, or modify them in various ways. In addition, admin users can run
68425 the Exim monitor and see all the information it is capable of providing, which
68426 includes the contents of files on the spool.
68427 </para>
68428 <para>
68429 <indexterm role="option">
68430 <primary><option>-M</option></primary>
68431 </indexterm>
68432 <indexterm role="option">
68433 <primary><option>-q</option></primary>
68434 </indexterm>
68435 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
68436 delivery of messages on its queue is restricted to admin users. This
68437 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
68438 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
68439 queue is also restricted to admin users. This restriction can be relaxed by
68440 setting <option>no_queue_list_requires_admin</option>.
68441 </para>
68442 <para>
68443 Exim recognizes an admin user if the calling process is running as root or as
68444 the Exim user or if any of the groups associated with the calling process is
68445 the Exim group. It is not necessary actually to be running under the Exim
68446 group. However, if admin users who are not root or the Exim user are to access
68447 the contents of files on the spool via the Exim monitor (which runs
68448 unprivileged), Exim must be built to allow group read access to its spool
68449 files.
68450 </para>
68451 </section>
68452 <section id="SECID275">
68453 <title>Spool files</title>
68454 <para>
68455 <indexterm role="concept">
68456 <primary>spool directory</primary>
68457 <secondary>files</secondary>
68458 </indexterm>
68459 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
68460 set to the Exim group. The mode for spool files is defined in the
68461 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
68462 any user who is a member of the Exim group can access these files.
68463 </para>
68464 </section>
68465 <section id="SECID276">
68466 <title>Use of argv[0]</title>
68467 <para>
68468 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
68469 of specific strings, Exim assumes certain options. For example, calling Exim
68470 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
68471 to calling it with the option <option>-bS</option>. There are no security implications in
68472 this.
68473 </para>
68474 </section>
68475 <section id="SECID277">
68476 <title>Use of %f formatting</title>
68477 <para>
68478 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
68479 are actually stored in integer variables as 1000 times the load average.
68480 Consequently, their range is limited and so therefore is the length of the
68481 converted output.
68482 </para>
68483 </section>
68484 <section id="SECID278">
68485 <title>Embedded Exim path</title>
68486 <para>
68487 Exim uses its own path name, which is embedded in the code, only when it needs
68488 to re-exec in order to regain root privilege. Therefore, it is not root when it
68489 does so. If some bug allowed the path to get overwritten, it would lead to an
68490 arbitrary program&#x2019;s being run as exim, not as root.
68491 </para>
68492 </section>
68493 <section id="SECTdynmoddir">
68494 <title>Dynamic module directory</title>
68495 <para>
68496 Any dynamically loadable modules must be installed into the directory
68497 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
68498 loading it.
68499 </para>
68500 </section>
68501 <section id="SECID279">
68502 <title>Use of sprintf()</title>
68503 <para>
68504 <indexterm role="concept">
68505 <primary><function>sprintf()</function></primary>
68506 </indexterm>
68507 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
68508 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
68509 The intermediate formatting is done into a large fixed buffer by a function
68510 that runs through the format string itself, and checks the length of each
68511 conversion before performing it, thus preventing buffer overruns.
68512 </para>
68513 <para>
68514 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
68515 the output buffer is known to be sufficiently long to contain the converted
68516 string.
68517 </para>
68518 </section>
68519 <section id="SECID280">
68520 <title>Use of debug_printf() and log_write()</title>
68521 <para>
68522 Arbitrary strings are passed to both these functions, but they do their
68523 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
68524 the format string itself, and checks the length of each conversion.
68525 </para>
68526 </section>
68527 <section id="SECID281">
68528 <title>Use of strcat() and strcpy()</title>
68529 <para>
68530 These are used only in cases where the output buffer is known to be large
68531 enough to hold the result.
68532 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
68533 </para>
68534 </section>
68535 </chapter>
68536
68537 <chapter id="CHAPspool">
68538 <title>Format of spool files</title>
68539 <para>
68540 <indexterm role="concept" id="IIDforspo1" class="startofrange">
68541 <primary>format</primary>
68542 <secondary>spool files</secondary>
68543 </indexterm>
68544 <indexterm role="concept" id="IIDforspo2" class="startofrange">
68545 <primary>spool directory</primary>
68546 <secondary>format of files</secondary>
68547 </indexterm>
68548 <indexterm role="concept" id="IIDforspo3" class="startofrange">
68549 <primary>spool files</primary>
68550 <secondary>format of</secondary>
68551 </indexterm>
68552 <indexterm role="concept">
68553 <primary>spool files</primary>
68554 <secondary>editing</secondary>
68555 </indexterm>
68556 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
68557 followed by -D and -H, respectively. The data portion of the message is kept in
68558 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
68559 kept in the -H file, whose format is described in this chapter. Each of these
68560 two files contains the final component of its own name as its first line. This
68561 is insurance against disk crashes where the directory is lost but the files
68562 themselves are recoverable.
68563 </para>
68564 <para>
68565 Some people are tempted into editing -D files in order to modify messages. You
68566 need to be extremely careful if you do this; it is not recommended and you are
68567 on your own if you do it. Here are some of the pitfalls:
68568 </para>
68569 <itemizedlist>
68570 <listitem>
68571 <para>
68572 You must ensure that Exim does not try to deliver the message while you are
68573 fiddling with it. The safest way is to take out a write lock on the -D file,
68574 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
68575 place, the lock will be retained. If you write a new file and rename it, the
68576 lock will be lost at the instant of rename.
68577 </para>
68578 </listitem>
68579 <listitem>
68580 <para>
68581 <indexterm role="variable">
68582 <primary><varname>$body_linecount</varname></primary>
68583 </indexterm>
68584 If you change the number of lines in the file, the value of
68585 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
68586 cause incomplete transmission of messages or undeliverable messages.
68587 </para>
68588 </listitem>
68589 <listitem>
68590 <para>
68591 If the message is in MIME format, you must take care not to break it.
68592 </para>
68593 </listitem>
68594 <listitem>
68595 <para>
68596 If the message is cryptographically signed, any change will invalidate the
68597 signature.
68598 </para>
68599 </listitem>
68600 </itemizedlist>
68601 <para>
68602 All in all, modifying -D files is fraught with danger.
68603 </para>
68604 <para>
68605 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
68606 its subdirectories when <option>split_spool_directory</option> is set). These are journal
68607 files, used to record addresses to which the message has been delivered during
68608 the course of a delivery attempt. If there are still undelivered recipients at
68609 the end, the -H file is updated, and the -J file is deleted. If, however, there
68610 is some kind of crash (for example, a power outage) before this happens, the -J
68611 file remains in existence. When Exim next processes the message, it notices the
68612 -J file and uses it to update the -H file before starting the next delivery
68613 attempt.
68614 </para>
68615 <section id="SECID282">
68616 <title>Format of the -H file</title>
68617 <para>
68618 <indexterm role="concept">
68619 <primary>uid (user id)</primary>
68620 <secondary>in spool file</secondary>
68621 </indexterm>
68622 <indexterm role="concept">
68623 <primary>gid (group id)</primary>
68624 <secondary>in spool file</secondary>
68625 </indexterm>
68626 The second line of the -H file contains the login name for the uid of the
68627 process that called Exim to read the message, followed by the numerical uid and
68628 gid. For a locally generated message, this is normally the user who sent the
68629 message. For a message received over TCP/IP via the daemon, it is
68630 normally the Exim user.
68631 </para>
68632 <para>
68633 The third line of the file contains the address of the message&#x2019;s sender as
68634 transmitted in the envelope, contained in angle brackets. The sender address is
68635 empty for bounce messages. For incoming SMTP mail, the sender address is given
68636 in the MAIL command. For locally generated mail, the sender address is
68637 created by Exim from the login name of the current user and the configured
68638 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
68639 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
68640 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
68641 </para>
68642 <para>
68643 The fourth line contains two numbers. The first is the time that the message
68644 was received, in the conventional Unix form &ndash; the number of seconds since the
68645 start of the epoch. The second number is a count of the number of messages
68646 warning of delayed delivery that have been sent to the sender.
68647 </para>
68648 <para>
68649 There follow a number of lines starting with a hyphen. These can appear in any
68650 order, and are omitted when not relevant:
68651 </para>
68652 <variablelist>
68653 <varlistentry>
68654 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68655 <listitem>
68656 <para>
68657 This item is obsolete, and is not generated from Exim release 4.61 onwards;
68658 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
68659 recognized, to provide backward compatibility. In the old format, a line of
68660 this form is present for every ACL variable that is not empty. The number
68661 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
68662 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
68663 the data string for the variable. The string itself starts at the beginning of
68664 the next line, and is followed by a newline character. It may contain internal
68665 newlines.
68666 </para>
68667 </listitem></varlistentry>
68668 <varlistentry>
68669 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68670 <listitem>
68671 <para>
68672 A line of this form is present for every ACL connection variable that is
68673 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
68674 The length is the length of the data string for the variable. The string itself
68675 starts at the beginning of the next line, and is followed by a newline
68676 character. It may contain internal newlines.
68677 </para>
68678 </listitem></varlistentry>
68679 <varlistentry>
68680 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
68681 <listitem>
68682 <para>
68683 A line of this form is present for every ACL message variable that is defined.
68684 Note that there is a space between <option>-aclm</option> and the rest of the name. The
68685 length is the length of the data string for the variable. The string itself
68686 starts at the beginning of the next line, and is followed by a newline
68687 character. It may contain internal newlines.
68688 </para>
68689 </listitem></varlistentry>
68690 <varlistentry>
68691 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
68692 <listitem>
68693 <para>
68694 This is present if, when the message was received over SMTP, the value of
68695 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
68696 </para>
68697 </listitem></varlistentry>
68698 <varlistentry>
68699 <term><option>-allow_unqualified_recipient</option></term>
68700 <listitem>
68701 <para>
68702 This is present if unqualified recipient addresses are permitted in header
68703 lines (to stop such addresses from being qualified if rewriting occurs at
68704 transport time). Local messages that were input using <option>-bnq</option> and remote
68705 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
68706 </para>
68707 </listitem></varlistentry>
68708 <varlistentry>
68709 <term><option>-allow_unqualified_sender</option></term>
68710 <listitem>
68711 <para>
68712 This is present if unqualified sender addresses are permitted in header lines
68713 (to stop such addresses from being qualified if rewriting occurs at transport
68714 time). Local messages that were input using <option>-bnq</option> and remote messages from
68715 hosts that match <option>sender_unqualified_hosts</option> set this flag.
68716 </para>
68717 </listitem></varlistentry>
68718 <varlistentry>
68719 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68720 <listitem>
68721 <para>
68722 The id information for a message received on an authenticated SMTP connection
68723 &ndash; the value of the <varname>$authenticated_id</varname> variable.
68724 </para>
68725 </listitem></varlistentry>
68726 <varlistentry>
68727 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
68728 <listitem>
68729 <para>
68730 The address of an authenticated sender &ndash; the value of the
68731 <varname>$authenticated_sender</varname> variable.
68732 </para>
68733 </listitem></varlistentry>
68734 <varlistentry>
68735 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68736 <listitem>
68737 <para>
68738 This records the number of lines in the body of the message, and is always
68739 present.
68740 </para>
68741 </listitem></varlistentry>
68742 <varlistentry>
68743 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68744 <listitem>
68745 <para>
68746 This records the number of binary zero bytes in the body of the message, and is
68747 present if the number is greater than zero.
68748 </para>
68749 </listitem></varlistentry>
68750 <varlistentry>
68751 <term><option>-deliver_firsttime</option></term>
68752 <listitem>
68753 <para>
68754 This is written when a new message is first added to the spool. When the spool
68755 file is updated after a deferral, it is omitted.
68756 </para>
68757 </listitem></varlistentry>
68758 <varlistentry>
68759 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
68760 <listitem>
68761 <para>
68762 <indexterm role="concept">
68763 <primary>frozen messages</primary>
68764 <secondary>spool data</secondary>
68765 </indexterm>
68766 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
68767 </para>
68768 </listitem></varlistentry>
68769 <varlistentry>
68770 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68771 <listitem>
68772 <para>
68773 This records the host name as specified by a remote host in a HELO or EHLO
68774 command.
68775 </para>
68776 </listitem></varlistentry>
68777 <varlistentry>
68778 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
68779 <listitem>
68780 <para>
68781 This records the IP address of the host from which the message was received and
68782 the remote port number that was used. It is omitted for locally generated
68783 messages.
68784 </para>
68785 </listitem></varlistentry>
68786 <varlistentry>
68787 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68788 <listitem>
68789 <para>
68790 If the message was received on an authenticated SMTP connection, this records
68791 the name of the authenticator &ndash; the value of the
68792 <varname>$sender_host_authenticated</varname> variable.
68793 </para>
68794 </listitem></varlistentry>
68795 <varlistentry>
68796 <term><option>-host_lookup_failed</option></term>
68797 <listitem>
68798 <para>
68799 This is present if an attempt to look up the sending host&#x2019;s name from its IP
68800 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
68801 </para>
68802 </listitem></varlistentry>
68803 <varlistentry>
68804 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68805 <listitem>
68806 <para>
68807 <indexterm role="concept">
68808 <primary>reverse DNS lookup</primary>
68809 </indexterm>
68810 <indexterm role="concept">
68811 <primary>DNS</primary>
68812 <secondary>reverse lookup</secondary>
68813 </indexterm>
68814 This records the name of the remote host from which the message was received,
68815 if the host name was looked up from the IP address when the message was being
68816 received. It is not present if no reverse lookup was done.
68817 </para>
68818 </listitem></varlistentry>
68819 <varlistentry>
68820 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
68821 <listitem>
68822 <para>
68823 For locally submitted messages, this records the login of the originating user,
68824 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
68825 ident value. For messages received over TCP/IP, this records the ident string
68826 supplied by the remote host, if any.
68827 </para>
68828 </listitem></varlistentry>
68829 <varlistentry>
68830 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
68831 <listitem>
68832 <para>
68833 This records the IP address of the local interface and the port number through
68834 which a message was received from a remote host. It is omitted for locally
68835 generated messages.
68836 </para>
68837 </listitem></varlistentry>
68838 <varlistentry>
68839 <term><option>-local</option></term>
68840 <listitem>
68841 <para>
68842 The message is from a local sender.
68843 </para>
68844 </listitem></varlistentry>
68845 <varlistentry>
68846 <term><option>-localerror</option></term>
68847 <listitem>
68848 <para>
68849 The message is a locally-generated bounce message.
68850 </para>
68851 </listitem></varlistentry>
68852 <varlistentry>
68853 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
68854 <listitem>
68855 <para>
68856 This records the data string that was returned by the <function>local_scan()</function> function
68857 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
68858 variable. It is omitted if no data was returned.
68859 </para>
68860 </listitem></varlistentry>
68861 <varlistentry>
68862 <term><option>-manual_thaw</option></term>
68863 <listitem>
68864 <para>
68865 The message was frozen but has been thawed manually, that is, by an explicit
68866 Exim command rather than via the auto-thaw process.
68867 </para>
68868 </listitem></varlistentry>
68869 <varlistentry>
68870 <term><option>-N</option></term>
68871 <listitem>
68872 <para>
68873 A testing delivery process was started using the <option>-N</option> option to suppress any
68874 actual deliveries, but delivery was deferred. At any further delivery attempts,
68875 <option>-N</option> is assumed.
68876 </para>
68877 </listitem></varlistentry>
68878 <varlistentry>
68879 <term><option>-received_protocol</option></term>
68880 <listitem>
68881 <para>
68882 This records the value of the <varname>$received_protocol</varname> variable, which contains
68883 the name of the protocol by which the message was received.
68884 </para>
68885 </listitem></varlistentry>
68886 <varlistentry>
68887 <term><option>-sender_set_untrusted</option></term>
68888 <listitem>
68889 <para>
68890 The envelope sender of this message was set by an untrusted local caller (used
68891 to ensure that the caller is displayed in queue listings).
68892 </para>
68893 </listitem></varlistentry>
68894 <varlistentry>
68895 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
68896 <listitem>
68897 <para>
68898 If a message was scanned by SpamAssassin, this is present. It records the value
68899 of <varname>$spam_score_int</varname>.
68900 </para>
68901 </listitem></varlistentry>
68902 <varlistentry>
68903 <term><option>-tls_certificate_verified</option></term>
68904 <listitem>
68905 <para>
68906 A TLS certificate was received from the client that sent this message, and the
68907 certificate was verified by the server.
68908 </para>
68909 </listitem></varlistentry>
68910 <varlistentry>
68911 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
68912 <listitem>
68913 <para>
68914 When the message was received over an encrypted connection, this records the
68915 name of the cipher suite that was used.
68916 </para>
68917 </listitem></varlistentry>
68918 <varlistentry>
68919 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
68920 <listitem>
68921 <para>
68922 When the message was received over an encrypted connection, and a certificate
68923 was received from the client, this records the Distinguished Name from that
68924 certificate.
68925 </para>
68926 </listitem></varlistentry>
68927 </variablelist>
68928 <para>
68929 Following the options there is a list of those addresses to which the message
68930 is not to be delivered. This set of addresses is initialized from the command
68931 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
68932 is set; otherwise it starts out empty. Whenever a successful delivery is made,
68933 the address is added to this set. The addresses are kept internally as a
68934 balanced binary tree, and it is a representation of that tree which is written
68935 to the spool file. If an address is expanded via an alias or forward file, the
68936 original address is added to the tree when deliveries to all its child
68937 addresses are complete.
68938 </para>
68939 <para>
68940 If the tree is empty, there is a single line in the spool file containing just
68941 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
68942 Y or N, followed by an address. The address is the value for the node of the
68943 tree, and the letters indicate whether the node has a left branch and/or a
68944 right branch attached to it, respectively. If branches exist, they immediately
68945 follow. Here is an example of a three-node tree:
68946 </para>
68947 <literallayout class="monospaced">
68948 YY darcy@austen.fict.example
68949 NN alice@wonderland.fict.example
68950 NN editor@thesaurus.ref.example
68951 </literallayout>
68952 <para>
68953 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
68954 This is a simple list, preceded by a count. It includes all the original
68955 recipients of the message, including those to whom the message has already been
68956 delivered. In the simplest case, the list contains one address per line. For
68957 example:
68958 </para>
68959 <literallayout class="monospaced">
68960 4
68961 editor@thesaurus.ref.example
68962 darcy@austen.fict.example
68963 rdo@foundation
68964 alice@wonderland.fict.example
68965 </literallayout>
68966 <para>
68967 However, when a child address has been added to the top-level addresses as a
68968 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
68969 line is of the following form:
68970 </para>
68971 <literallayout>
68972 &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;
68973 </literallayout>
68974 <para>
68975 The 01 flag bit indicates the presence of the three other fields that follow
68976 the top-level address. Other bits may be used in future to support additional
68977 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
68978 original parent of the <quote>one time</quote> address. The first two fields are the
68979 envelope sender that is associated with this address and its length. If the
68980 length is zero, there is no special envelope sender (there are then two space
68981 characters in the line). A non-empty field can arise from a <command>redirect</command> router
68982 that has an <option>errors_to</option> setting.
68983 </para>
68984 <para>
68985 A blank line separates the envelope and status information from the headers
68986 which follow. A header may occupy several lines of the file, and to save effort
68987 when reading it in, each header is preceded by a number and an identifying
68988 character. The number is the number of characters in the header, including any
68989 embedded newlines and the terminating newline. The character is one of the
68990 following:
68991 </para>
68992 <informaltable frame="none">
68993 <tgroup cols="2" colsep="0" rowsep="0">
68994 <colspec colwidth="50pt" align="left"/>
68995 <colspec colwidth="254pt" align="left"/>
68996 <tbody>
68997 <row>
68998 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
68999 <entry>header in which Exim has no special interest</entry>
69000 </row>
69001 <row>
69002 <entry><literal>B</literal></entry>
69003 <entry><emphasis>Bcc:</emphasis> header</entry>
69004 </row>
69005 <row>
69006 <entry><literal>C</literal></entry>
69007 <entry><emphasis>Cc:</emphasis> header</entry>
69008 </row>
69009 <row>
69010 <entry><literal>F</literal></entry>
69011 <entry><emphasis>From:</emphasis> header</entry>
69012 </row>
69013 <row>
69014 <entry><literal>I</literal></entry>
69015 <entry><emphasis>Message-id:</emphasis> header</entry>
69016 </row>
69017 <row>
69018 <entry><literal>P</literal></entry>
69019 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
69020 </row>
69021 <row>
69022 <entry><literal>R</literal></entry>
69023 <entry><emphasis>Reply-To:</emphasis> header</entry>
69024 </row>
69025 <row>
69026 <entry><literal>S</literal></entry>
69027 <entry><emphasis>Sender:</emphasis> header</entry>
69028 </row>
69029 <row>
69030 <entry><literal>T</literal></entry>
69031 <entry><emphasis>To:</emphasis> header</entry>
69032 </row>
69033 <row>
69034 <entry><literal>*</literal></entry>
69035 <entry>replaced or deleted header</entry>
69036 </row>
69037 </tbody>
69038 </tgroup>
69039 </informaltable>
69040 <para>
69041 Deleted or replaced (rewritten) headers remain in the spool file for debugging
69042 purposes. They are not transmitted when the message is delivered. Here is a
69043 typical set of headers:
69044 </para>
69045 <literallayout class="monospaced">
69046 111P Received: by hobbit.fict.example with local (Exim 4.00)
69047 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
69048 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
69049 038* X-rewrote-sender: bb@hobbit.fict.example
69050 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
69051 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
69052 099* To: alice@wonderland.fict.example, rdo@foundation,
69053 darcy@austen.fict.example, editor@thesaurus.ref.example
69054 104T To: alice@wonderland.fict.example, rdo@foundation.example,
69055 darcy@austen.fict.example, editor@thesaurus.ref.example
69056 038  Date: Fri, 11 May 2001 10:28:59 +0100
69057 </literallayout>
69058 <para>
69059 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
69060 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
69061 unqualified domain <emphasis>foundation</emphasis>.
69062 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
69063 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
69064 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
69065 </para>
69066 </section>
69067 </chapter>
69068
69069 <chapter id="CHAPdkim">
69070 <title>Support for DKIM (DomainKeys Identified Mail)</title>
69071 <titleabbrev>DKIM Support</titleabbrev>
69072 <para>
69073 <indexterm role="concept">
69074 <primary>DKIM</primary>
69075 </indexterm>
69076 </para>
69077 <para>
69078 DKIM is a mechanism by which messages sent by some entity can be provably
69079 linked to a domain which that entity controls.  It permits reputation to
69080 be tracked on a per-domain basis, rather than merely upon source IP address.
69081 DKIM is documented in RFC 4871.
69082 </para>
69083 <para>
69084 DKIM support is compiled into Exim by default if TLS support is present.
69085 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
69086 </para>
69087 <para>
69088 Exim&#x2019;s DKIM implementation allows for
69089 </para>
69090 <orderedlist numeration="arabic">
69091 <listitem>
69092 <para>
69093 Signing outgoing messages: This function is implemented in the SMTP transport.
69094 It can co-exist with all other Exim features
69095 (including transport filters)
69096 except cutthrough delivery.
69097 </para>
69098 </listitem>
69099 <listitem>
69100 <para>
69101 Verifying signatures in incoming messages: This is implemented by an additional
69102 ACL (acl_smtp_dkim), which can be called several times per message, with
69103 different signature contexts.
69104 </para>
69105 </listitem>
69106 </orderedlist>
69107 <para>
69108 In typical Exim style, the verification implementation does not include any
69109 default "policy". Instead it enables you to build your own policy using
69110 Exim&#x2019;s standard controls.
69111 </para>
69112 <para>
69113 Please note that verification of DKIM signatures in incoming mail is turned
69114 on by default for logging purposes. For each signature in incoming email,
69115 exim will log a line displaying the most important signature details, and the
69116 signature status. Here is an example (with line-breaks added for clarity):
69117 </para>
69118 <literallayout class="monospaced">
69119 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
69120     d=facebookmail.com s=q1-2009b
69121     c=relaxed/relaxed a=rsa-sha1
69122     i=@facebookmail.com t=1252484542 [verification succeeded]
69123 </literallayout>
69124 <para>
69125 You might want to turn off DKIM verification processing entirely for internal
69126 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
69127 control modifier. This should typically be done in the RCPT ACL, at points
69128 where you accept mail from relay sources (internal hosts or authenticated
69129 senders).
69130 </para>
69131 <section id="SECDKIMSIGN">
69132 <title>Signing outgoing messages</title>
69133 <para>
69134 <indexterm role="concept">
69135 <primary>DKIM</primary>
69136 <secondary>signing</secondary>
69137 </indexterm>
69138 </para>
69139 <para>
69140 Signing is enabled by setting private options on the SMTP transport.
69141 These options take (expandable) strings as arguments.
69142 </para>
69143 <para>
69144 <indexterm role="option">
69145 <primary><option>dkim_domain</option></primary>
69146 </indexterm>
69147 </para>
69148 <informaltable frame="all">
69149 <tgroup cols="4" colsep="0" rowsep="0">
69150 <colspec colwidth="8*" align="left"/>
69151 <colspec colwidth="6*" align="center"/>
69152 <colspec colwidth="6*" align="center"/>
69153 <colspec colwidth="6*" align="right"/>
69154 <tbody>
69155 <row>
69156 <entry><option>dkim_domain</option></entry>
69157 <entry>Use: <emphasis>smtp</emphasis></entry>
69158 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69159 <entry>Default: <emphasis>unset</emphasis></entry>
69160 </row>
69161 </tbody>
69162 </tgroup>
69163 </informaltable>
69164 <para>
69165 MANDATORY:
69166 The domain you want to sign with. The result of this expanded
69167 option is put into the <option>$dkim_domain</option> expansion variable.
69168 If it is empty after expansion, DKIM signing is not done.
69169 </para>
69170 <para>
69171 <indexterm role="option">
69172 <primary><option>dkim_selector</option></primary>
69173 </indexterm>
69174 </para>
69175 <informaltable frame="all">
69176 <tgroup cols="4" colsep="0" rowsep="0">
69177 <colspec colwidth="8*" align="left"/>
69178 <colspec colwidth="6*" align="center"/>
69179 <colspec colwidth="6*" align="center"/>
69180 <colspec colwidth="6*" align="right"/>
69181 <tbody>
69182 <row>
69183 <entry><option>dkim_selector</option></entry>
69184 <entry>Use: <emphasis>smtp</emphasis></entry>
69185 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69186 <entry>Default: <emphasis>unset</emphasis></entry>
69187 </row>
69188 </tbody>
69189 </tgroup>
69190 </informaltable>
69191 <para>
69192 MANDATORY:
69193 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
69194 variable to look up a matching selector. The result is put in the expansion
69195 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
69196 option along with <option>$dkim_domain</option>.
69197 </para>
69198 <para>
69199 <indexterm role="option">
69200 <primary><option>dkim_private_key</option></primary>
69201 </indexterm>
69202 </para>
69203 <informaltable frame="all">
69204 <tgroup cols="4" colsep="0" rowsep="0">
69205 <colspec colwidth="8*" align="left"/>
69206 <colspec colwidth="6*" align="center"/>
69207 <colspec colwidth="6*" align="center"/>
69208 <colspec colwidth="6*" align="right"/>
69209 <tbody>
69210 <row>
69211 <entry><option>dkim_private_key</option></entry>
69212 <entry>Use: <emphasis>smtp</emphasis></entry>
69213 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69214 <entry>Default: <emphasis>unset</emphasis></entry>
69215 </row>
69216 </tbody>
69217 </tgroup>
69218 </informaltable>
69219 <para>
69220 MANDATORY:
69221 This sets the private key to use. You can use the <option>$dkim_domain</option> and
69222 <option>$dkim_selector</option> expansion variables to determine the private key to use.
69223 The result can either
69224 </para>
69225 <itemizedlist>
69226 <listitem>
69227 <para>
69228 be a valid RSA private key in ASCII armor, including line breaks.
69229 </para>
69230 </listitem>
69231 <listitem>
69232 <para>
69233 start with a slash, in which case it is treated as a file that contains
69234 the private key.
69235 </para>
69236 </listitem>
69237 <listitem>
69238 <para>
69239 be "0", "false" or the empty string, in which case the message will not
69240 be signed. This case will not result in an error, even if <option>dkim_strict</option>
69241 is set.
69242 </para>
69243 </listitem>
69244 </itemizedlist>
69245 <para>
69246 <indexterm role="option">
69247 <primary><option>dkim_canon</option></primary>
69248 </indexterm>
69249 </para>
69250 <informaltable frame="all">
69251 <tgroup cols="4" colsep="0" rowsep="0">
69252 <colspec colwidth="8*" align="left"/>
69253 <colspec colwidth="6*" align="center"/>
69254 <colspec colwidth="6*" align="center"/>
69255 <colspec colwidth="6*" align="right"/>
69256 <tbody>
69257 <row>
69258 <entry><option>dkim_canon</option></entry>
69259 <entry>Use: <emphasis>smtp</emphasis></entry>
69260 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69261 <entry>Default: <emphasis>unset</emphasis></entry>
69262 </row>
69263 </tbody>
69264 </tgroup>
69265 </informaltable>
69266 <para>
69267 OPTIONAL:
69268 This option sets the canonicalization method used when signing a message.
69269 The DKIM RFC currently supports two methods: "simple" and "relaxed".
69270 The option defaults to "relaxed" when unset. Note: the current implementation
69271 only supports using the same canonicalization method for both headers and body.
69272 </para>
69273 <para>
69274 <indexterm role="option">
69275 <primary><option>dkim_strict</option></primary>
69276 </indexterm>
69277 </para>
69278 <informaltable frame="all">
69279 <tgroup cols="4" colsep="0" rowsep="0">
69280 <colspec colwidth="8*" align="left"/>
69281 <colspec colwidth="6*" align="center"/>
69282 <colspec colwidth="6*" align="center"/>
69283 <colspec colwidth="6*" align="right"/>
69284 <tbody>
69285 <row>
69286 <entry><option>dkim_strict</option></entry>
69287 <entry>Use: <emphasis>smtp</emphasis></entry>
69288 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69289 <entry>Default: <emphasis>unset</emphasis></entry>
69290 </row>
69291 </tbody>
69292 </tgroup>
69293 </informaltable>
69294 <para>
69295 OPTIONAL:
69296 This  option  defines  how  Exim  behaves  when  signing a message that
69297 should be signed fails for some reason.  When the expansion evaluates to
69298 either "1" or "true", Exim will defer. Otherwise Exim will send the message
69299 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
69300 variables here.
69301 </para>
69302 <para>
69303 <indexterm role="option">
69304 <primary><option>dkim_sign_headers</option></primary>
69305 </indexterm>
69306 </para>
69307 <informaltable frame="all">
69308 <tgroup cols="4" colsep="0" rowsep="0">
69309 <colspec colwidth="8*" align="left"/>
69310 <colspec colwidth="6*" align="center"/>
69311 <colspec colwidth="6*" align="center"/>
69312 <colspec colwidth="6*" align="right"/>
69313 <tbody>
69314 <row>
69315 <entry><option>dkim_sign_headers</option></entry>
69316 <entry>Use: <emphasis>smtp</emphasis></entry>
69317 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
69318 <entry>Default: <emphasis>unset</emphasis></entry>
69319 </row>
69320 </tbody>
69321 </tgroup>
69322 </informaltable>
69323 <para>
69324 OPTIONAL:
69325 When set, this option must expand to (or be specified as) a colon-separated
69326 list of header names. Headers with these names will be included in the message
69327 signature. When unspecified, the header names recommended in RFC4871 will be
69328 used.
69329 </para>
69330 </section>
69331 <section id="SECID514">
69332 <title>Verifying DKIM signatures in incoming mail</title>
69333 <para>
69334 <indexterm role="concept">
69335 <primary>DKIM</primary>
69336 <secondary>verification</secondary>
69337 </indexterm>
69338 </para>
69339 <para>
69340 Verification of DKIM signatures in SMTP incoming email is implemented via the
69341 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
69342 syntactically(!) correct signature in the incoming message.
69343 A missing ACL definition defaults to accept.
69344 If any ACL call does not accept, the message is not accepted.
69345 If a cutthrough delivery was in progress for the message it is
69346 summarily dropped (having wasted the transmission effort).
69347 </para>
69348 <para>
69349 To evaluate the signature in the ACL a large number of expansion variables
69350 containing the signature status and its details are set up during the
69351 runtime of the ACL.
69352 </para>
69353 <para>
69354 Calling the ACL only for existing signatures is not sufficient to build
69355 more advanced policies. For that reason, the global option
69356 <option>dkim_verify_signers</option>, and a global expansion variable
69357 <option>$dkim_signers</option> exist.
69358 </para>
69359 <para>
69360 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
69361 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
69362 called. It is expanded when the message has been received. At this point,
69363 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
69364 list of signer domains and identities for the message. When
69365 <option>dkim_verify_signers</option> is not specified in the main configuration,
69366 it defaults as:
69367 </para>
69368 <literallayout class="monospaced">
69369 dkim_verify_signers = $dkim_signers
69370 </literallayout>
69371 <para>
69372 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
69373 DKIM signature in the message. Current DKIM verifiers may want to explicitly
69374 call the ACL for known domains or identities. This would be achieved as follows:
69375 </para>
69376 <literallayout class="monospaced">
69377 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
69378 </literallayout>
69379 <para>
69380 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
69381 and "ebay.com", plus all domains and identities that have signatures in the message.
69382 You can also be more creative in constructing your policy. For example:
69383 </para>
69384 <literallayout class="monospaced">
69385 dkim_verify_signers = $sender_address_domain:$dkim_signers
69386 </literallayout>
69387 <para>
69388 If a domain or identity is listed several times in the (expanded) value of
69389 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
69390 </para>
69391 <para>
69392 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
69393 available (from most to least important):
69394 </para>
69395 <variablelist>
69396 <varlistentry>
69397 <term><option>$dkim_cur_signer</option></term>
69398 <listitem>
69399 <para>
69400 The signer that is being evaluated in this ACL run. This can be a domain or
69401 an identity. This is one of the list items from the expanded main option
69402 <option>dkim_verify_signers</option> (see above).
69403 </para>
69404 </listitem></varlistentry>
69405 <varlistentry>
69406 <term><option>$dkim_verify_status</option></term>
69407 <listitem>
69408 <para>
69409 A string describing the general status of the signature. One of
69410 </para>
69411 <itemizedlist>
69412 <listitem>
69413 <para>
69414 <option>none</option>: There is no signature in the message for the current domain or
69415 identity (as reflected by <option>$dkim_cur_signer</option>).
69416 </para>
69417 </listitem>
69418 <listitem>
69419 <para>
69420 <option>invalid</option>: The signature could not be verified due to a processing error.
69421 More detail is available in <option>$dkim_verify_reason</option>.
69422 </para>
69423 </listitem>
69424 <listitem>
69425 <para>
69426 <option>fail</option>: Verification of the signature failed.  More detail is
69427 available in <option>$dkim_verify_reason</option>.
69428 </para>
69429 </listitem>
69430 <listitem>
69431 <para>
69432 <option>pass</option>: The signature passed verification. It is valid.
69433 </para>
69434 </listitem>
69435 </itemizedlist>
69436 </listitem></varlistentry>
69437 <varlistentry>
69438 <term><option>$dkim_verify_reason</option></term>
69439 <listitem>
69440 <para>
69441 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
69442 "fail" or "invalid". One of
69443 </para>
69444 <itemizedlist>
69445 <listitem>
69446 <para>
69447 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
69448 key for the domain could not be retrieved. This may be a temporary problem.
69449 </para>
69450 </listitem>
69451 <listitem>
69452 <para>
69453 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
69454 record for the domain is syntactically invalid.
69455 </para>
69456 </listitem>
69457 <listitem>
69458 <para>
69459 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
69460 body hash does not match the one specified in the signature header. This
69461 means that the message body was modified in transit.
69462 </para>
69463 </listitem>
69464 <listitem>
69465 <para>
69466 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
69467 could not be verified. This may mean that headers were modified,
69468 re-written or otherwise changed in a way which is incompatible with
69469 DKIM verification. It may of course also mean that the signature is forged.
69470 </para>
69471 </listitem>
69472 </itemizedlist>
69473 </listitem></varlistentry>
69474 <varlistentry>
69475 <term><option>$dkim_domain</option></term>
69476 <listitem>
69477 <para>
69478 The signing domain. IMPORTANT: This variable is only populated if there is
69479 an actual signature in the message for the current domain or identity (as
69480 reflected by <option>$dkim_cur_signer</option>).
69481 </para>
69482 </listitem></varlistentry>
69483 <varlistentry>
69484 <term><option>$dkim_identity</option></term>
69485 <listitem>
69486 <para>
69487 The signing identity, if present. IMPORTANT: This variable is only populated
69488 if there is an actual signature in the message for the current domain or
69489 identity (as reflected by <option>$dkim_cur_signer</option>).
69490 </para>
69491 </listitem></varlistentry>
69492 <varlistentry>
69493 <term><option>$dkim_selector</option></term>
69494 <listitem>
69495 <para>
69496 The key record selector string.
69497 </para>
69498 </listitem></varlistentry>
69499 <varlistentry>
69500 <term><option>$dkim_algo</option></term>
69501 <listitem>
69502 <para>
69503 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
69504 </para>
69505 </listitem></varlistentry>
69506 <varlistentry>
69507 <term><option>$dkim_canon_body</option></term>
69508 <listitem>
69509 <para>
69510 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
69511 </para>
69512 </listitem></varlistentry>
69513 <varlistentry>
69514 <term><option>dkim_canon_headers</option></term>
69515 <listitem>
69516 <para>
69517 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
69518 </para>
69519 </listitem></varlistentry>
69520 <varlistentry>
69521 <term><option>$dkim_copiedheaders</option></term>
69522 <listitem>
69523 <para>
69524 A transcript of headers and their values which are included in the signature
69525 (copied from the &#x2019;z=&#x2019; tag of the signature).
69526 Note that RFC6376 requires that verification fail if the From: header is
69527 not included in the signature.  Exim does not enforce this; sites wishing
69528 strict enforcement should code the check explicitly.
69529 </para>
69530 </listitem></varlistentry>
69531 <varlistentry>
69532 <term><option>$dkim_bodylength</option></term>
69533 <listitem>
69534 <para>
69535 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
69536 limit was set by the signer, "9999999999999" is returned. This makes sure
69537 that this variable always expands to an integer value.
69538 </para>
69539 </listitem></varlistentry>
69540 <varlistentry>
69541 <term><option>$dkim_created</option></term>
69542 <listitem>
69543 <para>
69544 UNIX timestamp reflecting the date and time when the signature was created.
69545 When this was not specified by the signer, "0" is returned.
69546 </para>
69547 </listitem></varlistentry>
69548 <varlistentry>
69549 <term><option>$dkim_expires</option></term>
69550 <listitem>
69551 <para>
69552 UNIX timestamp reflecting the date and time when the signer wants the
69553 signature to be treated as "expired". When this was not specified by the
69554 signer, "9999999999999" is returned. This makes it possible to do useful
69555 integer size comparisons against this value.
69556 </para>
69557 </listitem></varlistentry>
69558 <varlistentry>
69559 <term><option>$dkim_headernames</option></term>
69560 <listitem>
69561 <para>
69562 A colon-separated list of names of headers included in the signature.
69563 </para>
69564 </listitem></varlistentry>
69565 <varlistentry>
69566 <term><option>$dkim_key_testing</option></term>
69567 <listitem>
69568 <para>
69569 "1" if the key record has the "testing" flag set, "0" if not.
69570 </para>
69571 </listitem></varlistentry>
69572 <varlistentry>
69573 <term><option>$dkim_key_nosubdomains</option></term>
69574 <listitem>
69575 <para>
69576 "1" if the key record forbids subdomaining, "0" otherwise.
69577 </para>
69578 </listitem></varlistentry>
69579 <varlistentry>
69580 <term><option>$dkim_key_srvtype</option></term>
69581 <listitem>
69582 <para>
69583 Service type (tag s=) from the key record. Defaults to "*" if not specified
69584 in the key record.
69585 </para>
69586 </listitem></varlistentry>
69587 <varlistentry>
69588 <term><option>$dkim_key_granularity</option></term>
69589 <listitem>
69590 <para>
69591 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
69592 in the key record.
69593 </para>
69594 </listitem></varlistentry>
69595 <varlistentry>
69596 <term><option>$dkim_key_notes</option></term>
69597 <listitem>
69598 <para>
69599 Notes from the key record (tag n=).
69600 </para>
69601 </listitem></varlistentry>
69602 <varlistentry>
69603 <term><option>$dkim_key_length</option></term>
69604 <listitem>
69605 <para>
69606 Number of bits in the key.
69607 </para>
69608 </listitem></varlistentry>
69609 </variablelist>
69610 <para>
69611 In addition, two ACL conditions are provided:
69612 </para>
69613 <variablelist>
69614 <varlistentry>
69615 <term><option>dkim_signers</option></term>
69616 <listitem>
69617 <para>
69618 ACL condition that checks a colon-separated list of domains or identities
69619 for a match against the domain or identity that the ACL is currently verifying
69620 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
69621 verb to a group of domains or identities. For example:
69622 </para>
69623 <literallayout class="monospaced">
69624 # Warn when Mail purportedly from GMail has no gmail signature
69625 warn log_message = GMail sender without gmail.com DKIM signature
69626      sender_domains = gmail.com
69627      dkim_signers = gmail.com
69628      dkim_status = none
69629 </literallayout>
69630 <para>
69631 Note that the above does not check for a total lack of DKIM signing;
69632 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
69633 </para>
69634 </listitem></varlistentry>
69635 <varlistentry>
69636 <term><option>dkim_status</option></term>
69637 <listitem>
69638 <para>
69639 ACL condition that checks a colon-separated list of possible DKIM verification
69640 results against the actual result of verification. This is typically used
69641 to restrict an ACL verb to a list of verification outcomes, for example:
69642 </para>
69643 <literallayout class="monospaced">
69644 deny message = Mail from Paypal with invalid/missing signature
69645      sender_domains = paypal.com:paypal.de
69646      dkim_signers = paypal.com:paypal.de
69647      dkim_status = none:invalid:fail
69648 </literallayout>
69649 <para>
69650 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
69651 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
69652 for more information of what they mean.
69653 </para>
69654 </listitem></varlistentry>
69655 </variablelist>
69656 </section>
69657 </chapter>
69658
69659 <chapter id="CHAPproxies">
69660 <title>Proxies</title>
69661 <titleabbrev>Proxy support</titleabbrev>
69662 <para>
69663 <indexterm role="concept">
69664 <primary>proxy support</primary>
69665 </indexterm>
69666 <indexterm role="concept">
69667 <primary>proxy</primary>
69668 <secondary>access via</secondary>
69669 </indexterm>
69670 </para>
69671 <para>
69672 A proxy is an intermediate system through which communication is passed.
69673 Proxies may provide a security, availability or load-distribution function.
69674 </para>
69675 <section id="SECTproxyInbound">
69676 <title>Inbound proxies</title>
69677 <para>
69678 <indexterm role="concept">
69679 <primary>proxy</primary>
69680 <secondary>inbound</secondary>
69681 </indexterm>
69682 <indexterm role="concept">
69683 <primary>proxy</primary>
69684 <secondary>server side</secondary>
69685 </indexterm>
69686 <indexterm role="concept">
69687 <primary>proxy</primary>
69688 <secondary>Proxy protocol</secondary>
69689 </indexterm>
69690 <indexterm role="concept">
69691 <primary>Proxy protocol</primary>
69692 <secondary>proxy</secondary>
69693 </indexterm>
69694 </para>
69695 <para>
69696 Exim has support for receiving inbound SMTP connections via a proxy
69697 that uses <quote>Proxy Protocol</quote> to speak to it.
69698 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
69699 in Local/Makefile.
69700 </para>
69701 <para>
69702 It was built on specifications from:
69703 (<emphasis role="bold"><ulink url="http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt">http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt</ulink></emphasis>).
69704 That URL was revised in May 2014 to version 2 spec:
69705 (<emphasis role="bold"><ulink url="http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e">http://git.1wt.eu/web?p=haproxy.git;a=commitdiff;h=afb768340c9d7e50d8e</ulink></emphasis>).
69706 </para>
69707 <para>
69708 The purpose of this facility is so that an application load balancer,
69709 such as HAProxy, can sit in front of several Exim servers
69710 to distribute load.
69711 Exim uses the local protocol communication with the proxy to obtain
69712 the remote SMTP system IP address and port information.
69713 There is no logging if a host passes or
69714 fails Proxy Protocol negotiation, but it can easily be determined and
69715 recorded in an ACL (example is below).
69716 </para>
69717 <para>
69718 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
69719 main configuration option to a hostlist; connections from these
69720 hosts will use Proxy Protocol.
69721 Exim supports both version 1 and version 2 of the Proxy Protocol and
69722 automatically determines which version is in use.
69723 </para>
69724 <para>
69725 The Proxy Protocol header is the first data received on a TCP connection
69726 and is inserted before any TLS-on-connect handshake from the client; Exim
69727 negotiates TLS between Exim-as-server and the remote client, not between
69728 Exim and the proxy server.
69729 </para>
69730 <para>
69731 The following expansion variables are usable
69732 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
69733 of the proxy):
69734 </para>
69735 <literallayout>
69736 <emphasis>proxy_external_address   </emphasis> IP of host being proxied or IP of remote interface of proxy
69737 <emphasis>proxy_external_port      </emphasis> Port of host being proxied or Port on remote interface of proxy
69738 <emphasis>proxy_local_address </emphasis> IP of proxy server inbound or IP of local interface of proxy
69739 <emphasis>proxy_local_port    </emphasis> Port of proxy server inbound or Port on local interface of proxy
69740 <emphasis>proxy_session        </emphasis> boolean: SMTP connection via proxy
69741 </literallayout>
69742 <para>
69743 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
69744 there was a protocol error.
69745 </para>
69746 <para>
69747 Since the real connections are all coming from the proxy, and the
69748 per host connection tracking is done before Proxy Protocol is
69749 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
69750 handle all of the parallel volume you expect per inbound proxy.
69751 With the option set so high, you lose the ability
69752 to protect your server from many connections from one IP.
69753 In order to prevent your server from overload, you
69754 need to add a per connection ratelimit to your connect ACL.
69755 A possible solution is:
69756 </para>
69757 <literallayout>
69758   # Set max number of connections per host
69759   LIMIT   = 5
69760   # Or do some kind of IP lookup in a flat file or database
69761   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
69762
69763   defer   message        = Too many connections from this IP right now
69764           ratelimit      = LIMIT / 5s / per_conn / strict
69765 </literallayout>
69766 </section>
69767 <section id="SECTproxySOCKS">
69768 <title>Outbound proxies</title>
69769 <para>
69770 <indexterm role="concept">
69771 <primary>proxy</primary>
69772 <secondary>outbound</secondary>
69773 </indexterm>
69774 <indexterm role="concept">
69775 <primary>proxy</primary>
69776 <secondary>client side</secondary>
69777 </indexterm>
69778 <indexterm role="concept">
69779 <primary>proxy</primary>
69780 <secondary>SOCKS</secondary>
69781 </indexterm>
69782 <indexterm role="concept">
69783 <primary>SOCKS</primary>
69784 <secondary>proxy</secondary>
69785 </indexterm>
69786 Exim has support for sending outbound SMTP via a proxy
69787 using a protocol called SOCKS5 (defined by RFC1928).
69788 The support can be optionally included by defining SUPPORT_SOCKS=yes in
69789 Local/Makefile.
69790 </para>
69791 <para>
69792 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
69793 on an smtp transport.
69794 The option value is expanded and should then be a list
69795 (colon-separated by default) of proxy specifiers.
69796 Each proxy specifier is a list
69797 (space-separated by default) where the initial element
69798 is an IP address and any subsequent elements are options.
69799 </para>
69800 <para>
69801 Options are a string &lt;name&gt;=&lt;value&gt;.
69802 The list of options is in the following table:
69803 </para>
69804 <literallayout>
69805 <emphasis>auth   </emphasis> authentication method
69806 <emphasis>name   </emphasis> authentication username
69807 <emphasis>pass   </emphasis> authentication password
69808 <emphasis>port   </emphasis> tcp port
69809 <emphasis>tmo    </emphasis> connection timeout
69810 <emphasis>pri    </emphasis> priority
69811 <emphasis>weight </emphasis> selection bias
69812 </literallayout>
69813 <para>
69814 More details on each of these options follows:
69815 </para>
69816 <itemizedlist>
69817 <listitem>
69818 <para>
69819 <indexterm role="concept">
69820 <primary>authentication</primary>
69821 <secondary>to proxy</secondary>
69822 </indexterm>
69823 <indexterm role="concept">
69824 <primary>proxy</primary>
69825 <secondary>authentication</secondary>
69826 </indexterm>
69827 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
69828 Using <quote>name</quote> selects username/password authentication per RFC 1929
69829 for access to the proxy.
69830 Default is <quote>none</quote>.
69831 </para>
69832 </listitem>
69833 <listitem>
69834 <para>
69835 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
69836 Default is empty.
69837 </para>
69838 </listitem>
69839 <listitem>
69840 <para>
69841 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
69842 Default is empty.
69843 </para>
69844 </listitem>
69845 <listitem>
69846 <para>
69847 <option>port</option>: the TCP port number to use for the connection to the proxy.
69848 Default is 1080.
69849 </para>
69850 </listitem>
69851 <listitem>
69852 <para>
69853 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
69854 Default is 5.
69855 </para>
69856 </listitem>
69857 <listitem>
69858 <para>
69859 <option>pri</option>: specifies a priority for the proxy within the list,
69860 higher values being tried first.
69861 The default priority is 1.
69862 </para>
69863 </listitem>
69864 <listitem>
69865 <para>
69866 <option>weight</option>: specifies a selection bias.
69867 Within a priority set servers are queried in a random fashion,
69868 weighted by this value.
69869 The default value for selection bias is 1.
69870 </para>
69871 </listitem>
69872 </itemizedlist>
69873 <para>
69874 Proxies from the list are tried according to their priority
69875 and weight settings until one responds.  The timeout for the
69876 overall connection applies to the set of proxied attempts.
69877 </para>
69878 </section>
69879 <section id="SECTproxyLog">
69880 <title>Logging</title>
69881 <para>
69882 To log the (local) IP of a proxy in the incoming or delivery logline,
69883 add <quote>+proxy</quote> to the <option>log_selector</option> option.
69884 This will add a component tagged with <quote>PRX=</quote> to the line.
69885 </para>
69886 </section>
69887 </chapter>
69888
69889 <chapter id="CHAPi18n">
69890 <title>Internationalisation</title>
69891 <titleabbrev>Internationalisation"</titleabbrev>
69892 <para>
69893 <indexterm role="concept">
69894 <primary>internationalisation</primary>
69895 <secondary>email address</secondary>
69896 </indexterm>
69897 <indexterm role="concept">
69898 <primary>EAI</primary>
69899 </indexterm>
69900 <indexterm role="concept">
69901 <primary>i18n</primary>
69902 </indexterm>
69903 <indexterm role="concept">
69904 <primary>UTF-8</primary>
69905 <secondary>mail name handling</secondary>
69906 </indexterm>
69907 </para>
69908 <para>
69909 Exim has support for Internationalised mail names.
69910 To include this it must be built with SUPPORT_I18N and the libidn library.
69911 Standards supported are RFCs 2060, 5890, 6530 and 6533.
69912 </para>
69913 <para revisionflag="changed">
69914 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
69915 instead of it) then IDNA2008 is supported; this adds an extra library
69916 requirement, upon libidn2.
69917 </para>
69918 <section id="SECTi18nMTA">
69919 <title>MTA operations</title>
69920 <para>
69921 <indexterm role="concept">
69922 <primary>SMTPUTF8</primary>
69923 <secondary>ESMTP option</secondary>
69924 </indexterm>
69925 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
69926 a host list.  If this matches the sending host and
69927 accept_8bitmime is true (the default) then the ESMTP option
69928 SMTPUTF8 will be advertised.
69929 </para>
69930 <para>
69931 If the sender specifies the SMTPUTF8 option on a MAIL command
69932 international handling for the message is enabled and
69933 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
69934 </para>
69935 <para>
69936 The option <option>allow_utf8_domains</option> is set to true for this
69937 message. All DNS lookups are converted to a-label form
69938 whatever the setting of <option>allow_utf8_domains</option>
69939 when Exim is built with SUPPORT_I18N.
69940 </para>
69941 <para>
69942 Both localparts and domain are maintained as the original
69943 UTF-8 form internally; any comparison or regular-expression use will
69944 require appropriate care.  Filenames created, eg. by
69945 the appendfile transport, will have UTF-8 names.
69946 </para>
69947 <para>
69948 HELO names sent by the smtp transport will have any UTF-8
69949 components expanded to a-label form,
69950 and any certificate name checks will be done using the a-label
69951 form of the name.
69952 </para>
69953 <para>
69954 <indexterm role="concept">
69955 <primary>log</primary>
69956 <secondary>protocol</secondary>
69957 </indexterm>
69958 <indexterm role="concept">
69959 <primary>SMTPUTF8</primary>
69960 <secondary>logging</secondary>
69961 </indexterm>
69962 Log lines and Received-by: header lines will acquire a "utf8"
69963 prefix on the protocol element, eg. utf8esmtp.
69964 </para>
69965 <para>
69966 The following expansion operators can be used:
69967 </para>
69968 <literallayout class="monospaced">
69969 ${utf8_domain_to_alabel:str}
69970 ${utf8_domain_from_alabel:str}
69971 ${utf8_localpart_to_alabel:str}
69972 ${utf8_localpart_from_alabel:str}
69973 </literallayout>
69974 <para>
69975 ACLs may use the following modifier:
69976 </para>
69977 <literallayout>
69978 control = utf8_downconvert
69979 control = utf8_downconvert/&lt;value&gt;
69980 </literallayout>
69981 <para>
69982 This sets a flag requiring that addresses are converted to
69983 a-label form before smtp delivery, for use in a
69984 Message Submission Agent context.
69985 If a value is appended it may be:
69986 </para>
69987 <literallayout>
69988 <literal>1  </literal> (default) mandatory downconversion
69989 <literal>0  </literal> no downconversion
69990 <literal>-1 </literal> if SMTPUTF8 not supported by destination host
69991 </literallayout>
69992 <para>
69993 If mua_wrapper is set, the utf8_downconvert control
69994 is initially set to -1.
69995 </para>
69996 <para>
69997 There is no explicit support for VRFY and EXPN.
69998 Configurations supporting these should inspect
69999 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
70000 </para>
70001 <para>
70002 There is no support for LMTP on Unix sockets.
70003 Using the "lmtp" protocol option on an smtp transport,
70004 for LMTP over TCP, should work as expected.
70005 </para>
70006 <para>
70007 There is no support for DSN unitext handling,
70008 and no provision for converting logging from or to UTF-8.
70009 </para>
70010 </section>
70011 <section id="SECTi18nMDA">
70012 <title>MDA operations</title>
70013 <para>
70014 To aid in constructing names suitable for IMAP folders
70015 the following expansion operator can be used:
70016 </para>
70017 <literallayout class="monospaced">
70018 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
70019 </literallayout>
70020 <para>
70021 The string is converted from the charset specified by
70022 the "headers charset" command (in a filter file)
70023 or <option>headers_charset</option> main configuration option (otherwise),
70024 to the
70025 modified UTF-7 encoding specified by RFC 2060,
70026 with the following exception: All occurences of &lt;sep&gt;
70027 (which has to be a single character)
70028 are replaced with periods ("."), and all periods and slashes that are not
70029 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
70030 </para>
70031 <para>
70032 The third argument can be omitted, defaulting to an empty string.
70033 The second argument can be omitted, defaulting to "/".
70034 </para>
70035 <para>
70036 This is the encoding used by Courier for Maildir names on disk, and followed
70037 by many other IMAP servers.
70038 </para>
70039 <para>
70040 Examples:
70041 </para>
70042 <literallayout>
70043 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
70044 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
70045 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
70046 </literallayout>
70047 <para>
70048 Note that the source charset setting is vital, and also that characters
70049 must be representable in UTF-16.
70050 </para>
70051 </section>
70052 </chapter>
70053
70054 <chapter id="CHAPevents">
70055 <title>Events</title>
70056 <titleabbrev>Events</titleabbrev>
70057 <para>
70058 <indexterm role="concept">
70059 <primary>events</primary>
70060 </indexterm>
70061 </para>
70062 <para>
70063 The events mechanism in Exim can be used to intercept processing at a number
70064 of points.  It was originally invented to give a way to do customised logging
70065 actions (for example, to a database) but can also be used to modify some
70066 processing actions.
70067 </para>
70068 <para>
70069 Most installations will never need to use Events.
70070 The support can be left out of a build by defining DISABLE_EVENT=yes
70071 in <filename>Local/Makefile</filename>.
70072 </para>
70073 <para>
70074 There are two major classes of events: main and transport.
70075 The main configuration option <option>event_action</option> controls reception events;
70076 a transport option <option>event_action</option> controls delivery events.
70077 </para>
70078 <para>
70079 Both options are a string which is expanded when the event fires.
70080 An example might look like:
70081 <indexterm role="concept">
70082 <primary>logging</primary>
70083 <secondary>custom</secondary>
70084 </indexterm>
70085 </para>
70086 <literallayout class="monospaced">
70087 event_action = ${if eq {msg:delivery}{$event_name} \
70088 {${lookup pgsql {SELECT * FROM record_Delivery( \
70089     '${quote_pgsql:$sender_address_domain}',\
70090     '${quote_pgsql:${lc:$sender_address_local_part}}', \
70091     '${quote_pgsql:$domain}', \
70092     '${quote_pgsql:${lc:$local_part}}', \
70093     '${quote_pgsql:$host_address}', \
70094     '${quote_pgsql:${lc:$host}}', \
70095     '${quote_pgsql:$message_exim_id}')}} \
70096 } {}}
70097 </literallayout>
70098 <para>
70099 Events have names which correspond to the point in process at which they fire.
70100 The name is placed in the variable <varname>$event_name</varname> and the event action
70101 expansion must check this, as it will be called for every possible event type.
70102 </para>
70103 <para>
70104 The current list of events is:
70105 </para>
70106 <literallayout>
70107 <literal>msg:complete           after    main       </literal> per message
70108 <literal>msg:delivery           after    transport  </literal> per recipient
70109 <literal>msg:rcpt:host:defer    after    transport  </literal> per recipient per host
70110 <literal>msg:rcpt:defer         after    transport  </literal> per recipient
70111 <literal>msg:host:defer         after    transport  </literal> per attempt
70112 <literal>msg:fail:delivery      after    main       </literal> per recipient
70113 <literal>msg:fail:internal      after    main       </literal> per recipient
70114 <literal>tcp:connect            before   transport  </literal> per connection
70115 <literal>tcp:close              after    transport  </literal> per connection
70116 <literal>tls:cert               before   both       </literal> per certificate in verification chain
70117 <literal>smtp:connect           after    transport  </literal> per connection
70118 </literallayout>
70119 <para>
70120 New event types may be added in future.
70121 </para>
70122 <para>
70123 The event name is a colon-separated list, defining the type of
70124 event in a tree of possibilities.  It may be used as a list
70125 or just matched on as a whole.  There will be no spaces in the name.
70126 </para>
70127 <para>
70128 The second column in the table above describes whether the event fires
70129 before or after the action is associates with.  Those which fire before
70130 can be used to affect that action (more on this below).
70131 </para>
70132 <para>
70133 An additional variable, <varname>$event_data</varname>, is filled with information varying
70134 with the event type:
70135 </para>
70136 <literallayout>
70137 <literal>msg:delivery         </literal> smtp confirmation message
70138 <literal>msg:rcpt:host:defer  </literal> error string
70139 <literal>msg:rcpt:defer       </literal> error string
70140 <literal>msg:host:defer       </literal> error string
70141 <literal>tls:cert             </literal> verification chain depth
70142 <literal>smtp:connect         </literal> smtp banner
70143 </literallayout>
70144 <para>
70145 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
70146 </para>
70147 <para>
70148 For complex operations an ACL expansion can be used in <option>event_action</option>
70149 however due to the multiple contexts that Exim operates in during
70150 the course of its processing:
70151 </para>
70152 <itemizedlist>
70153 <listitem>
70154 <para>
70155 variables set in transport events will not be visible outside that
70156 transport call
70157 </para>
70158 </listitem>
70159 <listitem>
70160 <para>
70161 acl_m variables in a server context are lost on a new connection,
70162 and after smtp helo/ehlo/mail/starttls/rset commands
70163 </para>
70164 </listitem>
70165 </itemizedlist>
70166 <para>
70167 Using an ACL expansion with the logwrite modifier can be
70168 a useful way of writing to the main log.
70169 </para>
70170 <para>
70171 The expansion of the event_action option should normally
70172 return an empty string.  Should it return anything else the
70173 following will be forced:
70174 </para>
70175 <literallayout>
70176 <literal>msg:delivery     </literal>  (ignored)
70177 <literal>msg:host:defer   </literal>  (ignored)
70178 <literal>msg:fail:delivery</literal>  (ignored)
70179 <literal>tcp:connect      </literal>  do not connect
70180 <literal>tcp:close        </literal>  (ignored)
70181 <literal>tls:cert         </literal>  refuse verification
70182 <literal>smtp:connect     </literal>  close connection
70183 </literallayout>
70184 <para>
70185 No other use is made of the result string.
70186 </para>
70187 <para>
70188 For a tcp:connect event, if the connection is being made to a proxy
70189 then the address and port variables will be that of the proxy and not
70190 the target system.
70191 </para>
70192 <para>
70193 For tls:cert events, if GnuTLS is in use this will trigger only per
70194 chain element received on the connection.
70195 For OpenSSL it will trigger for every chain element including those
70196 loaded locally.
70197 </para>
70198 </chapter>
70199
70200 <chapter id="CHID13">
70201 <title>Adding new drivers or lookup types</title>
70202 <titleabbrev>Adding drivers or lookups</titleabbrev>
70203 <para>
70204 <indexterm role="concept">
70205 <primary>adding drivers</primary>
70206 </indexterm>
70207 <indexterm role="concept">
70208 <primary>new drivers, adding</primary>
70209 </indexterm>
70210 <indexterm role="concept">
70211 <primary>drivers</primary>
70212 <secondary>adding new</secondary>
70213 </indexterm>
70214 The following actions have to be taken in order to add a new router, transport,
70215 authenticator, or lookup type to Exim:
70216 </para>
70217 <orderedlist numeration="arabic">
70218 <listitem>
70219 <para>
70220 Choose a name for the driver or lookup type that does not conflict with any
70221 existing name; I will use <quote>newdriver</quote> in what follows.
70222 </para>
70223 </listitem>
70224 <listitem>
70225 <para>
70226 Add to <filename>src/EDITME</filename> the line:
70227 </para>
70228 <literallayout>
70229 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
70230 </literallayout>
70231 <para>
70232 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
70233 code is not to be included in the binary by default, comment this line out. You
70234 should also add any relevant comments about the driver or lookup type.
70235 </para>
70236 </listitem>
70237 <listitem>
70238 <para>
70239 Add to <filename>src/config.h.defaults</filename> the line:
70240 </para>
70241 <literallayout class="monospaced">
70242 #define &lt;type&gt;_NEWDRIVER
70243 </literallayout>
70244 </listitem>
70245 <listitem>
70246 <para>
70247 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
70248 and create a table entry as is done for all the other drivers and lookup types.
70249 </para>
70250 </listitem>
70251 <listitem>
70252 <para>
70253 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
70254 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
70255 Add your <literal>NEWDRIVER</literal> to that list.
70256 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
70257 simple form that most lookups have.
70258 </para>
70259 </listitem>
70260 <listitem>
70261 <para>
70262 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
70263 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
70264 driver or lookup type and add it to the definition of OBJ.
70265 </para>
70266 </listitem>
70267 <listitem>
70268 <para>
70269 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
70270 <filename>src</filename>.
70271 </para>
70272 </listitem>
70273 <listitem>
70274 <para>
70275 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
70276 as for other drivers and lookups.
70277 </para>
70278 </listitem>
70279 </orderedlist>
70280 <para>
70281 Then all you need to do is write the code! A good way to start is to make a
70282 proforma by copying an existing module of the same type, globally changing all
70283 occurrences of the name, and cutting out most of the code. Note that any
70284 options you create must be listed in alphabetical order, because the tables are
70285 searched using a binary chop procedure.
70286 </para>
70287 <para>
70288 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
70289 the interface that is expected.
70290 </para>
70291 <?sdop
70292   format="newpage"
70293   foot_right_recto="&chaptertitle;"
70294   foot_right_verso="&chaptertitle;"
70295 ?>
70296 </chapter>
70297
70298 <index role="option">
70299 <title>Options index</title>
70300 </index>
70301
70302 <index role="variable">
70303 <title>Variables index</title>
70304 </index>
70305
70306 <index role="concept">
70307 <title>Concept index</title>
70308 </index>
70309
70310 </book>